Ron
You will want to change the single quote to 2 double quotes, using the
Replace() function (Access 2000 & up)
= Replace(<string to search in>, "'", "''", 1, , vbTextCompare)
HTH
--
Rob
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Need to launch your application in the appropriate version of Access?
http://www.fmsinc.com/Products/startup/index.asp
Need software tools for Access, VB, SQL or .NET?
http://www.fmsinc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"RonM" <(E-Mail Removed)> wrote in message
news:1c7a01c3841e$48ad0610$(E-Mail Removed)...
> I have a command button that runs fine as long as there is
> not an apostrophie in the field value for [Location_Name].
> i.e. if [Location_Name]="Joe's Grill"
> I'm sure this is very simple to fix, I'm just a rookie...
> Here is the code:
>
> Private Sub Assignments_Btn_Click()
> On Error GoTo Err_Assignments_Btn_Click
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "Assignments_By_Co"
>
> stLinkCriteria = "[Location_Name]=" & "'" & Me!
> [Location_Name] & "'"
>
> DoCmd.OpenForm stDocName, , , stLinkCriteria
> Thanks,
> RM
>