Open form to matching record on another form

fipp

Registered User.
Local time
Yesterday, 16:05
Joined
Jun 7, 2007
Messages
14
I have 2 forms.

The first form is called "entry"
the second for is called "play"

I am trying to open the play form on the click of a button so that it displays the records matching the value set for the [playid] field in both forms.

Can anyone help me with the code?
 
Set the record source of the second form to filter on the selections of the first form. For the play form's RecordSource property:

SELECT * FROM YourTableName WHERE PlayID = ValueFromEntryForm;

To do it programmatically, set the Play form's RecordSource in the play form's Load event and force a requery.
 
Or, you can open a form with the where clause supplied by using:

DoCmd.OpenForm "play", acNormal, , "[playid]=" & Me![playid]

no recordset and requery operations required (I liked learning that one as I used to do the same setting of the recordsource and requerying).
 
Bob,
Thanks so much. That is exactly what I needed. I don't want to push my luck here but is there a way to add to what you just gave me another criteria where the field [run] on the form is not null?
 
Code:
DoCmd.OpenForm "play", acNormal, , "[playid]=" & Me![playid] " AND Not IsNull([run])"
Should do it for you.
 

Users who are viewing this thread

Back
Top Bottom