Update label and record query steps

S

SEZHOO

Hi,

I have a time consuming import code which has multiple steps. I amend the
label caption to show which step the import is on but would like to show all
steps and if possible place these steps in an archive table as the process is
run by several users.

At the moment I have:

1 - Preparing import......

which is replaced by

2 - Importing cust table 114,240 records (est. dur. 1 min).........

which is replaced by

3 - Importing sales table 842,600 records (est. dur. 4 mins).......

etc etc

What I would like is:

Query steps......

18/02/2010 23:30:30 - Step 1 - Preparing import......
18/02/2010 23:30:35 - Step 2 - Importing cust table 114,240 records (est. dur.
1 min).........
18/02/2010 23:31:51 - Step 3 - Importing sales table 842,600 records (est.
dur. 4 mins).......
18/02/2010 23:36:03 - Step 4 - ...........

Any ideas?

Thanks
 
S

stumac

Hi Sezoo - presumeably this is running on an onclick event of a command
button or something. You could replace your lablel with an unbound text box
and have code that updates this instead of overwriting the label like:

*before step one starts
Me.mytextbox = Now() & ": Step1 - Preparing import"

*After step one is complete
Me.mytextbox= Me.Status_Lab & vbCrLf + vbCrLf & Date & ": Step2 - Importing
cust table 114,240 records (est. dur.1 min)........."

Repeat the above as required

Hth

Stu
 
D

Daryl S

Sezhoo -

Go ahead and build your audit table with an autonumber field (primary key),
a date/time field, a username field (if you can and want to capture it), a
stepnumber field and a description field.

Then in your code, call a form function that will do two things; update the
label (or a text field) on the form, and append a new record to your audit
table. You would call it like this:
AddAuditRec(1,"1 - Preparing import......")

Here is a sample. This is not tested, as much will need changing anyway for
your table/form fields...

Public Sub AddAuditRec(StepNo As Integer, StepDescription As Text)
'Substitute your table, form, and field names for those here.
'This assumes you have the current user name for the audit table.
'If not, exclude the fieldname and value, including the ' delimeters around
the value.

Dim strSQL as String

'First update the form audit field
Me.txtfldorlabel = Me.txtfldorlabel & " Step " & StepNo & " - " &
StepDescription 'Appends to form field

'Insert the audit record into the table
strSQL = "INSERT INTO AuditTbl (DateTimeStamp, UserName, StepNumber,
StepDescription) " & _
" VALUES (" Now() & ",'" & UserName & "'," & StepNo & ",'" &
StepDescription & "')"
RunSQL strSQL

End Sub
 
S

SEZHOO via AccessMonster.com

Hi Stumac / Daryl,

Apologies for the delay in thanking you but was stranded up country.

Will give your ideas a whirl and let you know how I get on.

tks

SH
 

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