Reputation: 43
I'm using Microsoft Access, and I'm trying to use the Replace() function.
Basically, I'm trying to change the address in a hyperlink textbox. For example, I'd like to change : Z:\test_folder to C:\Users\Administrator\Desktop\test_folder
This is what I've got (for example):
Private Sub tbHyperlink_Change()
Dim Hyperlink As String
Me.tbHyperlink.Value = Hyperlink
If Left(Me.tbHyperlink.Value, 1) = "Z" Then
Replace(Hyperlink, "Z:\", "C:\Users\Administrator\Desktop") As String
Me.tbHyperlink.Value = Hyperlink
Else
End Sub
However, this is simply not working.
Is there a simpler way to do this? Thank you. -Q
Upvotes: 0
Views: 601
Reputation: 2475
You've got a whole bunch of errors there, what about this?
Private Sub tbHyperlink_Change()
Dim Hyperlink As String
Hyperlink = Me.tbHyperlink.Value
If Left(Hyperlink, 1) = "Z" Then
Hyperlink = Replace(Hyperlink, "Z:\", "C:\Users\Administrator\Desktop")
Me.tbHyperlink.Value = Hyperlink
End If
End Sub
Upvotes: 1