Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50070

Combobox selection unable to cascade values from Access database table

$
0
0
sorry but i need the help badly. i'm trying to cascade values from an access table (db1.mdb) which contains 4 informations. let's call it A, B, C and D. In excel, i made a userform which enables the user to choose from combobox1 then cascade that value to combobox2 and so on and so forth.

for instance:

combobox1 = A, then combobox2 = B... and so on

I saw a few post similar to this but using a table from excel sheet. my data is coming from an access table. i have already initialized the values under A but how to proceed on the selection is my problem.

Set Db = OpenDatabase(DBpath, False, False)
Set rs = Db.OpenRecordset("myTable", dbOpenTable)

With rs
If Not .BOF Then .MoveFirst
While Not .EOF
userFTEST.ComboBox1.AddItem .Fields(0)
.MoveNext
Wend
End With

rs.Close
Set rs = Nothing
Db.Close
Set Db = Nothing

here's the code i'm starting with but could not produce the way i want it..

Private Sub ComboBox1_Change()

x = userFTEST.ComboBox1.ListCount
If x >= 1 Then
For i = 1 To x

If userFTEST.ComboBox1.List(i - 1) = userFTEST.ComboBox1.Value Then
GoTo NextStep:
End If
Next i

MsgBox "There is no MATCH!"
userFTEST.ComboBox1.SetFocus
Application.ScreenUpdating = True
Exit Sub
End If

NextStep:

"i can't seem to put the lines here"


End Sub


Appreciate if someone could help. it's very important as i'm running out of time.



Thank you all!

Viewing all articles
Browse latest Browse all 50070

Trending Articles