E
Emma
I am trying to pass values from one form to another using OpenArgs.
The values in the main form are as follows:
Job_Id (autonumber field)
cbo_Account_No (numeric field)
cbo_Account_No.Column(1) (which is the account name)
I am using the following code in the main form:
Private Sub Frame_Contract_Type_AfterUpdate()
MyOpenArgs = Me!Job_ID & "," & Me!cbo_Account_No & "," &
Me!cbo_Account_No.Column(1)
Select Case Form_frm_Tbl_Master_Jobs!Frame_Contract_Type
Case 1
DoCmd.OpenForm "Frm_Tbl_Contracts_Int", , , , acFormAdd, , MyOpenArgs
Case 2
DoCmd.OpenForm "Frm_Tbl_Contracts_Biopsy", , , , acFormAdd
Case Else
DoCmd.GoToControl "Comments"
End Select
End Sub
In the pop-up form I have the following to put these values in the
respective fields:
Private Sub Form_Open(Cancel As Integer)
'txt_Contract_Main_No = Format(Nz(DMax("[Contract_Main_No]",
"qry_Int_contracts_Main"), 0) + 1, "00000")
FK_Job_ID = Split(MyOpenArgs, ",")(0)
txt_Account_No = Split(MyOpenArgs, ",")(1)
Contract_Account_Name = Split(MyOpenArgs, ",")(2)
End Sub
However, when I make my selection from the option frame, I get a subscript
out of range error and it looks like OpenArgs are not being passed to the new
form. Can anyone tell me how to fix this?
Thank you!
The values in the main form are as follows:
Job_Id (autonumber field)
cbo_Account_No (numeric field)
cbo_Account_No.Column(1) (which is the account name)
I am using the following code in the main form:
Private Sub Frame_Contract_Type_AfterUpdate()
MyOpenArgs = Me!Job_ID & "," & Me!cbo_Account_No & "," &
Me!cbo_Account_No.Column(1)
Select Case Form_frm_Tbl_Master_Jobs!Frame_Contract_Type
Case 1
DoCmd.OpenForm "Frm_Tbl_Contracts_Int", , , , acFormAdd, , MyOpenArgs
Case 2
DoCmd.OpenForm "Frm_Tbl_Contracts_Biopsy", , , , acFormAdd
Case Else
DoCmd.GoToControl "Comments"
End Select
End Sub
In the pop-up form I have the following to put these values in the
respective fields:
Private Sub Form_Open(Cancel As Integer)
'txt_Contract_Main_No = Format(Nz(DMax("[Contract_Main_No]",
"qry_Int_contracts_Main"), 0) + 1, "00000")
FK_Job_ID = Split(MyOpenArgs, ",")(0)
txt_Account_No = Split(MyOpenArgs, ",")(1)
Contract_Account_Name = Split(MyOpenArgs, ",")(2)
End Sub
However, when I make my selection from the option frame, I get a subscript
out of range error and it looks like OpenArgs are not being passed to the new
form. Can anyone tell me how to fix this?
Thank you!