A
Abay
I have a "browse" tabular form which shows critical fields for clients in a
Client table, one line per client .. each line has a "command button" to
show "More" information .. which brings up a form containing all information
for a client .. the link between the forms is the Client name.
This works fine except for a client name of, for example, O'Donnell. When
the command button is clicked for O'Donnell I get the message "Syntax error
(missing operator) in query expression '[Lname] = 'O'Donnell".
The code for the command button is as follows:
Private Sub Command150_Click()
On Error GoTo Err_Command150_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FClient_and_sub_more"
stLinkCriteria = "[Lname]=" & "'" & Me![Lname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command150_Click:
Exit Sub
Err_Command150_Click:
MsgBox Err.Description
Resume Exit_Command150_Click
I'm sure the problem is caused by the ' as part of the name .. any help
would be much appreciated for a newbie learning as I go along ... said that
before, but I'm still learning.
abay
Client table, one line per client .. each line has a "command button" to
show "More" information .. which brings up a form containing all information
for a client .. the link between the forms is the Client name.
This works fine except for a client name of, for example, O'Donnell. When
the command button is clicked for O'Donnell I get the message "Syntax error
(missing operator) in query expression '[Lname] = 'O'Donnell".
The code for the command button is as follows:
Private Sub Command150_Click()
On Error GoTo Err_Command150_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FClient_and_sub_more"
stLinkCriteria = "[Lname]=" & "'" & Me![Lname] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command150_Click:
Exit Sub
Err_Command150_Click:
MsgBox Err.Description
Resume Exit_Command150_Click
I'm sure the problem is caused by the ' as part of the name .. any help
would be much appreciated for a newbie learning as I go along ... said that
before, but I'm still learning.
abay