G
Guest
I have an vehicle accident application using two different tables. Table 1 is
primary driver record set. Table 2 would be or could be child record set of
1st, (secondary drivers). I want to be able to create a record type 1 on
entry form, then have command button to "Add Driver" and open 2nd form adding
other driver involved records. I want to save the accident CASE_NUM input on
form 1, and carry that value over to Add Driver form 2 CASE_NUM. I've tried
SetValue and have had no luck, command button works, opens 2nd form, places
focus in proper position, but fails to populate the CASE_NUM field. Any
suggestions would be greatly appreciated.
Bits of Code follows:
Form 1 name is: FR_CR_E
Field name is: Saved_Case_Num
Control Source: = [CASE_NUM]
Form: FR_CR_E has "Add Driver" command button with the following code:
name = Add_Drivers
Caption = &Add Drivers
Tag = Add_Drivers
ON CLICK code is:
Private Sub Add_Drivers_Click()
On Error GoTo Err_Add_Drivers_Click
Dim stDocName As String
strDocName = "Fr_Add_Driver_E"
' Open Fr_Add_Driver_E form in data-entry mode and store CASE_NUM
' the form's OpenArgs property.
DoCmd.OpenForm strDocName, , , , acAdd, , Me!Saved_Case_Num
' give DRIVER_NUM control focus
Forms![Fr_Add_Driver_E]!DRIVER_NUM.SetFocus
Exit_Add_Drivers_Click:
Exit Sub
Err_Add_Drivers_Click:
MsgBox Err.Description
Resume Exit_Add_Drivers_Click
End Sub
2nd form opens and places cursor in proper field, allows entry of new
secondary drivers, but fails to carry over and place the CASE_NUM field from
previous form.
Any suggestions or assistance would be greatly appreciated. Thanks in
advance.
primary driver record set. Table 2 would be or could be child record set of
1st, (secondary drivers). I want to be able to create a record type 1 on
entry form, then have command button to "Add Driver" and open 2nd form adding
other driver involved records. I want to save the accident CASE_NUM input on
form 1, and carry that value over to Add Driver form 2 CASE_NUM. I've tried
SetValue and have had no luck, command button works, opens 2nd form, places
focus in proper position, but fails to populate the CASE_NUM field. Any
suggestions would be greatly appreciated.
Bits of Code follows:
Form 1 name is: FR_CR_E
Field name is: Saved_Case_Num
Control Source: = [CASE_NUM]
Form: FR_CR_E has "Add Driver" command button with the following code:
name = Add_Drivers
Caption = &Add Drivers
Tag = Add_Drivers
ON CLICK code is:
Private Sub Add_Drivers_Click()
On Error GoTo Err_Add_Drivers_Click
Dim stDocName As String
strDocName = "Fr_Add_Driver_E"
' Open Fr_Add_Driver_E form in data-entry mode and store CASE_NUM
' the form's OpenArgs property.
DoCmd.OpenForm strDocName, , , , acAdd, , Me!Saved_Case_Num
' give DRIVER_NUM control focus
Forms![Fr_Add_Driver_E]!DRIVER_NUM.SetFocus
Exit_Add_Drivers_Click:
Exit Sub
Err_Add_Drivers_Click:
MsgBox Err.Description
Resume Exit_Add_Drivers_Click
End Sub
2nd form opens and places cursor in proper field, allows entry of new
secondary drivers, but fails to carry over and place the CASE_NUM field from
previous form.
Any suggestions or assistance would be greatly appreciated. Thanks in
advance.