-
i have gained access to my database using the below
code but what i want to do is load my query result of all
the interviewers into my combobox named cmbInterviewer
now this is where i get stuck
thankyou for all yor replys
Code:
Dim dyna As Recordset
Dim theerror As Long
SQL = "select interviewername from interviewer"
Set dyna = db.OpenRecordset(SQL, dbOpenDynaset, dbSQLPassThrough + dbSeeChanges)
theerror = Err
On Local Error GoTo 0
cmbInterviewed.Clear
Select Case theerror
Case 3146
'case 3146 means there are no records in the database
Case 0
'this is where i want to put my coding
-
If you are using a datacombo then it would go like this:
Code:
'just set the datasource for the data combo
set cmbInterviewed.Rowsource=dyna
cmbInterviewed.Listfield="Interviewed"
cmbInterviewed.refresh
or if you are using a regular combo then it would go like this:
Code:
MaxRec=dyna.recordcount
for x=1 to MaxRec
'just scroll thru the recordset and add the field info you want to the combo
cmbInterviewed.additem dyna!Interviewed
dyna.movenext
next x
[Edited by Edneeis on 11-02-2000 at 09:41 PM]
-
Or try this:
Code:
While Not Dyna.EOF
cmdInterviewer.AddItem Dyna.Fields("InterviewerName").Value & ""
Dyna.MoveNext
Wend
That should get around the need to check for empty recordset, adn the ' & "" ' at the end of the additem line will stop NULL values beign inserted, which crashes combos
cheers
- gaffa