PDA

Click to See Complete Forum and Search --> : rst.EOF


artsapimp
Nov 26th, 2000, 05:36 PM
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.

kleagle
Nov 27th, 2000, 06:22 AM
Why don't you MoveLast and do something prior or after you had finished with your other records?

Regards.

KT

mobo10
Nov 27th, 2000, 07:23 AM
You are geaded in the right direction... try:

If rst.eof=true then
...
End If

vbdeveloper
Nov 27th, 2000, 08:55 AM
Navigate through the recordsets using:



while not rs.eof
....
....
do something
....

wend

To work upon the last record only use

rs.MoveLast

Happy Programming!

artsapimp
Nov 27th, 2000, 09:17 AM
Thank you. I will try those suggestions.

Gaffer
Nov 27th, 2000, 09:23 AM
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)...

artsapimp
Nov 27th, 2000, 10:01 AM
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.