Author |
Topic |
|
cube175
Starting Member
2 Posts |
Posted - 30 July 2001 : 18:01:51
|
I'm having a problem inserting text into a field in an access database.
It's just a simple SQL statement
sSQL="INSERT INTO orgs (OrgName, OrgDescrip, Address1, Address2, City, State, Zip, PhoneNumber, FaxNumber, Email) " &_ "VALUES ('" & fOrgName & "','" & fOrgDescrip & "','" & fOrgAddy1 & "','" & fOrgAddy2 & "','" & fOrgCity & "','" & fOrgState & "','" & fOrgZip & "','" & fOrgPhone & "','" & fOrgFax & "','" & fOrgEMail & "');" HraDB.Execute(sSQL)
The problem i'm having is when there is an apostrophe anywhere in the text, for instance in the description field, the page returns an error. How do I avoid this?
Edited by - cube175 on 30 July 2001 18:05:58 |
|
Deleted
deleted
4116 Posts |
Posted - 30 July 2001 : 18:13:29
|
For those items which can have ' and " inside (i.e. text items) use:
fOrgName = replace (fOrgName,"'","''") fOrgName = replace (fOrgName,"""","""""")
This is usually done after you post the form and confirm the contents.
Think Pink |
|
|
cube175
Starting Member
2 Posts |
Posted - 30 July 2001 : 20:08:53
|
That did the trick, thanks!!!
|
|
|
Deleted
deleted
4116 Posts |
Posted - 31 July 2001 : 15:26:41
|
quote:
That did the trick, thanks!!!
You're welcome
Think Pink |
|
|
|
Topic |
|
|
|