Update Network Path for Pics

D

doodle

greetings. access 97, sql 2005

One section of my database allows users to browse for a picture, then
it stores the network path. the problem is that they are using their
server mapping to browse, which stores the path as:

U:\Spindle\Spindle_DataBase\Pictures\Linked Pictures
\Marvin_030705_1.JPG

instead of:

\\Servicerv1\Optimum\Spindle\Spindle_DataBase\Pictures\Linked Pictures
\Marvin_030705_1.JPG

this is causing issues with users that do not have the server mapped
to U:

i need to write an update query to change the paths. i suppose i will
need to run it daily going forward. i am writing it in visual studio.
i know how to write it to update the entire field, but how can i write
it to just replace a partial of the field? For instance, I want to
replace U:\ with \\Servicerv1\Optimum\

This is what I have to start off with, but of course it is not going
to find anything, I just wrote it so you could see the syntax:


UPDATE tblTD_Pics
SET ImagePath_1 = '\\Servicesrv1\Optimum\'
WHERE ImagePath_1 = 'U:\'

-doodle
 
S

storrboy

greetings. access 97, sql 2005

One section of my database allows users to browse for a picture, then
it stores the network path. the problem is that they are using their
server mapping to browse, which stores the path as:

U:\Spindle\Spindle_DataBase\Pictures\Linked Pictures
\Marvin_030705_1.JPG

instead of:

\\Servicerv1\Optimum\Spindle\Spindle_DataBase\Pictures\Linked Pictures
\Marvin_030705_1.JPG

this is causing issues with users that do not have the server mapped
to U:

i need to write an update query to change the paths. i suppose i will
need to run it daily going forward. i am writing it in visual studio.
i know how to write it to update the entire field, but how can i write
it to just replace a partial of the field? For instance, I want to
replace U:\ with \\Servicerv1\Optimum\

This is what I have to start off with, but of course it is not going
to find anything, I just wrote it so you could see the syntax:

UPDATE tblTD_Pics
SET ImagePath_1 = '\\Servicesrv1\Optimum\'
WHERE ImagePath_1 = 'U:\'

-doodle

Check on the useages of the Left, Right and Mid functions. I would
apply the replace function you are doing at the point that the user
selects the file (I assume you are using a FileOpenSave dialog that
returns a file path). Before updating the tables with the chosen path,
do the replacement. This would prevent having to do it daily with a
query.
 
D

doodle

I tried this, it said incorrect syntax:

REPLACE ((LEFT(ImagePath_1, 2)), 'U:', '\\Servicesrv1\Optimum\')

ideas?

-doodle
 
S

storrboy

I tried this, it said incorrect syntax:

REPLACE ((LEFT(ImagePath_1, 2)), 'U:', '\\Servicesrv1\Optimum\')

ideas?

-doodle


I can't recall the Replace syntax and I don't have a new enough
version nearby to check.
I'll look a little later.
 
S

storrboy

I can't recall the Replace syntax and I don't have a new enough
version nearby to check.
I'll look a little later.


If using the Replace function I think it should be as follows

Dim strRet As String 'Or whatever variable you want
strRet = Replace(ImagePath_1, "U:\", "\\Servicesrv1\Optimum\", 1, 1,
vbTextCompare)

Using the Left function is not requried when using the Replace
function.
 

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