Show Progress bar to Append Records to a table

G

Guest

I've designed a form to display a progress bar for a process of creating a table.
I can increment the bar for creating the table, adding indicies.
How can i increment another bar to show the records being added by a append query?
I've tried to figure out the maximum count of records for the query using DCOUNT
but even then i'm not sure how to increment the bar as the query runs.

Should I run the recreate the append query within Visual Basic ?
Any help would be appreciated.

Mark
 
N

Newbie

The way I do this, and there could be a better way as I am new to this as
well, is:

Create a recordset of the records that you want to append to the table.
Create another recordset of the table that you wish to add the records to.
set the progressbar.max property to the number of records in the set
set up a counter and for every record that gets added to the table increment
this by 1 and set the progressbar.value property to the value of the
counter.

air code . . .


Forms!form1.ProgressBar1.Value = 0
Set rs = currentdb.openrecordset("AppendQryinSelectForm")
lcount = rs.recordcount
Forms!Form1.ProgressBar1.Max = lcount

Set rsData = CurrentDb.OpenRecordset("SELECT * FROM yourtable")


Do Until rs.EOF
rsData.AddNew
lfields = rs.Fields.Count - 1
For lindex = 0 To lfields
rsData.Fields(lindex) = rs.Fields(lindex)
Next
rsData.Update
rs.MoveNext
countrec = countrec + 1

Forms!Form1.ProgressBar1.Value = countrec

Loop

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top