Apply changes to existing records

K

Ken G

I have a database that has a text field that contains a default file path to
a picture folder. I've moved the folder and changed the default value of the
text field to point to the new location, but the change only affects new
records. How can I apply the change to the existing records?
 
M

Marco Pagliero

I have a database that has a text field that contains a default file path to
a picture folder. I've moved the folder and changed the default value of the
text field to point to the new location, but the change only affects new
records. How can I apply the change to the existing records?
It seems you store the default path into every picture record? This
would be a mistake. Every record should only have the file name. The
folder path has to exist only once in the database and has to be known
only by the code which retrieves the pictures.
Anyway:
update PicsTable set PicsPath = "NewPicsPath"

If the path and the file name were in the same column this would be
the second mistake. Then you have first to separate the file name from
the path, of course.

Greetings
Marco P
 
D

Daryl S

Ken -

You will need to use an update query to change existing records. Remember
to back up your data before you make any changes. The code would be
something like this (you your names and values):

UPDATE YourTable
SET pathfield = "new path"
WHERE pathfield = "old path";
 
K

Ken G

Yes, you are correct. I have the file path in a text field in every record. I
now see how clumsy this is so I'll have a go at modifying the retrieval code
to include it in there instead. This was my first serious attempt at
creating an access data base, so I'm still at the bottom of the learning
curve.
 

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