Hyperlink, Find and Replace (1 Viewer)

kitty77

Registered User.
Local time
Today, 11:08
Joined
May 27, 2019
Messages
712
I'm working with a hyperlink field. I know they can be tricky.
I'm trying to do a find and replace but it changes the format?
In the past, I had to export to excel but wondering if a better way exists.

\\server\testing\custom\12345.pdf
file:///\\server\testing\custom\.pdf (after replace)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:08
Joined
Oct 29, 2018
Messages
21,473
Doesn't look like you're replacing anything but only adding something. Are you talking about using an UPDATE query? If so, can you please post the SQL statement? Thanks.
 

kitty77

Registered User.
Local time
Today, 11:08
Joined
May 27, 2019
Messages
712
Sorry... yes, I was simply replacing "normal" with "custom"

\\server\testing\normal\12345.pdf
file:///\\server\testing\custom\.pdf (after replace)
 

kitty77

Registered User.
Local time
Today, 11:08
Joined
May 27, 2019
Messages
712
this seems to keep the format. In a query. How can I convert that to vba for a command button?

Expr: Replace([Mlink1],"normal","custom")
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:08
Joined
Oct 29, 2018
Messages
21,473
this seems to keep the format. In a query. How can I convert that to vba for a command button?

Expr: Replace([Mlink1],"normal","custom")
You might want to test that first. Is it clickable?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:08
Joined
Feb 19, 2002
Messages
43,275
Are you using the hyperlink data type?
 

kitty77

Registered User.
Local time
Today, 11:08
Joined
May 27, 2019
Messages
712
Something like this...

[Mlink4] = Replace([Mlink1],"normal","custom")
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:08
Joined
Oct 29, 2018
Messages
21,473
this seems to keep the format. In a query. How can I convert that to vba for a command button?

Expr: Replace([Mlink1],"normal","custom")
Have you tried using the same expression in your VBA code? Show us what you have for the button.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:08
Joined
Feb 19, 2002
Messages
43,275
The hyperlink data type holds two pieces of information. The actual link and a nice name. I never use that data type because it cannot be upsized to SQL Server so I can't tell you the syntax for referring to one part vs the other. If all you need to store is the link, change the data type to plain text. Then to open the document, use the FollowHyperlink method in the dbl-click event of the control.
 

kitty77

Registered User.
Local time
Today, 11:08
Joined
May 27, 2019
Messages
712
The hyperlink data type holds two pieces of information. The actual link and a nice name. I never use that data type because it cannot be upsized to SQL Server so I can't tell you the syntax for referring to one part vs the other. If all you need to store is the link, change the data type to plain text. Then to open the document, use the FollowHyperlink method in the dbl-click event of the control.
Got it.
 

Users who are viewing this thread

Top Bottom