dymanically setting the record source for a form

  • Thread starter Thread starter JulieD
  • Start date Start date
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
 
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
 
Back
Top