Checking for new records

G

Guest

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...
 

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

Similar Threads

Checking records 1
Populating FIELDS from another form(s) 2
Checking if record already exist 4
Field Required msg 2
Linking forms 2
Passing values between forms 2
Open to Blank Form 2
Popluating a form 3

Top