i am trying to use vba to populate a combo box based off of the selections of two other comboboxes in my vba userform. the code i have so far is:
equalscombobox. Value = ""
For indexvalue = 1 To 100
sql = "SELECT " & sqlattribute & " FROM " & sqltable & ";"
Debug.Print sql
Set datadb = CurrentDb
Set rs = datadb.OpenReco rdset(sql, dbOpenDynaset)
equalscombobox. SetFocus
If equalscombobox. ItemData(indexv alue) Then
equalscombobox. Value = sql
Else: equalscombobox. Value = equalscombobox. Value + sql
End If
so the equals combo box should be populated from the sqlattribute and sqltable combo box selections. i am running into an error at the set datadb = currentdb, and am not sure if the for loop will run correctly once i fix the first problem. thanks in advance!
equalscombobox. Value = ""
For indexvalue = 1 To 100
sql = "SELECT " & sqlattribute & " FROM " & sqltable & ";"
Debug.Print sql
Set datadb = CurrentDb
Set rs = datadb.OpenReco rdset(sql, dbOpenDynaset)
equalscombobox. SetFocus
If equalscombobox. ItemData(indexv alue) Then
equalscombobox. Value = sql
Else: equalscombobox. Value = equalscombobox. Value + sql
End If
so the equals combo box should be populated from the sqlattribute and sqltable combo box selections. i am running into an error at the set datadb = currentdb, and am not sure if the for loop will run correctly once i fix the first problem. thanks in advance!
Comment