Re: list box from query
From: Sandra Daigle (Invalid_at_KeepYourSpam.org)
Date: 08/20/04
- Next message: burg: "get values from a subform"
- Previous message: Jesper F: "Re: same code for same event on many controls?"
- In reply to: andrew: "Re: list box from query"
- Next in thread: Dan Artuso: "Re: list box from query"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Aug 2004 09:39:04 -0400
Yes! That helps and explains the problem you are having. When you reference
a control which is on a subform you have to include the parent form in the
reference. The syntax of the reference is as follows:
Forms!ParentFormName!SubformControlName.form!ControlName
Where you replace the following:
ParentFormName: with the name of the parent form
SubFormControlName: with the name of the subform control on the parent form.
(Verify by clicking once on the subform to select the subform control, then
check the name property)
ControlName: with the name of the control on the subform
If you were referencing a control on the grandchild form (or sub-subForm)
then the reference would be a tad more complex because you would have to go
through 2 form objects:
Forms!ParentFormName!SubformControlName.form!SubSubFormControlName.form!Cont
rolName
Your control is on the subform so yours won't be quite so bad!
The requery for the listbox needs to occur in the Current event of the
subform. It would look something like this:
me.subSubFormControlName.form!MyListbox.requery
Note that in this statement "me" is referring to the form object of the
first subform since the code will be in the class module of the first
subform. Then "subSubFormControlName" should be replaced with the name of
the grandchild subform control.
-- Sandra Daigle [Microsoft Access MVP] Please post all replies to the newsgroup. andrew wrote: > Thanks again! > If this helps, I have three nested forms (say, the parent, > child, and grandchild) The listbox is in the grandchild > form, and is based on a value in the child form. > > If I open the form from the parent level, it will ask for > me to enter the query value. > > If I open the form from the child level, it will update > the grandchild form without a prompt. But it also will > not update the query as I switch to a different record > value on the child field. > > The help is appreciated! Thanks for the time. > Andrew > > > >> -----Original Message----- >> If your reference in the query is correct it shouldn't be prompting >> you for a value. Make sure that what you put in the query matches >> the name of the control that has the test value. Select the control >> and double check the name property (under the 'Other' tab). >> >> -- >> Sandra Daigle [Microsoft Access MVP] >> Please post all replies to the newsgroup. >> >> >> andrew wrote: >>> Thanks so much for the help! One thing...when I open the >>> form, it demands that I manually enter a value. How do I >>> get it to look at the value on the parent form? >>> >>> Thanks again! >>> Andrew >>> >>>> -----Original Message----- >>>> Just reference the form control directly in the query.. In the >>>> query designer put the following in the criteria field of the >>>> appropriate column: >>>> >>>> forms!MyForm!MyControl >>>> >>>> Replace 'MyForm' with the name of the form that has the filtering >>>> value and replace 'MyControl' with the control name. >>>> >>>> You may need to requery the listbox using the AfterUpdate event of >>>> the Control that filters the listbox. >>>> >>>> -- >>>> Sandra Daigle [Microsoft Access MVP] >>>> Please post all replies to the newsgroup. >>>> >>>> >>>> andrew wrote: >>>>> Hello all! >>>>> I have a list box (in a subform) that I want to populate >>>>> from a query. I need to "send" to the query a value from >>>>> the parent form. >>>>> >>>>> I created the query in design view, where it works when I >>>>> manually "hard code" the determing value. How do I get my >>>>> form to send different values to the query? >>>>> >>>>> Thanks! >>>>> Andrew >>>> >>>> >>>> . >> >> >> .
- Next message: burg: "get values from a subform"
- Previous message: Jesper F: "Re: same code for same event on many controls?"
- In reply to: andrew: "Re: list box from query"
- Next in thread: Dan Artuso: "Re: list box from query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|