Question Generating hyperlink from multiple comboboxes

all4jcvette

Registered User.
Local time
Yesterday, 19:55
Joined
Jun 12, 2009
Messages
10
Sorry, this is probably a very basic question, but I'm new to access programming, and I'm stumped. I have two ComboBoxes on a form that I want to generate a hyperlink from, and then when I hit a submit button, it opens the file in the link. I just can't figure out how to finish off the code. Here what I have so far.

Private Sub Command21_Click()
Dim stMachine As String
Dim stShare As String
Dim stLink As String
stMachine = [Forms]![Lookup]![ComboBox1]
stShare = [Forms]![Lookup]![ComboBox2]
stLink = "#\\server\share\folder\" + stMachine + "_" + stShare + ".txt#"
End Sub

Command21 is the button I want to push to open the link that I'm creating, and I want it to pull the values of the comboboxes if they change.

I appreciate your help in advance.
 
Figured it out. So I'll post it incase anyone else needs it.

Private Sub Command21_Click()
Dim ctl As CommandButton

Dim stMachine As String
Dim stShare As String
Dim stLink As String
stMachine = [Forms]![Lookup]![ComboBox1]
stShare = [Forms]![Lookup]![ComboBox2]
stLink = "\\server\share\folder\" + stMachine + "_" + stShare + ".txt"

Set ctl = Me!Command21
With ctl
.HyperlinkAddress = stLink
End With
End Sub
 

Users who are viewing this thread

Back
Top Bottom