Reusable Form - Variable Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a Reusable Form - with an underlying Variable Query,
contingent upon a menu selected.
For example -
if a form is opened using option 1, it uses query x
if the same for is opened using option 2, it uses query y.

Any ideas ?
 
Do it all the time:
This code is in the form's module

Private Sub cmdLookOne_Click()
Dim strSQL As String
strSQL = "SELECT * from tblOne;"
Me.RecordSource = strSQL
'or to use a query name
'Me.RecordSource = "qtempQuery"
End Sub

In your proposal, query x and query y must have identical fieldnames so that
form binding takes place properly.
HTH, UpRider
 
I tried that - doesn't seem to work -
It would appear that the record source property needs to be updated prior to
the form being opened. I am using access queries instead of sql statements.
Any ideas ?
Thanks
 
Back
Top