Avatar of tomerps1
tomerps1 asked on

Inserting ' into table from vb to access. (Urgent)

Hi,
i am trying to insert a ' from a visual basci query into a table in access but getting systax error becase while building query v use ' as text container like in follwoing line.
plz help me out.


insert into tblStudent values( 1, 'Sachin's wife'); //error

insert into tblStudent values( 1, 'Sachin s wife'); //no error



is there any way to solve this problem easy & reliable.
plz help with some gud example of quotation
must be simple if u  have more than one solutions plz welcome
thankx
Programming

Avatar of undefined
Last Comment
tomerps1

8/22/2022 - Mon
venkateshwarr

insert into tblStudent values( 1, 'Sachin''s wife');
ASKER CERTIFIED SOLUTION
nilesh_parmar

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
nilesh_parmar

its doing same as venkateshwarr wrote, anyway ..
crazycomputers

Unless I'm mistaken, that should be:

insert into tblStudent values( 1, 'Sachin\'s wife');
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
nilesh_parmar

sorry ,
it should be
 insert into tblStudent values(1,'fixit(Sachin's wife)');
Mayank S

>> insert into tblStudent values(1,'fixit(Sachin's wife)');

Guess it'll definitely not work. You're not calling the fixit () function. You're putting it as a constant 'fixit(...). Might give an error after Sachin'....

Perhaps what you can try is either what crazycomputers sugessted or if that doesn't work, use another dummy character instead of ' and while reading from the database, check if its that character and display ' in its place.
nilesh_parmar

i meant

insert into tblStudent values(1,'" & fixit(Sachin's wife) & "');
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
crazycomputers

The \ is standard for escaping special characters in SQL expressions, but we all know how M$ violates standards.  '' might work, but I'd put my money on \'
ASKER
tomerps1

Thankx Nitesh Parmar