Triggering a Progress Bar

PC User

Registered User.
Local time
Today, 06:37
Joined
Jul 28, 2002
Messages
193
I have a database audit form module that takes a few seconds to search through a linked table and then insert the information into the main db table. I've seen a lot of newsgroup discussions on progress bars and I have a few examples, but they either use a timer or counting records. I'll probable use the simple progress bar with the growing rectangle, but I need help on how to trigger each increment of growth of the popup progress bar, coordinate it with the main form and then close the popup. The code in the main form that executes the database audit is as follows:

Code:
====================================================
Private Sub Form_BeforeUpdate(Cancel As Integer)

On Error GoTo Proc_Err

Dim frmCurrentForm As Form
Dim strUser As String
Dim strFirstName As String
Dim strLastName As String

Set frmCurrentForm = Screen.ActiveForm
frmCurrentForm![LastModified] = NOW

strUser = User()
strFirstName = DLookup("[First]", "Global Address List", "[Account] ='" & strUser & "'")
strLastName = DLookup("[Last]", "Global Address List", "[Account] ='" & strUser & "'")
Me!EditedBy = strFirstName & " " & strLastName
Me!EditedWhen = NOW()

Exit Sub

Proc_Err:
MsgBox "The following error occured: " & Error$
Resume Next
End Sub
====================================================
Thanks,
PC
 
PC,

There is no "loop" in your code.

Most of your assignments (Except the two DLookUps) are instantaneous.

That gives you only two places to update your progress bar! Not good!

Also, the DLookUps (your whole code for that matter) should execute in
negligible time. Is [Account] indexed? It should be.

Another also, you should look at the Nz function or check for a Null
return for DLookUp. It will return null (and an error in code) if
there is no match.

Code:
strUser = User()
strFirstName = DLookup("[First]", "Global Address List", "[Account] ='" & strUser & "'")
strLastName = DLookup("[Last]", "Global Address List", "[Account] ='" & strUser & "'")
Me!EditedBy = strFirstName & " " & strLastName
Me!EditedWhen = NOW()

Wayne
 

Users who are viewing this thread

Back
Top Bottom