Use of the " ' " sign

sven2

Registered User.
Local time
Today, 02:58
Joined
Apr 28, 2007
Messages
297
Hello,

when I save some information in my database with a string like this:

strSQL = " UPDATE Personeelsfuncties SET Status = '" & [Forms]![FrmPersoneel]![cboStatus] & "', "
strSQL = strSQL & " Hoofdfunctie = " & [Forms]![FrmPersoneel]![chkHoofd_functie] & " "
strSQL = strSQL & " WHERE (Personeelsnummer = " & Me.txtPersoneelsnummer & ") "

iIt goes wrong when I use the " ' " sign.

The reason for this is that access stops the string at this sign.
How can I solve this problem so that I can use the " ' " sign in textfields?

Thanks in advance,
Sven.
 
What I mean is that when I execute the SQL and the field status = "EHBO" everything works, but when status = "EHBO'ers" it goes wrong.
 
What I mean is that when I execute the SQL and the field status = "EHBO" everything works, but when status = "EHBO'ers" it goes wrong.

Then you might use "EHBO*" in your field status.
 
there are ways around this using double quotes or the CHR() function.
 
Hello,

when I save some information in my database with a string like this:

strSQL = " UPDATE Personeelsfuncties SET Status = '" & [Forms]![FrmPersoneel]![cboStatus] & "', "
strSQL = strSQL & " Hoofdfunctie = " & [Forms]![FrmPersoneel]![chkHoofd_functie] & " "
strSQL = strSQL & " WHERE (Personeelsnummer = " & Me.txtPersoneelsnummer & ") "

iIt goes wrong when I use the " ' " sign.

The reason for this is that access stops the string at this sign.
How can I solve this problem so that I can use the " ' " sign in textfields?

Thanks in advance,
Sven.


Where does it go wrong? I am sure that you are aware that the " ' " denotes the start or end of a Text String. In your example above, the strSQL should work if:
  • Status is a Text Field, and [Forms]![FrmPersoneel]![cboStatus] contains a Text Value.
  • Hoofdfunctie is a Numeric Field, and [Forms]![FrmPersoneel]![chkHoofd_functie] contains a Numeric Value.
  • Personeelsnummer is a Numeric field and Me.txtPersoneelsnummer contains a Numeric Value.
Are all of these true? If not, then the query will need to be adjusted to account for any differences.
 

Users who are viewing this thread

Back
Top Bottom