giana
12-19-2003, 11:06 AM
This is quite odd for me. The first part of the code populates a combobox on a form from a table in an access db. It works perfectly.
The second part should do the same thing, but in fact it does not and I get an error back of "Invalid use of Null". Also in debug mode I noticed that passing the mouse on the first .EOF sentence the .EOF = true, while the second .EOF = false (and in the following code line is the null error). Anybody knows how??
Set EventRecSet = db.Execute("SELECT EventName from Events")
Do Until EventRecSet.EOF
strEventName = EventRecSet.Fields("EventName") cmbEvents.AddItem strEventName
Set cmbEvents.DataSource = adoPrimaryRS
EventRecSet.MoveNext
Loop
Dim EmplRecSet As Recordset
Dim strEmplName As String
Set EmplRecSet = db.Execute("SELECT Name FROM Employees")
Do Until EmplRecSet.EOF
strEmplName = EmplRecSet.Fields("Name")
cmbEmployee.AddItem strEmplName
Set cmbEmployee.DataSource = adoPrimaryRS
EmplRecSet.MoveNext
Loop
The second part should do the same thing, but in fact it does not and I get an error back of "Invalid use of Null". Also in debug mode I noticed that passing the mouse on the first .EOF sentence the .EOF = true, while the second .EOF = false (and in the following code line is the null error). Anybody knows how??
Set EventRecSet = db.Execute("SELECT EventName from Events")
Do Until EventRecSet.EOF
strEventName = EventRecSet.Fields("EventName") cmbEvents.AddItem strEventName
Set cmbEvents.DataSource = adoPrimaryRS
EventRecSet.MoveNext
Loop
Dim EmplRecSet As Recordset
Dim strEmplName As String
Set EmplRecSet = db.Execute("SELECT Name FROM Employees")
Do Until EmplRecSet.EOF
strEmplName = EmplRecSet.Fields("Name")
cmbEmployee.AddItem strEmplName
Set cmbEmployee.DataSource = adoPrimaryRS
EmplRecSet.MoveNext
Loop