dymanically setting the record source for a form

J

JulieD

i would like to open one form which can be based on either of two queries
depending on what the user has selected in a previous form. How do you
dynamically set the record source of a form?

Cheers
JulieD
 
D

Dan Artuso

Hi,
Forms!yourFormName.RecordSource = "yourQuery"
Forms!yourFormName.Requery

Of course the form has to be open before you execute the code.
If you run the code from within the form itself, you can use:
Me.RecordSource = "yourQuery"
Me.Requery
 

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