Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup problem with '

Status
Not open for further replies.

dominicg123

Technical User
Jan 5, 2007
23
CA
This code is used to update a text box with the value from the column 1 of a list box. Everything worked until when in the name of the field I have the ' character. Then I get a syntax error! I must have a typo somewhere...

for example this will work:
G:\Public\Dossiers\BRUN16\R.Brunet Annexe A.pdf

this will not:
G:\Public\Dossiers\BRUN16\R.Brunet Confirmation d'emploi.pdf


Dim lst As String
lst = Me.lstFileList.Column(1)

Me.Description = Nz(DLookup("[Contact Documents]![Description]", "Contact Documents", "[Linked Doc] = " & "'" & lst & "'"), "")
 
Me.Description = Nz(DLookup("Description", "[Contact Documents]", "[Linked Doc]=[tt]'"[/tt] & Replace(lst, [tt]"'", "''") & "'"[/tt]), "")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top