Globally change part of a field

J

JWCrosby

I have a text field that holds the file location of a picture. The content
looks like this:

H:\Access Data\Personnel Pictures\picturefile.bmp

The "picturefile.bmp" is different for every record. Everything preceding
it is identical in all records.

I've moved the folder with all the pictures to a new location and need to
update this field to the following:

S:\Everyone\Member Database\Personnel Pictures\picturefile.bmp

So basically, I need to swap out "H:\Access Data" for "S:\Everyone\Member
Database" in every record.

How so?

Thanks in advance.

Jerry
 
K

KARL DEWEY

Use the Replace function in an update query.
Replace([YourField], "H:\Access Data", "S:\Everyone\Member Database")
 
J

John W. Vinson

I have a text field that holds the file location of a picture. The content
looks like this:

H:\Access Data\Personnel Pictures\picturefile.bmp

The "picturefile.bmp" is different for every record. Everything preceding
it is identical in all records.

I've moved the folder with all the pictures to a new location and need to
update this field to the following:

S:\Everyone\Member Database\Personnel Pictures\picturefile.bmp

So basically, I need to swap out "H:\Access Data" for "S:\Everyone\Member
Database" in every record.

How so?

Thanks in advance.

Jerry

Update the field to

Replace([fieldname], "H:\Access Data", "S:\Everyone\Member Database")

This is a good example of why it's usually preferable to store the filename
and the path in different fields - they may indeed change independently of one
another.


John W. Vinson [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

Top