E
Emma
Hi all,
I am using Open Args to pass values to linked forms.
In the main form I have the following code
Private Sub Frame_Contract_Type_AfterUpdate()
Dim MyOpenArgs As String
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
Me!Job_ID is a number field
Me!cbo_Account_No is a text field
Me!cbo_Account_No.Column(1) is text
In the linked form is the following code:
Private Sub Form_Load()
Dim txt_Contract_Main_No As String
Dim FK_Job_ID As Integer
Dim Contract_Account_Name As String
FK_Job_ID = Split(MyOpenArgs, ",")(0)
Contract_Account_Name = Split(MyOpenArgs, ",")(2)
End Sub
I am getting a type mismatch error when I open the linked form. Is it
because OpenArgs converts any numeric fields to string? If so, how do I get
the FK_Job_ID field populated? I think I need to convert it back to an
integer. How would I do that?
Any help is appreciated!
I am using Open Args to pass values to linked forms.
In the main form I have the following code
Private Sub Frame_Contract_Type_AfterUpdate()
Dim MyOpenArgs As String
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
Me!Job_ID is a number field
Me!cbo_Account_No is a text field
Me!cbo_Account_No.Column(1) is text
In the linked form is the following code:
Private Sub Form_Load()
Dim txt_Contract_Main_No As String
Dim FK_Job_ID As Integer
Dim Contract_Account_Name As String
FK_Job_ID = Split(MyOpenArgs, ",")(0)
Contract_Account_Name = Split(MyOpenArgs, ",")(2)
End Sub
I am getting a type mismatch error when I open the linked form. Is it
because OpenArgs converts any numeric fields to string? If so, how do I get
the FK_Job_ID field populated? I think I need to convert it back to an
integer. How would I do that?
Any help is appreciated!