Re: Help - Can't understand Code




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


.



Relevant Pages

  • RE: Database Search Facility
    ... I encountered your posts while researching a solution to my database ... I have had great results from the recommended Ad-Hoc Report! ... > What I specifically want to do is construct a main form with a subform. ... > in the main form and linking them to a query. ...
    (microsoft.public.access.formscoding)
  • Re: My SubForm Woes
    ... Then compact the database: ... Right-click the edge of the subform control, ... query, rather than just those that match some field in the main form. ... > The first is that the second subform seems to ...
    (microsoft.public.access.forms)
  • RE: Subform button characteristics
    ... What I would do is include the checkbox in the subform and set the query so ... is imported to the database on a regular basis. ...
    (microsoft.public.access.forms)
  • a special type of search form
    ... The list of all records you saw was probably a ListBox. ... Private Sub List1_DblClick ... You can also set criteria in your query based on values on ... >the form would be a list of every record in the database, ...
    (microsoft.public.access.forms)
  • Re: Access crashes when I remove filter on a sub form
    ... Then compact the database to get rid of this junk: ... LinkMasterFields/LinkChildFields properties of any of your subforms? ... If not (and particularly if the subform's source is a query), ... add a text box to the subform ...
    (microsoft.public.access.formscoding)