I am new to VBA so this is probably elementary, but I am stumped.
I have a form with a listbox. I would like to have a different function happen when you double click on a value in the list box based upon another value in a text box.
So if the value in the text box is "A" it would maybe open a report when double clicked. If the value were "B" it might open another form when double clicked etcetera.
I have been able to get it to do a single thing or nothing (depending on the value in the text box) but am unsure of how to make it perform a second or third option. Must be an Else If or something but no luck so far.
Here is what I do have that works:
Private Sub searchlist_DblClick(Cancel As Integer)
Dim link As String
If Me.Text8 = "A" Then
link = Me.searchlist.Column(1)
Application.FollowHyperlink link
End If
End Sub
Thanks!
I have a form with a listbox. I would like to have a different function happen when you double click on a value in the list box based upon another value in a text box.
So if the value in the text box is "A" it would maybe open a report when double clicked. If the value were "B" it might open another form when double clicked etcetera.
I have been able to get it to do a single thing or nothing (depending on the value in the text box) but am unsure of how to make it perform a second or third option. Must be an Else If or something but no luck so far.
Here is what I do have that works:
Private Sub searchlist_DblClick(Cancel As Integer)
Dim link As String
If Me.Text8 = "A" Then
link = Me.searchlist.Column(1)
Application.FollowHyperlink link
End If
End Sub
Thanks!