B
bw
When CoName has an apostrophe in it like "MyCompany's Name", the procedure
below produces the following error:
Syntax errror (missing operator) in query expression
'[CoName]='MyCompany's Name'".
Note in the error message that I have copied the single and double quotes
acurately.)
Anyone have a fix for this problem?
Thanks,
Bernie
Private Sub AllAddresses_Click()
On Error GoTo Err_AllAddresses_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Addresses"
'Activate the next line to Open with the same name
stLinkCriteria = "[CoName]=" & "'" & Me![CoName] & "'"
MsgBox stLinkCriteria
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_AllAddresses_Click:
Exit Sub
Err_AllAddresses_Click:
MsgBox Err.Description
Resume Exit_AllAddresses_Click
End Sub
below produces the following error:
Syntax errror (missing operator) in query expression
'[CoName]='MyCompany's Name'".
Note in the error message that I have copied the single and double quotes
acurately.)
Anyone have a fix for this problem?
Thanks,
Bernie
Private Sub AllAddresses_Click()
On Error GoTo Err_AllAddresses_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Addresses"
'Activate the next line to Open with the same name
stLinkCriteria = "[CoName]=" & "'" & Me![CoName] & "'"
MsgBox stLinkCriteria
DoCmd.Close
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_AllAddresses_Click:
Exit Sub
Err_AllAddresses_Click:
MsgBox Err.Description
Resume Exit_AllAddresses_Click
End Sub