Hello all,
I have a command button that runs 2 queries - an update query, and an append query. I'd like a message box to pop up when its done saying something to the effect of "You've added 2 records and updated 4 records."
My current solution is below - but with two problems. The first is it is very slow. The second is that as soon as you click on the button, although there is no hourglass, the system is "frozen" as the DCount works. What alternatives do I have??
Thanks in advance for your expert help!!
Eric
I have a command button that runs 2 queries - an update query, and an append query. I'd like a message box to pop up when its done saying something to the effect of "You've added 2 records and updated 4 records."
My current solution is below - but with two problems. The first is it is very slow. The second is that as soon as you click on the button, although there is no hourglass, the system is "frozen" as the DCount works. What alternatives do I have??
Code:
Private Sub cmdUpdate_Click()
If IsNull(DCount("CUSIP_ID", "dbo_ASSET Without Matching tblFunds")) Then
strAdded = "0"
Else
strAdded = DCount("CUSIP_ID", "dbo_ASSET Without Matching tblFunds")
End If
If IsNull(DCount("CUSIP", "tblFunds Without Matching dbo_ASSET")) Then
strUpdated = "0"
Else
strUpdated = DCount("CUSIP", "tblFunds Without Matching dbo_ASSET")
End If
DoCmd.SetWarnings (False)
DoCmd.OpenQuery ("qryAppendNewCUSIPS")
DoCmd.OpenQuery ("qryUpdateNewNames")
DoCmd.SetWarnings (True)
Me.Requery
strMessage = "You have successfully added " & strAdded & " CUIP(s) and updated " & strUpdated & " CUSIPs."
MsgBox (strMessage)
End Sub
Thanks in advance for your expert help!!
Eric