How would I make an if statement for if it's the last record in the recordset to do something?
Thanks.
I tried (if rst.EOF) but that didn't work.
Printable View
How would I make an if statement for if it's the last record in the recordset to do something?
Thanks.
I tried (if rst.EOF) but that didn't work.
Why don't you MoveLast and do something prior or after you had finished with your other records?
Regards.
KT
You are geaded in the right direction... try:
If rst.eof=true then
...
End If
Navigate through the recordsets using:
while not rs.eof
....
....
do something
....
wend
To work upon the last record only use
rs.MoveLast
Happy Programming!
Thank you. I will try those suggestions.
I believe that if you Movelast, then use a For...Next loop based on the recordcount, you'll get better performance (specially if you have a lot of records in the recordset)...
What I'm building is a shopping cart. Each product is being pulled from a database and after writing each table I do an rst.MoveNext. The only problem is while pulling it from a database using the relationships I have setup it needs to do something different on the last one. The records will probably be less than 20 or 30 (at most) so rst.EOF = True should work I think.
If anyone has any suggestions please let me know.