Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SubForm not updating after selecting from Form's combobox

Status
Not open for further replies.

platypus71

Technical User
Sep 7, 2005
68
US
I know I am missing something simple here, but I can't seem to put my finger on it.

I have a form with a combobox. When a user selects from the list in the combobox, it should refresh the subform data to limit the results to the selection from the combobox.

If I hit <shift>-F9, the subform changes how I expect it, so I know it works.

What I need is help on what I need to set the 'On Change' field so that it refreshes the subform. I tried using the 'Requery' through the macros, but it doesn't seem to work.
Please advise.
 
Did you try something like this:

Me.FORM NAME.form.COMBOBOXNAME.requery

nim180
 
How are ya platypus71 . . .

The combo's [blue]On Change[/blue] event is not a good place to detect updating. Use the combo's [blue]AfterUpdate[/blue] event instead.

If the combo is on the mainform, the following should do:
Code:
[blue][subFormName].Form.Requery[/blue]
Be sure to have a look at the following:

Refer to Form and Subform properties and controls

How to refer to a control on a subform or subreport in Access

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I tried your suggestions, but either don't understand coding enough or was missing something.

I then decided to look at another database I have that does exactly the same thing and works to figure out where the difference was (duh, could have saved yesterday's headache).

In my new database, the Record Source for the main form was blank, but the combobox has a Row Source. I copied and pasted the code from Row Source to the form's Record Source and everything worked (I use AfterUpdate with the requery macro).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top