Import Error

jwcclarke

Registered User.
Local time
Today, 20:00
Joined
Mar 21, 2013
Messages
11
Hey

Was hoping someone here can help me with a small problem I'm having with a piece of coding,

Background: the database user is able to search for customer details and pull them up for review, then are able to click two buttons so they can produce a customer Survey and a covering letter.

when they press the first button is the Survey is created, which includes populating information into a second table to fill in the results when they get returned using this code

DoCmd.RunSQL "INSERT INTO CSS (Name1, Name_email, Scheme, Creator1, IssueDate) VALUES ( '" & [Forms]![cusdetails].[Name1] & "' , '" & [Forms]![cusdetails].[e-mail] & "' ,'" & [Forms]![cusdetails].[Scheme] & "' ,'" & fOSUserName() & "',#" & [Forms]![cusdetails].[Text48] & "#)"



The problem I am having is I am getting an error at "name1" & "[Forms]![cusdetails].[Name1]" when the name is an O' eg O'Brian, O'Neil etc, which being from Ireland is a little bit of a problem

if anyone knows of a way to make the system ignore the ' in a person name or a different bit of coding that would do the same?

Thanks
Jay
 
Easiest is to change
'" & [Forms]![cusdetails].[Name1] & "'
to
""" & [Forms]![cusdetails].[Name1] & """

to get around the problem, you still have the same problem when a " is inside the name but that is much much more rare than the '
 
Thanks Namliam, worked perfectly!
 

Users who are viewing this thread

Back
Top Bottom