|
-
Jan 6th, 2003, 11:48 AM
#1
Thread Starter
Lively Member
Program Freeze :-(
Hello All,
When I use the following code my program freezes and I end up having to terminate vb, any ideas?
VB Code:
Private Sub Form_Load()
dcCars.Refresh
'adds cars to list box
While Not dcCars.Recordset.EOF
'Only displays cars which aren't on hire
If dcCars.Recordset("OnHire") = "No" Then
lstCars.AddItem (dcCars.Recordset("Reg"))
dcCars.Recordset.MoveNext
End If
Wend
End Sub
Thanks!
-
Jan 6th, 2003, 11:51 AM
#2
Fanatic Member
Move the MOVENEXT to outside the if block...
Code:
Private Sub Form_Load()
dcCars.Refresh
'adds cars to list box
While Not dcCars.Recordset.EOF
'Only displays cars which aren't on hire
If dcCars.Recordset("OnHire") = "No" Then
lstCars.AddItem (dcCars.Recordset("Reg"))
End If
dcCars.Recordset.MoveNext
Wend
End Sub
Leather Face is comin...
MCSD
-
Jan 6th, 2003, 11:51 AM
#3
move dcCars.Recordset.MoveNext to after the End If
-
Jan 6th, 2003, 11:54 AM
#4
Thread Starter
Lively Member
Thanks alot, I would normally have seen that, I guess you start to miss things after 8 hours or programming :-)
Thanks again!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|