Auto Populate a Subform Query

  • Thread starter pushrodengine via AccessMonster.com
  • Start date
P

pushrodengine via AccessMonster.com

I have set up a subform based on the query “qryIncidentLogâ€

The query is based on more one than combo box on the main form.

How do you get the subform to automatically populate when you hit enter
after entering the data in each of the combo boxes?

The subform should be able to auto populate even when some of the combo boxes
are left blank.

Thanks
 
T

tina

set the criteria in each subform query field to "mainform control" Or
"mainform control is null". for example, let's say the mainform is named
FormA, and you have two combobox controls named cboB and cboC. set the
criteria in the "matching" query field for cboB to

Forms!FormA!cboB Or Forms!FormA!cboB Is Null

set the criteria in the "matching" query field for cboC to

Forms!FormA!cboC Or Forms!FormA!cboC Is Null

if you want the subform to requery after each combobox is updated, add code
each combobox control's AfterUpdate event procedure, as

Me!SubformControlName.Form.Requery

make sure you use the name of the "container" control, in the main form,
that "holds" the subform - not the name of the subform as you see it in the
database window. those two names may be the same, or they may be different.

i usually add a "Filter" command button to the main form, to requery the
subform at the user's discretion, rather than automatically requerying after
each combobox control is updated. and i add a "Reset" button to the main
form, to clear all the combobox controls on the main form and then requery
the subform, so all records are returned - again, at the user's discretion.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top