L
Lisa
I am trying to have a command button on the form 'Customers' open the
form 'Orders' to a new record with the CustomerID information
displayed.
In the form 'Customers' I added the command button with the following
event for On Click:
Private Sub cmdEnterOrder_Click()
On Error GoTo Err_cmdEnterOrder_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Orders"
DoCmd.OpenForm (stDocName,[View As
AcFormView=acNormal],,,,[WindowMode As
AcWindowMode=acWindowNormal],[OpenArgs: = Me!CustomerID])
Exit_cmdEnterOrder_Click:
Exit Sub
Err_cmdEnterOrder_Click:
MsgBox Err.Description
Resume Exit_cmdEnterOrder_Click
End Sub
On the form 'Orders' I added the following code for On Open:
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs & "" <> "" Then
Me!CustomerID.DefaultValue = Me.OpenArgs
End If
End Sub
When I try to use the command button I get the following error message:
Compile Error
Expected: =
I have tried playing with this but cannot determine where the error
lies. Any assistance would be GREATLY appreciated.
form 'Orders' to a new record with the CustomerID information
displayed.
In the form 'Customers' I added the command button with the following
event for On Click:
Private Sub cmdEnterOrder_Click()
On Error GoTo Err_cmdEnterOrder_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Orders"
DoCmd.OpenForm (stDocName,[View As
AcFormView=acNormal],,,,[WindowMode As
AcWindowMode=acWindowNormal],[OpenArgs: = Me!CustomerID])
Exit_cmdEnterOrder_Click:
Exit Sub
Err_cmdEnterOrder_Click:
MsgBox Err.Description
Resume Exit_cmdEnterOrder_Click
End Sub
On the form 'Orders' I added the following code for On Open:
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs & "" <> "" Then
Me!CustomerID.DefaultValue = Me.OpenArgs
End If
End Sub
When I try to use the command button I get the following error message:
Compile Error
Expected: =
I have tried playing with this but cannot determine where the error
lies. Any assistance would be GREATLY appreciated.