Assigning RecordSource to a form

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
 
O

OfficeDev18 via AccessMonster.com

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
 

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