By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

Putting quotes around strings

P: 2
Hi all

I am looking to drop data into a table for export to a csv file for example see below.

DoCmd.RunSQL "SELECT Temp11.RowNum As RowNum, " &_
"Replace(Temp11.studEnrolment1,',','') AS studEnrolment1 " &_
" INTO Tempory FROM Temp11"

I am wanting to put "" marks around the string data to meet a requirment in the csv file i have played around with chr(34) and a few other ideas with no luck. can anybody either help me to put quotes around the field data in this step or perhaps there is a way in the final export to csv to put all the fields in quotes

ie set the delimiter to {","} rather then simply ,

DoCmd.TransferText acExportDelim, , "Tempory", strDBPath, True
Aug 14 '07 #1
Share this Question
Share on Google+
2 Replies


P: 32
Hello,
What is the error that you are getting? If you are just trying to put quotes around the string fields then this might work. I have replaced your table name ith employeeinfo.

SELECT '"'+[employeeinfo].[firstname]+'"' AS studEnrolment1 INTO Tempory
FROM employeeinfo;


Nanda

Hi all

I am looking to drop data into a table for export to a csv file for example see below.

DoCmd.RunSQL "SELECT Temp11.RowNum As RowNum, " &_
"Replace(Temp11.studEnrolment1,',','') AS studEnrolment1 " &_
" INTO Tempory FROM Temp11"

I am wanting to put "" marks around the string data to meet a requirment in the csv file i have played around with chr(34) and a few other ideas with no luck. can anybody either help me to put quotes around the field data in this step or perhaps there is a way in the final export to csv to put all the fields in quotes

ie set the delimiter to {","} rather then simply ,

DoCmd.TransferText acExportDelim, , "Tempory", strDBPath, True
Aug 14 '07 #2

P: 2
Thankyou for your reply Nanda.

Unfortunaly this and many variations of the same idea are creating a table with the field name as field data repeated for every entry. i.e



[employeeinfo].[firstname] jones 001
[employeeinfo].[firstname] smith 002
[employeeinfo].[firstname] black 003
[employeeinfo].[firstname] smith 004

I think this is because the docmd is interpreting the sql string that is comming out and this says use what is between the quotes as a string. I realy think if anybody can tell me the easiest way to handle it would be if the deliminator can be set in an export function at all.

once again thankyou.
Aug 15 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.