Hello ,
I'm trying to open a form from a main form that gets information from the main form.
I usually do this when only one argument needs to be passed, however I need to pass multiple arguments and the are all Numbers(Integers). I found some examples where you string them together with a separator (|). I know this passes the arguments but I Keep getting an error message that I'm using the wrong type.
Does any one have any Idea as to what I can do to make this work?
This Code is on my main Form.
Private Sub cmdAddCostItem_Click()
Dim stDocName As String
Dim stLink As String
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = Me.txtDivisionID
b = Me.txtSubDivisionID
c = 1
stLink = "a|b|c"
stDocName = "frmCostItemDetails"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acNormal, stLink
End Sub
This Code is On My 2nd Form.
Private Sub Form_Load()
Dim strA As String
Dim strB As String
Dim strC As String
If Not IsNull(Me.OpenArgs) Then
strA = ParseText(OpenArgs, 0)
strB = ParseText(OpenArgs, 1)
strC = ParseText(OpenArgs, 2)
Me.DivisionID = strA
Me.SubDivisionID = strB
Me.BidCategoryID = strC
End If
End Sub
This code is from a Public Module.
Public Function ParseText(TextIn As String, x) As Variant
Dim Var As Variant
On Error Resume Next
Var = Split(TextIn, "|", -1)
ParseText = Var(x)
End Function
I'm trying to open a form from a main form that gets information from the main form.
I usually do this when only one argument needs to be passed, however I need to pass multiple arguments and the are all Numbers(Integers). I found some examples where you string them together with a separator (|). I know this passes the arguments but I Keep getting an error message that I'm using the wrong type.
Does any one have any Idea as to what I can do to make this work?
This Code is on my main Form.
Private Sub cmdAddCostItem_Click()
Dim stDocName As String
Dim stLink As String
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = Me.txtDivisionID
b = Me.txtSubDivisionID
c = 1
stLink = "a|b|c"
stDocName = "frmCostItemDetails"
DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, acNormal, stLink
End Sub
This Code is On My 2nd Form.
Private Sub Form_Load()
Dim strA As String
Dim strB As String
Dim strC As String
If Not IsNull(Me.OpenArgs) Then
strA = ParseText(OpenArgs, 0)
strB = ParseText(OpenArgs, 1)
strC = ParseText(OpenArgs, 2)
Me.DivisionID = strA
Me.SubDivisionID = strB
Me.BidCategoryID = strC
End If
End Sub
This code is from a Public Module.
Public Function ParseText(TextIn As String, x) As Variant
Dim Var As Variant
On Error Resume Next
Var = Split(TextIn, "|", -1)
ParseText = Var(x)
End Function