How design query to update field values in a table

I have a table with several records that have the following examples in a field named "Image":

B:\Dropbox\Business Documents\Database\Database Images\Tree.jpg
B:\Dropbox\Business Documents\Database\Database Images\Football.jpg
B:\Dropbox\Business Documents\Database\Database Images\Rainbow.jpg
B:\Dropbox\Business Documents\Database\Database Images\Flower.jpg

But I want to create an update query that will chance the text in the field to be a lookup from a table and the last part of the existing field value.

So if the lookup value is...

= DLookup("[ImageDirectory]", "tblDatabaseSetup")

Then I want the new field values to read:

The Looked Up Value\Tree.jpg
The Looked Up Value\Football.jpg
The Looked Up Value\Rainbow.jpg
The Looked Up Value\Flower.jpg

In other words the field should display the looked up value and keep the last part of the existing value for example Tree.jpg

How can I create this update query?
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
start with a select query:

SELECT [Image], DLookup("[ImageDirectory]", "tblDatabaseSetup") & mid([Image], instrrev([Image], "\")) as NewImage
FROM yourTable

If that givew you what you are looking for, then you can modify the query to an update query:

UPDATE yourtable
SET [Image] =  DLookup("[ImageDirectory]", "tblDatabaseSetup") & mid([Image], instrrev([Image], "\"))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bonjour-autCommented:
I recommend to do a Public Function and use it in the SQL for the query

Public Function get_imgpath()
    get_imgpath=DLookup("[ImageDirectory]", "tblDatabaseSetup")
End Function
0
SteveL13Author Commented:
Perfect as always.  Thank you!
0
Dale FyeOwner, Developing Solutions LLCCommented:
You are welcome.  Glad I could help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.