Assigning RecordSource to a form

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

Guest

Dear All,

I want to dynamically assign RecordSource to my acces form. I have a main
form which has 2 buttons on it. Depending on which button is clicked . the
recordsource should be dynamically assigned.

For example if I click Button1 a new form should open and its should assign
a Recordsource "btn1RecordSource"

and if Button2 is clicked it should assign a different record source lets say
"btn2RecordSource" to the same form.

So its 1 form but different record sources.

Any help would be greatly appreciated.

cheers,
Sam Solomon
 
In each command box's OnClick event, as part of the DoCmd.OpenForm statement
that opens the new form, add a valid SQL statement as the OpenArgs argument.
In the new form's Open event, include as your first statement, the line Me.
RecordSource = Me.OpenArgs
 
Back
Top