Could someone (David?) guide me through how I would amend my code to do
this?
This is my code at the moment. You will see that it has a message box at
the
start of the procedure but I want a message that tells the user what's
happening and when all the queries have run.
Many thanks
Tony
Private Sub cmdupdate_Click()
On Error GoTo Err_cmdupdate_Click
'Step1- Update tblcompany
Dim stDocName1 As String
stDocName1 = "qrycompanyupdate"
'Step2 - Update tblhvanalysis
Dim stDocName2 As String
stDocName2 = "qrycompanyupdatehva"
'Step3 - Update tblhvcomp
Dim stDocName3 As String
stDocName3 = "qrycompanyupdatehvc"
'Step4 - Update tblhvdealspt1
Dim stDocName4 As String
stDocName4 = "qrycompanyupdatehvpt1"
'Step5 - Update tblhvdealspt2
Dim stDocName5 As String
stDocName5 = "qrycompanyupdatehvpt2"
'Step6 - Update tblmainIrish
Dim stDocName6 As String
stDocName6 = "qrycompanyupdateIrish"
'Step7 - Update tblmaintabs
Dim stDocName7 As String
stDocName7 = "qrycompanyupdatemt"
Dim Msgstr1 As String
Msgstr1 = "You are about to update the company name, in all Tables, of
the company you have selected:" & vbCrLf & vbCrLf _
& "Are you sure you want to do all of this?"
If MsgBox(Msgstr1, vbYesNo, "Updating Company name") = vbNo Then
DoCmd.CancelEvent
Else
DoCmd.OpenQuery stDocName1, acViewNormal, acEdit
DoCmd.OpenQuery stDocName2, acViewNormal, acEdit
DoCmd.OpenQuery stDocName3, acViewNormal, acEdit
DoCmd.OpenQuery stDocName4, acViewNormal, acEdit
DoCmd.OpenQuery stDocName5, acViewNormal, acEdit
DoCmd.OpenQuery stDocName6, acViewNormal, acEdit
DoCmd.OpenQuery stDocName7, acViewNormal, acEdit
End If
Exit_cmdupdate_Click:
Exit Sub
Err_cmdupdate_Click:
MsgBox Err.Description
Resume Exit_cmdupdate_Click
End Sub
Yes, you can put a Msgbox at the end of the code that executes the query
or
alternatively create a form that is displayed before the queries run and
then hidden afterward. If you go the form route, you can inform the user
of
the progress by updating a caption on the form 'Query (x) of (x)
running...).
[Forms]![frmAdvisory]![Notification].caption = "Executing query 5 of 7..."
[Forms]![frmAdvisory]![Notification].Repaint
The repaint is neccessary otherwise the change to the caption won't be
seen
by the user.
I have a form that has a command button with code that updates 7 tables
by
a
[quoted text clipped - 6 lines]