I am using the code below to transfer values from one form to another. However, I am getting the following error: "Runtime error '-2147352567 (80020009)': You can't assign a value to this object."
Using the immediate window I see the value of each OpenArgs, so it's not a question of the split being a problem. The issue is that I can't assign a value to a simple textbox. I even renamed the first textbox to txtEventName to make sure there wasn't a conflict with the ControlSource, but it still fails at that point.
I am using Access 2007 in compatability mode for 2002 - 2003.
Thanks.
---------------------------------------------------------------------------
Private Sub cmdAddMaterials_Click()
On Error GoTo Err_cmdAddMaterials_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMaterialsRequests"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.EventName & ";" & Me.StartDate & ";" & Me.Zip & ";" & Me.ZipPlusFour & ";" & Me.City & ";" & Me.State
Exit_cmdAddMaterials_Click:
Exit Sub
Err_cmdAddMaterials_Click:
MsgBox Err.Description
Resume Exit_cmdAddMaterials_Click
End Sub
---------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
Dim Args As Variant
If Not IsNull(Me.OpenArgs) Then
Args = Split(Me.OpenArgs, ";")
Me.txtEventName = Args(0)
Me.EventDate = Args(1)
Me.Zip = Args(2)
'Me.ZipPlusFour = Args(3)
Me.City = Args(4)
Me.State = Args(5)
End If
End Sub
Using the immediate window I see the value of each OpenArgs, so it's not a question of the split being a problem. The issue is that I can't assign a value to a simple textbox. I even renamed the first textbox to txtEventName to make sure there wasn't a conflict with the ControlSource, but it still fails at that point.
I am using Access 2007 in compatability mode for 2002 - 2003.
Thanks.
---------------------------------------------------------------------------
Private Sub cmdAddMaterials_Click()
On Error GoTo Err_cmdAddMaterials_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMaterialsRequests"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , Me.EventName & ";" & Me.StartDate & ";" & Me.Zip & ";" & Me.ZipPlusFour & ";" & Me.City & ";" & Me.State
Exit_cmdAddMaterials_Click:
Exit Sub
Err_cmdAddMaterials_Click:
MsgBox Err.Description
Resume Exit_cmdAddMaterials_Click
End Sub
---------------------------------------------------------------------------
Private Sub Form_Open(Cancel As Integer)
Dim Args As Variant
If Not IsNull(Me.OpenArgs) Then
Args = Split(Me.OpenArgs, ";")
Me.txtEventName = Args(0)
Me.EventDate = Args(1)
Me.Zip = Args(2)
'Me.ZipPlusFour = Args(3)
Me.City = Args(4)
Me.State = Args(5)
End If
End Sub