Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace function

Status
Not open for further replies.

zoone

IS-IT--Management
May 31, 2005
4
DK
I want to make a replace function that can take some data from a table and save a part of this in another column. This is supposed to happen as a part of an update query, but I cant make it work.

An input could look like this: /BarkAS/S2/73.1451.30517p.jpg

I'd like the output to contain only the filename: 73.1451.30517p.jpg and then save it in another column as a part of the update query....

Therefore my function looks like this: Replace([picture];"*/";"")

This should result in saving everything after the last "/" and discard everything before this, but it doesn't work.

:(
 

A split function!

a=split("/BarkAS/S2/73.1451.30517p.jpg" , "/")
a(ubound(a))= 73.1451.30517p.jpg

 
UPDATE yourTable
SET yourColumn=Mid([picture], InStrRev([picture],"/")+1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV: If I want to do that in a button, what is needed for it to work here?:

Private Sub Command66_Click()

Update MyTable
Set Picture = Mid([Picture], InStrRev([Picture], "/") + 1)

End Sub
 
Have a look at the DoCmd.RunSQL or CurrentDB.Execute methods.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top