Re: Help - Can't understand Code
- From: Angeline <Angeline@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 28 Mar 2006 18:36:01 -0800
Hi TC
Just for your reference I got the database from:
http://www.rogersaccesslibrary.com/OtherLibraries.asp#Hookom,Duane
and selected: Listbox with MultiSelection used in Query
Thanks
Angeline
"Angeline" wrote:
TC,.
Wow, thanks so much for the compliment - I needed it.
OK
1) I have the sample database in its orignial form. The form does work
however if I actually try and run the query which the subform is bound to by
itself, I do get an error which sais: Microsoft Access can't find the form
'frmMultiselectListDemo' referred to in a macro expression or VB code.
If I then click on debug, it highliths the following IsVarSelected Module
code:
Set lbo = Forms (strFormName)(strListBoxName)
2) The subform doesn't have a SELECT statement however the query it is bound
to does. You mentioned I had to change the parameter values. I had actually
already done this. At first I hadn't and when I tried to test the form it
came up with an error. I then got wiser to it and changed the parameter names
to suit but the result upon testing was no error, however no results
displayed in the subform.
The sql statement in the subquery that the subform is bound to with my
parameters is:
SELECT TblComp.*
FROM TblComp
WHERE
(((IsSelectedVar("frmMultiselectListDemo","lboSpecificCompetency",[SpecificCompetency]))=-1));
The third paramater [SpecificCompetency] I have assumed should be is the
variable field name that is used in the list box (as was the case in the
demo).
The list box by the way has the following select statement:
SELECT TblComp.SpecificCompetency FROM TblComp GROUP BY
TblComp.SpecificCompetency ORDER BY TblComp.SpecificCompetency;
IF anything jumps out at you I'd so appreciate it. The whole idea of doing
this was for recruiters to customize an interview guide. They view a form
than allows them to select a number of 'specific competencies' out of 50 that
would then display for them the relevent interview questions for those
selected which they can print off. I might be going about this the wrong way.
Cheers
Angeline
"TC" wrote:
Ok, full marks for your problem description! It's perfectly clear, I'm
sure we can help.
The first thing I'd check, is that the example actually works for you
in its original fom. I don't know that database, so I can not comment
on it. But there is always the possibility that you download an example
that actually does not work in the first place! So, download it again
(if you don't still have an unchanged copy) & make sure that it does
actually work.
Next, you do not need to change any names within the IsSelectedVar()
function itself, because that function gets all of the information that
it needs, as parameter values which are passed to it, by whoever calls
it. But in the subforms's SELECT statement, in the IsVarSelected()
call, you /do/ need to change the first two parameter values, to suit
your own needs. Those two values should be (1) the quoted name of your
main form, and (2) the quoted name of the listbox /control/ on the main
form. So if yo have change the name of the main form, or the listbox
control on the main form, you will have to change the two parameters in
the IsVarSlected(0 call in th subform's SELECT statement, to match.
Post back if that does not help. Again,. well done on the problem
description :-)
HTH,
TC (MVP Access)
http://tc2.atspace.com
- References:
- Re: Help - Can't understand Code
- From: TC
- Re: Help - Can't understand Code
- From: Angeline
- Re: Help - Can't understand Code
- Prev by Date: Re: Help - Can't understand Code
- Next by Date: Re: Joining existing records in two tables
- Previous by thread: Re: Help - Can't understand Code
- Next by thread: Re: Help - Can't understand Code
- Index(es):
Relevant Pages
|