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

program to rename image paths

P: n/a
This is probably quite simple to the VB veterans... here goes, I have a
database of product images with the name and server address hardcoded
into the field value (e.g. \\PC9\imageFiles\8965341.jpg) whereas
\\PC9\imageFiles was the old location of the .jpg 8965341). We have
switched the server names and now all the images need to be renamed
\\F:\imageFiles. Obviously if I had not misstakingly hardcoded the path
I could solve the problem in 2 minutes of coding.... but does anyone
know how to write a query that takes out the \\PC9\part of the name on
each record and replaces it with the \\F:\ path? Later I will delete
the path from the field altogether.
Thanks all for any help!
Brian

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
There's a Replace function you can use

UPDATE MyTable
SET MyField = Replace(MyField, " \\PC9\ ", " \\F:\ ")

(Note that I had to put extra spaces because Outlook Express insisted on
erasing them when it converted to a hyperlink!)

However, your mention of "VB veterans" has me wondering. Are you going to be
running this from within Access, or from outside of Access? The above will
only work if run inside of Access.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

<ca***************@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
This is probably quite simple to the VB veterans... here goes, I have a
database of product images with the name and server address hardcoded
into the field value (e.g. \\PC9\imageFiles\8965341.jpg) whereas
\\PC9\imageFiles was the old location of the .jpg 8965341). We have
switched the server names and now all the images need to be renamed
\\F:\imageFiles. Obviously if I had not misstakingly hardcoded the path
I could solve the problem in 2 minutes of coding.... but does anyone
know how to write a query that takes out the \\PC9\part of the name on
each record and replaces it with the \\F:\ path? Later I will delete
the path from the field altogether.
Thanks all for any help!
Brian

Nov 13 '05 #2

P: n/a
Thanks Douglas! but a couple of problems. I made this just a query
under query design with the following line of SQL:

UPDATE [VFProducts].Picture SET VFProducts.Picture =
Replace(VFProducts.Picture, "\\PC9\Common\","F:\");

But I get an error message saying "Couldn't find
"C:\MyDocuments\VFaccess.mdb"
Any clues? I tried to put the SQL as an event procedure on a form with
a button control and this didn't work either.
Thanks all!
Brian
Douglas J. Steele wrote:
There's a Replace function you can use
UPDATE MyTable
SET MyField = Replace(MyField, " \\PC9\ ", " \\F:\ ")
(Note that I had to put extra spaces because Outlook Express insisted on
erasing them when it converted to a hyperlink!)
However, your mention of "VB veterans" has me wondering. Are you going to be
running this from within Access, or from outside of Access? The above will
only work if run inside of Access.
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!) <ca***************@yahoo.com> wrote in message
This is probably quite simple to the VB veterans... here goes, I have a
database of product images with the name and server address hardcoded
into the field value (e.g. \\PC9\imageFiles\8965341.jpg) whereas
\\PC9\imageFiles was the old location of the .jpg 8965341). We have
switched the server names and now all the images need to be renamed
\\F:\imageFiles. Obviously if I had not misstakingly hardcoded the path
I could solve the problem in 2 minutes of coding.... but does anyone
know how to write a query that takes out the \\PC9\part of the name on
each record and replaces it with the \\F:\ path? Later I will delete
the path from the field altogether.
Thanks all for any help!
Brian


Nov 13 '05 #3

P: n/a
Don't know whether this is what's causing your error, but your UPDATE
statement syntax is incorrect. It should be

UPDATE [VFProducts] SET VFProducts.Picture =
Replace(VFProducts.Picture, "\\PC9\Common\","F:\");
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

<ca***************@yahoo.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Thanks Douglas! but a couple of problems. I made this just a query
under query design with the following line of SQL:

UPDATE [VFProducts].Picture SET VFProducts.Picture =
Replace(VFProducts.Picture, "\\PC9\Common\","F:\");

But I get an error message saying "Couldn't find
"C:\MyDocuments\VFaccess.mdb"
Any clues? I tried to put the SQL as an event procedure on a form with
a button control and this didn't work either.
Thanks all!
Brian
Douglas J. Steele wrote:
There's a Replace function you can use
UPDATE MyTable
SET MyField = Replace(MyField, " \\PC9\ ", " \\F:\ ")
(Note that I had to put extra spaces because Outlook Express insisted on
erasing them when it converted to a hyperlink!)
However, your mention of "VB veterans" has me wondering. Are you going to
be
running this from within Access, or from outside of Access? The above
will
only work if run inside of Access.
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

<ca***************@yahoo.com> wrote in message
> This is probably quite simple to the VB veterans... here goes, I have a
> database of product images with the name and server address hardcoded
> into the field value (e.g. \\PC9\imageFiles\8965341.jpg) whereas
> \\PC9\imageFiles was the old location of the .jpg 8965341). We have
> switched the server names and now all the images need to be renamed
> \\F:\imageFiles. Obviously if I had not misstakingly hardcoded the path
> I could solve the problem in 2 minutes of coding.... but does anyone
> know how to write a query that takes out the \\PC9\part of the name on
> each record and replaces it with the \\F:\ path? Later I will delete
> the path from the field altogether.
> Thanks all for any help!
> Brian

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.