0

I am currently working on an Access Database. On the form i have two combo boxes. Depending on the selection in those boxes about 12 list boxes are filled out of a table. It works well this far. But now i have a hyperlink shown in one list box. The problem is that i want to enter the homepage by pressing a button. But it does not work. Only when I click in the list box where the Link is shown, the code for the button being pressed works. Why won't it work in the first way without me clicking in the "Shoplink-List box".

The code I use is shown below. ( I hope you understand my question, i am not a native speaker.Sorry)

Private Sub Kombinationsfeld47_AfterUpdate()   (<---- This is the selection)
Me.Liste_Shoplink.Requery  (<--- the List box with the hyperlink)


Private Sub shoplink_Click()
If [Liste_Shoplink] <> "" Then
        Dim shoplink  As String
        shoplink = [Liste_Shoplink]
       Application.FollowHyperlink (shoplink)
Else
        MsgBox "No Product in shop"
End If 
June7
  • 19,874
  • 8
  • 24
  • 34
ExRain
  • 1
  • Try if this works: https://stackoverflow.com/questions/40462176/how-to-open-a-url-from-ms-access-with-parameters – Andre Aug 31 '21 at 11:09
  • The problem is, that if i use another selection in the Kombinationsfeld47 , i need to click in the Liste_Shoplink again. If I once clicked there, the button click works... So i do not have any problem with the hyperlink itself, but probably with the List box or the VBA regarding the list box :/ – ExRain Aug 31 '21 at 12:12
  • I expect an item of the listbox must be selected for code to have data to work with. Why would you expect it to work if nothing is selected? You can have code select an item in listbox after requery or have code use a hard-coded hyperlink in the `Else`. – June7 Aug 31 '21 at 18:37
  • Thank you for your response, But due to a query it should be filled with the link. It also shows the link, but it does not get triggered by the code. Only when i click it first. How can i select the timen after requery? Is there a special code? thank you in advance – ExRain Sep 01 '21 at 10:14
  • double check that this clause is being met: If [Liste_Shoplink] <> "" Then – Cahaba Data Sep 01 '21 at 23:30

0 Answers0