In this simple code, I update the Caption of a Label Box (Me.WaitLbl.Caption) then Repaint (Me.Repaint) the From to see the updated caption to reflect which record is being updated to show the progress of the operation. I do not know if it is slowing things down by doing this. Does this method add overhead? Is there a better way to do this? Watching it progess though records is a nice visual feedback. However, it does seem to update very slowly.
'Next open each Invoice marked as PAY and copy in data to actual Invoice
Me.WaitLbl.Caption = "Updating Invoice Order Entry with CS#"
Me.Repaint
Dim db4 As Database
Dim rs4 As Recordset
Set db4 = DBEngine.Workspaces(0).Dat
abases(0) ' Create database reference.
Dim strSQL4 As String
strSQL4 = "SELECT CommissionsFinalTable.*" & vbCrLf
strSQL4 = strSQL4 & " FROM CommissionsFinalTable" & vbCrLf
strSQL4 = strSQL4 & " WHERE (((CommissionsFinalTable.P
ayYN)=-1))
;"
Set rs4 = db4.OpenRecordset(strSQL4)
rs4.MoveFirst
Do Until rs4.EOF = True
Dim db5 As Database
Dim rs5 As Recordset
Set db5 = DBEngine.Workspaces(0).Dat
abases(0) ' Create database reference.
Dim strSQL5 As String
strSQL5 = "SELECT InvoiceOrderEntry.*" & vbCrLf
strSQL5 = strSQL5 & " FROM InvoiceOrderEntry" & vbCrLf
strSQL5 = strSQL5 & " WHERE (((InvoiceOrderEntry.Invoi
ceID)=" & rs4![InvoiceID] & ") " & vbCrLf
strSQL5 = strSQL5 & " AND ((InvoiceOrderEntry.Primar
yReferralI
D)='" & rs4![PrimaryReferralID] & "'));"
Set rs5 = db5.OpenRecordset(strSQL5)
If Not IsNull(rs4![PrimaryReferra
lID]) Then
Me.WaitLbl.Caption = "Updating Invoice " & rs5![InvoiceNumber] & " with Primary CS# " & rs4![CommissionStatementNu
mberPrimar
y]
Me.Repaint
With rs5
.Edit
![CommissionStatementNumbe
rPrimary] = rs4![CommissionStatementNu
mberPrimar
y]
![PrimaryCommissionAmountM
CC] = rs4![CommissionPayable]
![PayCommissionsPrimaryYN]
= True
![MCCCurrency] = MCC()
![ExchangeMSCtoMCC] = Format(ExchangeCurrency(MS
C(), MCC()), "0.0000")
.Update
End With
End If
rs5.Close
Set rs5 = Nothing
Set db5 = Nothing
rs4.MoveNext
Loop
rs4.Close
Set rs4 = Nothing
Set db4 = Nothing
Start Free Trial