Hi! HooKooDooku,
You explained exactly as what I looking for... I'm just in the process of imagination how to use that count(*) to solve the problem... this is the scan_inventory_adjustment
P
Dim strSQL As String
Dim rs As ADODB.Recordset
strSQL = "SELECT docno,thedate,procode,pron
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = cn
rs.CursorLocation = adUseClient
rs.LockType = adLockReadOnly
rs.CursorTyp
rs.Open strSQL
Set rs.ActiveConnection = Nothing
Set scan_Inventory_Adjustment = rs
Set rs = Nothing
End Function





by: HooKooDooKuPosted on 2009-11-03 at 13:11:34ID: 25733705
What you need to do is determine how many records you are about to process, set pb.Max value based on that, set pv.Value = 0, then increment pv.Value by one each time through the Do While Not .EOF loop.
The crux of the problem is then how to determine how many records you are going to have... or expect to have. In case there wind up being more records that you originally thought, you'll need to test that pb.Value isn't about to exceed pb.Max.
If scan_inventory_adjustment has a where clause in it, the quickest way to determine the number of records you are about to process is to do a select count(*) query using the same where clause.