Deltaflyer
Programmer
I am using the following code to fill out a combo box with items from an access database, but each time i try to execute it i am coming up with "TYPE MISMATCH Error 13" on the Set rs=db.OpenRecordset line, can anybody help me please.
Dim ws As Workspaces
Dim db As Database
Dim rs As Recordset
Set db = Workspaces(0).OpenDatabase(databasepath)
sField = "Field"
sTable = "Table"
ssql = "SELECT DISTINCT " & sField & " FROM " & sTable & " ORDER BY " & sField
MsgBox (ssql)
Set rs = db.OpenRecordset(ssql, dbOpenSnapshot)
Do Until rs.EOF
Combo1.AddItem rs(sField)
rs.MoveNext
Loop
rs.Close
Set db = Nothing
Thanks, DeltaFlyer
The Only Programmer To Crash With Style. LOL
Dim ws As Workspaces
Dim db As Database
Dim rs As Recordset
Set db = Workspaces(0).OpenDatabase(databasepath)
sField = "Field"
sTable = "Table"
ssql = "SELECT DISTINCT " & sField & " FROM " & sTable & " ORDER BY " & sField
MsgBox (ssql)
Set rs = db.OpenRecordset(ssql, dbOpenSnapshot)
Do Until rs.EOF
Combo1.AddItem rs(sField)
rs.MoveNext
Loop
rs.Close
Set db = Nothing
Thanks, DeltaFlyer
The Only Programmer To Crash With Style. LOL