cgeier 187 Junior Poster

VBA is not VB .NET.

Visual Basic for Applications

cgeier 187 Junior Poster
cgeier 187 Junior Poster

You only seem to be retrieving no rows or 1 row, so it seems unnecessary. You could use a status label, instead to keep the user informed what is going on.

In order to use a progress bar above, you will need to first get the number of rows:

Select Count(*) from Borrower where user_name='" & EmsTextBox1.Text & "' AND userpass = '" & EmsTextBox2.Text & "'"

This query most likely only returns 0 or 1 rows.

Then run the query (above) to retrieve your data.

This would be more useful if you are retrieving many rows such as:

Select * from Borrower

So, you would first get the row count using:

    Select Count(*) from Borrower

Then, get your data:

    Select * from Borrower

Use a counter in your loop to keep track of the current row number. You know the total number of rows from the first query.

You would probably have to use a BackgroundWorker to accomplish this.

How to: Use a Background Worker

101 Samples for Visual Basic 2005
(In "Base Class Libraries - Group 2 Samples", see "WorkingWithThreads")