Excel - Vba - combobox - SQL

T

tinybears

Hey,

Does anybody know how you can access an Access database through an item
selected in your combobox? I use Tickersymbool as the item in my
combobox. At the moment I have to type the symbol manually, but the
objective is that I can select it. So the A in the code below has to be
changed into the symbol selected in my combobox.

Some code:


'Get data

Set Ticker = DB.OpenRecordset("SELECT Ticker FROM 2002 Where Ticker=
'A' ", dbOpenSnapshot)


Private Sub UserForm_Initialize()
Dim r As String
r = 1
CmbTickerlijst.Clear
Do
CmbTickerlijst.AddItem _
Sheets("Toevoegen").Cells(r, 1).Value
r = r + 1
Loop Until Sheets("Toevoegen").Cells(r, 1).Value = ""
CmbTickerlijst.ListIndex = 0


End Sub



Thx
 
Top