B
Branden Johnson
Using Microsoft Access 2002 (10.2627.2625)
Windows XP Pro SP1
I have a form called frmCustomerDetail. On this form I have included the
Primary Key for the base table, CUSTOMERID, in a hidden TextBox:
txtCustomerID.
I am trying to place a button on this form that opens another form,
frmSystemDetail, showing the record in the SYSTEMDETAIL table that
corresponds to the record being displayed on frmCustomerDetail.
I know this sounds simple. I have spent hours trying to get this to work! I
have tried writing my own Sub Routine, creating a Macro, and using the
Control Wizard. None of these has worked. Here is the code generated by the
Control Wizard:
Private Sub cmdSysDetail_Click()
On Error GoTo Err_cmdSysDetail_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSystemDetail"
stLinkCriteria = "[CUSTOMERID]=" & Me![txtCustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdSysDetail_Click:
Exit Sub
Err_cmdSysDetail_Click:
MsgBox Err.DESCRIPTION
Resume Exit_cmdSysDetail_Click
End Sub
I am getting the following error when I click on the CommandButton:
Syntax error in query expression '[CUSTOMERID]= '.
I have tried making txtCustomerID visible (correctly shows the CUSTOMERID)
and still does not work.
Final Note: All my Primary Keys and Foreign Keys are AutoNumber-Replication
ID format. Maybe this is where I am running into trouble.
Any help, or suggestions, would be greatly appreciated. Thanks, in advance.
Branden Johnson
Windows XP Pro SP1
I have a form called frmCustomerDetail. On this form I have included the
Primary Key for the base table, CUSTOMERID, in a hidden TextBox:
txtCustomerID.
I am trying to place a button on this form that opens another form,
frmSystemDetail, showing the record in the SYSTEMDETAIL table that
corresponds to the record being displayed on frmCustomerDetail.
I know this sounds simple. I have spent hours trying to get this to work! I
have tried writing my own Sub Routine, creating a Macro, and using the
Control Wizard. None of these has worked. Here is the code generated by the
Control Wizard:
Private Sub cmdSysDetail_Click()
On Error GoTo Err_cmdSysDetail_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSystemDetail"
stLinkCriteria = "[CUSTOMERID]=" & Me![txtCustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdSysDetail_Click:
Exit Sub
Err_cmdSysDetail_Click:
MsgBox Err.DESCRIPTION
Resume Exit_cmdSysDetail_Click
End Sub
I am getting the following error when I click on the CommandButton:
Syntax error in query expression '[CUSTOMERID]= '.
I have tried making txtCustomerID visible (correctly shows the CUSTOMERID)
and still does not work.
Final Note: All my Primary Keys and Foreign Keys are AutoNumber-Replication
ID format. Maybe this is where I am running into trouble.
Any help, or suggestions, would be greatly appreciated. Thanks, in advance.
Branden Johnson