Changing Data Source on a form

  • Thread starter Thread starter Luis
  • Start date Start date
L

Luis

Hello.
I'm not sure if this is possible but it's worth trying.
I have a form that opens with information taken from a
query. I have a union query that joins 2 tables. What i
want to do is, when i click a button on this form, the
source of data passes from the first query to the union
query and then refreshes the form.

Is this possible ?
 
Label Your Button "Use Union Query"

Put this code in the OnClick event of the button:

If Me!NameOfButton.Caption = "Use Union Query"
Me.RecordSource = "NameOfUnionQuery"
Me.Requery
Me!NameOfButton.Caption = "Use First Query"
Else
Me.RecordSource = "NameOfFirstQuery"
Me.Requery
Me!NameOfButton.Caption = "Use Union Query"
End If
 
Back
Top