I am having trouble making a command button on the 1st form pull up a 2nd form.
The common field is called ReservationID.
The code below calls up the 2nd form but it is blank just showing the fields with no answers.
So it almost works. No error messages.
Can you see my mistake? Thanks.
-----------------------------------------------------------------------------
This is the code in the command button that is on frmForm1.
Private Sub cmdGetForm2_Click()
' If record not saved, save it
If Me.Dirty Then Me.Dirty = False
' If no ReservationID, do nothing
If IsNull(Me.ReservationID) Then Exit Sub
' Open form filtered. The Me.ReservationID form is frmForm1.
' In the wherecondition, the left side is the frmForm2 and right side is the frmForm1.
' In other words 'TO' and then 'FROM'. To is the frmForm2 and From is frmForm1.
DoCmd.OpenForm "frmForm2", _
WhereCondition:="[forms]![frmForm2]![ReservationID] = " & Me.ReservationID
End Sub
The common field is called ReservationID.
The code below calls up the 2nd form but it is blank just showing the fields with no answers.
So it almost works. No error messages.
Can you see my mistake? Thanks.
-----------------------------------------------------------------------------
This is the code in the command button that is on frmForm1.
Private Sub cmdGetForm2_Click()
' If record not saved, save it
If Me.Dirty Then Me.Dirty = False
' If no ReservationID, do nothing
If IsNull(Me.ReservationID) Then Exit Sub
' Open form filtered. The Me.ReservationID form is frmForm1.
' In the wherecondition, the left side is the frmForm2 and right side is the frmForm1.
' In other words 'TO' and then 'FROM'. To is the frmForm2 and From is frmForm1.
DoCmd.OpenForm "frmForm2", _
WhereCondition:="[forms]![frmForm2]![ReservationID] = " & Me.ReservationID
End Sub