A
Amour
I am really new to VBA,
currently I have one form were I create meetings,
than another one were the individual is inputted (all works great - this is
not the problem). I am trying to open a form(frmTravel) from that
Individual form by clicking on a button (This I already have and that part
works). I want the
newly opened form (Travel) to automatically populate a few fields (that you
can not see on the form) that are the primary fields. example: [field1] =
Me.[field1] and [field2] = Me.[field2]. This information comes from the
previous forms. Now if the record already exist then
I want it to populate the form from the table tblTravel
This is what I have:
Private Sub btnTravel_Click()
On Error GoTo Err_btnTravel_Click
Dim DocName As String
DocName = "frmTravel"
DoCmd.OpenForm DocName, , , "[Field1]='" & Me.[Field1] & "' AND
[Feild2]='" & Me.[Field2] & "'", , , Me.[Field1] & "$" & Me.[Field2]
Exit_btnTravel_Click:
Exit Sub
Err_btnTravel_Click:
MsgBox Error$
Resume Exit_btnTravel_Click
End Sub
And on the form Travel I have in the load:
Private Sub Form_Load()
If Me.NewRecord Then
Me.[Field1] = split(Me.OpenArgs, "$")(0)
Me.[Field2] = split(Me.OpenArgs, "$")(1)
End If
End Sub
Thank You for any help.....
currently I have one form were I create meetings,
than another one were the individual is inputted (all works great - this is
not the problem). I am trying to open a form(frmTravel) from that
Individual form by clicking on a button (This I already have and that part
works). I want the
newly opened form (Travel) to automatically populate a few fields (that you
can not see on the form) that are the primary fields. example: [field1] =
Me.[field1] and [field2] = Me.[field2]. This information comes from the
previous forms. Now if the record already exist then
I want it to populate the form from the table tblTravel
This is what I have:
Private Sub btnTravel_Click()
On Error GoTo Err_btnTravel_Click
Dim DocName As String
DocName = "frmTravel"
DoCmd.OpenForm DocName, , , "[Field1]='" & Me.[Field1] & "' AND
[Feild2]='" & Me.[Field2] & "'", , , Me.[Field1] & "$" & Me.[Field2]
Exit_btnTravel_Click:
Exit Sub
Err_btnTravel_Click:
MsgBox Error$
Resume Exit_btnTravel_Click
End Sub
And on the form Travel I have in the load:
Private Sub Form_Load()
If Me.NewRecord Then
Me.[Field1] = split(Me.OpenArgs, "$")(0)
Me.[Field2] = split(Me.OpenArgs, "$")(1)
End If
End Sub
Thank You for any help.....