Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data access object - recordset problem

Status
Not open for further replies.

peekay

Programmer
Oct 11, 1999
324
ZA
Can someone tell me what is wrong with this code :<br>
<br>
frmCashier.lstRegNo.Clear<br>
If Not rstJobs.BOF Then rstJobs.MoveFirst <br>
Do While Not rstJobs.EOF<br>
If rstJobs!paid = False And rstJobs!completed = True Then<br>
If frmCashier.lstRegNo.ListCount = 0 Then<br>
frmCashier.lstRegNo.AddItem rstVeh!regno<br>
Else<br>
For i = 0 To frmCashier.lstRegNo.ListCount - 1<br>
frmCashier.lstRegNo.ListIndex = i<br>
If rstJobs!regno = frmCashier.lstRegNo.Text Then Exit For <br>
frmCashier.lstRegNo.AddItem rstJobs!regno<br>
Next i<br>
End If<br>
End If<br>
rstJobs.MoveNext<br>
Loop<br>
<br>
I get an error 'no current record' at this line<br>
<br>
If rstJobs!regno = frmCashier.lstRegNo.Text Then Exit For <br>

 
Use F8 and Debug.Print to check everything (Variables etc.) very slowly. <br>
Is it looping at all or stopping on the first pass through?<br>
I don't have your records etc to test it<br>
I suspect that the .BOF line is it<br>
try to explicitly set the rstJobs.MoveFirst with out the IF statement.<br>
Because you are going backwards through the loop It could be that you are at the end of the records or at the beginning.<br>
<br>
Hope this Helps<br>
DougP<br>
<br>

 
DougP<br>
Thanks - I found the problem<br>
In line 6 I refer to another recordset(rstVeh) and this upsets the absolute position in the first recordset<br>
<br>
Peekay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top