G
Guest
I have an application that has two record types that I'll call type A and
type B in two different tables (A & B). There will only be one Type A
record, but could be NO type B records or could be MULTIPLE type B records.
I've tried building 1 single form to do data entry work for this issue, but
had no success, so I've split it to TWO forms, one builds type A records,
then gives the user a command button option to build type B records. If
button is clicked, takes user to 2nd form for type B record entry. I wanted
to save and pass key record value ##-#### from form A to form B, but the
value doesn't pass. The following is the event & code.
Form a title is Fr_CR_E Field on this form with text data I want to pass
is named
Text_Case_Num. Control Source for this field is
=[TST_FR_CASE_RECORDS.CASE_NUM] . Command button is named AddDriver with TAG
parm set to AddDriver and ON-CLICK parm set to Event Procedure as below.
Event Code is:
Private Sub AddDriver_Click()
On Error GoTo Err_AddDriver_Click
Dim strDocName As String
strDocName = "Fr_Add_Driver_E"
' Opens form Fr_Add_Driver_E in Data Entry Mode to add Drivers
' storing [Form]![FR_CR_E]![Text_Case_Num] into
' [Form]![Fr_Add_Driver_E]![CASE_NUM] to start
DoCmd.OpenForm strDocName, , , , acAdd, , Me!Text_Case_Num
' Give Other driver form control focus
Forms![Fr_Add_Driver_E]!DRIVER_NUM.SetFocus
Exit_AddDriver_Click:
Exit Sub
Err_AddDriver_Click:
MsgBox Err.Description
Resume Exit_AddDriver_Click
End Sub
----------------------
A macro exists named Fr_CR_E with the following in it:
AddDriver OpenForm Form Name Fr_Add_Driver_E
View=Form
Filter Name = null
Where Condition = null
Data Mode = Add
Window Mode = Normal.
SetValue Item [Forms]![Fr_Add_Driver_E]![CASE_NUM]
expression [Forms]![Fr_CR_E]![Text_Case_Num]
GoToControl Driver_Num
------------------------------------------------------
At this point form a Text_Case_Num has 05-010101 data in field, user clicks
AddDriver button, then secondary form appears. Form name is Fr_Add_Driver_E
appears but 1st field CASE_NUM is empty, but cursor does appear in Driver_Num
field, which is where I want the cursor. I'm just missing my CASE_NUM. Can
anyone help identify the problem.
Thanks in advance.
Robert Nusz,
DPS, State of Oklahoma
Robert Nusz @ DPS
type B in two different tables (A & B). There will only be one Type A
record, but could be NO type B records or could be MULTIPLE type B records.
I've tried building 1 single form to do data entry work for this issue, but
had no success, so I've split it to TWO forms, one builds type A records,
then gives the user a command button option to build type B records. If
button is clicked, takes user to 2nd form for type B record entry. I wanted
to save and pass key record value ##-#### from form A to form B, but the
value doesn't pass. The following is the event & code.
Form a title is Fr_CR_E Field on this form with text data I want to pass
is named
Text_Case_Num. Control Source for this field is
=[TST_FR_CASE_RECORDS.CASE_NUM] . Command button is named AddDriver with TAG
parm set to AddDriver and ON-CLICK parm set to Event Procedure as below.
Event Code is:
Private Sub AddDriver_Click()
On Error GoTo Err_AddDriver_Click
Dim strDocName As String
strDocName = "Fr_Add_Driver_E"
' Opens form Fr_Add_Driver_E in Data Entry Mode to add Drivers
' storing [Form]![FR_CR_E]![Text_Case_Num] into
' [Form]![Fr_Add_Driver_E]![CASE_NUM] to start
DoCmd.OpenForm strDocName, , , , acAdd, , Me!Text_Case_Num
' Give Other driver form control focus
Forms![Fr_Add_Driver_E]!DRIVER_NUM.SetFocus
Exit_AddDriver_Click:
Exit Sub
Err_AddDriver_Click:
MsgBox Err.Description
Resume Exit_AddDriver_Click
End Sub
----------------------
A macro exists named Fr_CR_E with the following in it:
AddDriver OpenForm Form Name Fr_Add_Driver_E
View=Form
Filter Name = null
Where Condition = null
Data Mode = Add
Window Mode = Normal.
SetValue Item [Forms]![Fr_Add_Driver_E]![CASE_NUM]
expression [Forms]![Fr_CR_E]![Text_Case_Num]
GoToControl Driver_Num
------------------------------------------------------
At this point form a Text_Case_Num has 05-010101 data in field, user clicks
AddDriver button, then secondary form appears. Form name is Fr_Add_Driver_E
appears but 1st field CASE_NUM is empty, but cursor does appear in Driver_Num
field, which is where I want the cursor. I'm just missing my CASE_NUM. Can
anyone help identify the problem.
Thanks in advance.
Robert Nusz,
DPS, State of Oklahoma
Robert Nusz @ DPS