Find and Replace (1 Viewer)

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
I have a hyperlink field that has some errors. I would like to clean it up.
I created another field (text) and copied all the data into that field. I'm trying to do a find and replace but it does not find the #

#file:///A:\TEST\Options\42044.pdf# I want to fix it to A:\TEST\Options\42044.pdf

I'm guessing it has something to do with the #.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:35
Joined
May 7, 2009
Messages
19,230
you can use Update Query to replace it:

Update customers Set [pdf link] = Replace$(Replace$([pdf link], "#", ""), "file:///", "")
 

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
Can you send me an example? Not sure how to set it up.
Thanks!
 

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
But why does it show up in the table with the file:///?
 

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
you can use Update Query to replace it:

Update customers Set [pdf link] = Replace$(Replace$([pdf link], "#", ""), "file:///", "")
I created a query but it gives me an error? Replace$
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 19:35
Joined
Jan 23, 2006
Messages
15,378
What error? Try Replace (without the $)
Please tell us more about the hyperlink. Where does it reside? What is the major issue?...
 

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
It resides in a table. The issue is that it looks a little strange as a hyperlink, file:///A:...
 

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
I have some that look one way and some other ways... But both hyperlinks (views) works.
When you click edit hyperlink, both views show it without the file:///

1643555995143.png
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 19:35
Joined
Jan 23, 2006
Messages
15,378
When you click on the hyperlink, does it display the pdf?
 

Attachments

  • 1643557245236.png
    1643557245236.png
    1 MB · Views: 258

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
Yes either way. Just like it to look and be uniformed. Access seems to like the file:/// way.
Just looks cleaner the other way.
 

isladogs

MVP / VIP
Local time
Today, 00:35
Joined
Jan 14, 2017
Messages
18,212
Consider just using a text field to store the file paths. It avoids the issues that people often have with hyperlink fields.
 

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
Yes but then they can't click it as a hyperlink?
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:35
Joined
Feb 19, 2002
Messages
43,257
You can add code to the double click event that uses the FollowHyperlink method to accomplish that. I would not use the click event because that interferes with maintenance. If the links come from some other place so the user never has to update them in the form, then the click event will be fine. You can set the format of the control so that it looks like a hyperlink.
 

kitty77

Registered User.
Local time
Yesterday, 19:35
Joined
May 27, 2019
Messages
712
I'm using the hyperlink as an export to html, outside of access.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:35
Joined
Feb 19, 2002
Messages
43,257
The FollowHyperlink method works for any file type that is registered with Windows. It will open web pages, email programs, word, excel, powerpoint, jpg, .pdf, etc.
 

isladogs

MVP / VIP
Local time
Today, 00:35
Joined
Jan 14, 2017
Messages
18,212
Code:
Application.FollowHyperlink "https://isladogs.co.uk"

Application.FollowHyperlink "c:\MyFiles\readme.txt"
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:35
Joined
Feb 19, 2002
Messages
43,257
If no one needs to edit the hyperlink on the form, you can use the click event rather than the double-click event to activate the hyperlink.
 

Users who are viewing this thread

Top Bottom