Names wich contain apostrophe !

elkhazak

Registered User.
Local time
Today, 23:17
Joined
Dec 1, 2015
Messages
36
Hello everyone !
I'll try to explain my english enough !
So i have this table who contains those fields : Name | Code | Number
i created a button "import" to import Excel files to the table and all is good !
The problem is i have some queries or functions i use in vba to manipulate Names and those names sometimes contain apostrphe ! so in vba it will be a comment ! How to keep the apostrophes !!
 
Code:
strName = "jack O'lanterns"

This code will perfectly work. In most cases that apostrophe will not break vba code.
 
Code:
strName = "jack O'lanterns"

This code will perfectly work. In most cases that apostrophe will not break vba code.

DoCmd.OpenReport "RapportAenvoyer", acViewReport, , "[Nom du Technicien]='" & TechSélectionné & "'" !! It will work here ?
 
you need to replace the singe quote with two single quotes try

strName = replace("jack O'lanterns","'","'')
 
DoCmd.OpenReport "RapportAenvoyer", acViewReport, , "[Nom du Technicien]='" & replace(TechSélectionné,"'","'') & "'" !! It will work here ?
 
I didn't know you would use it in a query :)
 

Users who are viewing this thread

Back
Top Bottom