Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Progress bar Help

Status
Not open for further replies.

bbrendan

IS-IT--Management
Dec 13, 2001
109
GB
hi,

Im been searching through loads of posts to see how I can do this, but Ive nearly cracked it..

I want to have a progress bar based on the current recordset. (See code)
But everytime I run it I get the following error:
run-time error 380
Invalid Property value.

Now i think this has something to do with the min/max on the progress bar but I cant figure it.

Any help would be appreciated


Dim strConnection As String
Dim Con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String

strConnection = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=d:\sbt\data;"

strSQL = "Select ProdDescID, Brand, Class, ShortText, last_upd, ProdDescr " & _
"From PrDesc01 where brand ='" & cboBrand & "'"

Set Con = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset

Con.ConnectionString = strConnection
Con.Open

rs.Open strSQL, Con, adOpenKeyset, adLockOptimistic

ProgressBar1.Min = 0
ProgressBar1.Max = rs1.RecordCount

Do While Not rs.EOF
ProgressBar1.Value = ProgressBar1.Value + 1
Loop

end sub

thanks
 
Your recordcount may be returning -1. You may have to change your recordset cursor type to adOpenStatic. Not all the cursor types will return a recordcount.

Try opening your recordset like this,

Code:
rs.Open strSQL, Con, adOpenStatic, adLockOptimistic


Take Care,

zemp

"If the grass looks greener... it's probably because there is more manure."
 
Try:
[tt]
Do While Not rs.EOF
If ProgressBar1.Value < ProgressBar1.Max Then
ProgressBar1.Value = ProgressBar1.Value + 1
End If
Loop
[/tt]

-B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top