How do I do a replace for a number of records?

  • Thread starter Thread starter Nam22
  • Start date Start date
N

Nam22

I am importing a file which will contain about 20 records (20 fields per row)
into an access database table.
I want to be able to automate doing a REPLACE across all the records I
have imported.
(because. in order to make the import work, in the Excel csv file I replaced
all commas with the word 'comma'. I now want to replace the word 'comma' with
actual ',').
Do I make sense?

any help very gratefully received.
thanks
Nicola
Access 2007
 
Continue this SQL string for all 20 fields using your table and field names.
UPDATE 1st_Table SET [1st_Table].Field1 = Replace([Field1],"comma",","),
[1st_Table].Field2 = Replace([Field2],"comma",","), [1st_Table].Field3 =
Replace([Field3],"comma",",");
 
I am importing a file which will contain about 20 records (20 fields per row)
into an access database table.
I want to be able to automate doing a REPLACE across all the records I
have imported.
(because. in order to make the import work, in the Excel csv file I replaced
all commas with the word 'comma'. I now want to replace the word 'comma' with
actual ',').
Do I make sense?

any help very gratefully received.
thanks
Nicola
Access 2007

Back up your data first.
Did you have a space before and after the word comma?
Do you wish just a space after the ,?

Update YourTable Set YourTable.FieldName= Replace([FieldName]," comma
",", ")
 
Nicola

Seems a bit circuitous.

Couldn't you just save the Excel as a tab-delimited .txt file, then import
that?

When I tried it just now, the commas (",") in my original Excel spreadsheet
came through fine into Access.

And when I tried linking to the original Excel spreadsheet from within
Access, the commas came through without incident.

Why do you believe you need to:
1) import Excel data rather than link to it, and
2) modify the contents before and after retrieving it in Access?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top