Checking for new records

A

Amour

I am new to VBA and need to call "TravelForm" from the "MeetingsForm" It
should open in to a new travel with travel info from "tbltravel" filled
in. I tried the following code in the "on Click" property of the calling
button in the MeetingsForm.

Private Sub btnTravel_Click()
On Error GoTo Err_btnTravel_Click

Dim DocName As String
DocName = "frmTravel"
DoCmd.OpenForm DocName, OpenArgs:=Me![Order_Num]
Exit_btnTravel_Click:
Exit Sub

Err_btnTravel_Click:
MsgBox Error$
Resume Exit_btnTravel_Click
End Sub


Then on the Travel form I have:

Private Sub Form_Load()

If IsNull(Me.OpenArgs) = False Then
DoCmd.GoToRecord , , acNewRec
Me!Order_Num = Me.OpenArgs
Else
DoCmd.OpenForm DocName, , , "[SSN]='" & Me.[SSN] & "' AND [Meet_Num]='"
& Me.[MEET_NUM] & "'"
'End If

End Sub


I don't think that I am doing this right. First of all I am getting a
message: Can't find the field Order_Num. Order_Num is located in the table
Travel. So it does not even open travel form.

Please help and thank you very much...
 
Top