Click to See Complete Forum and Search --> : Progress bar and ADO…


opiate
June 7th, 2001, 10:53 PM
Can someone give me ideals on how to use the progress bar with ADO. I need to figure out how to calculate the time or percentage completed when going from rs.BOF to rs.EOF in a loop.

MSDN has this example using the PercentPosition with the recordset object. This is only for DAO and RDO. Does anyone know of something similar….

MS example:

PercentPosition Property
Sets or returns a value indicating the approximate location of the current record in the Recordset object based on a percentage of the records in the Recordset.

Thanks for any help.

Corey

opiate
June 7th, 2001, 11:17 PM
duh!

prgbar.value = (rs.absoluteposition / rs.recordcount) * 100

This gets the percentage of the position.

antonye
June 8th, 2001, 05:51 AM
Ah, the eternal Progress Bar and Recordset problem!

The problem with using a progress bar is that you need to know how many records are returned so you can set the maximum. Because you're using a Forward Only recordset, you don't know how many records there are.

You should use a ForwardOnly recordset because they are much quicker. If you didn't, you would need to open your recordset, do a .MoveLast (to ensure you find all the records), and the .RecordCount will then have the correct number. BUT, you must then you need to do a .MoveFirst to get back the the start of your recordset - all this will take processing time!

I never bother with Progress Bars unless you know before-hand how many "things" you will be processing.

The users obviously want some feedback to know this is working, so I would go for the animated dialog approach - like when you delete files in Windows. Add some text like "Updating Database ... Please Wait". That way your database updates will be quicker and your program will show that something is happening.

HTH,