VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Aprostrophe

Gaetan Savoie  (1 Submission)   Databases/Data Access/DAO/ADO   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

Have you ever try so send a string variable to MS Access that have
apostrophes using a SQL Statement? If YES you will get a run time ERROR
Here is your solution....A function that formats the
variable before sending it to the database.

Inputs
sFieldString

Assumes
This code should be used in your Classes. For example : let say myVar=" Gaetan's" the follwing statement will give you errors: SSQL="INSERT INTO tablename (FirstName) VALUES (" & chr(39) & myvar & chr(39) & ")" To fix it do the following: myVar=apostrophe(myvar) SSQL="INSERT INTO tablename (FirstName) VALUES (" & chr(39) & myvar & chr(39) & ")"

Returns
Aphostrophe

API Declarations
None

Rate Aprostrophe (5(5 Vote))
Aprostrophe.bas

Aprostrophe Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters