Hi guys
I have a form on which the user will enter the details of a site assessment for environmental assests and threats. In order to obtain the final enviro benifits per dollar I have to run a number of update queries. It is important that the user cannot see how these queries work so I have placed a command button on the form to run the queries. The problem I have is if they decide to change one of their entries and run the query again the form does not update. The only way I can get it to update is to close the form and run the query separatly. So my question is is there a way to get the command button to run multiple update queries at once and if the data on the form is changed can it simply be pressed again to rerun the update query with the new data.
Here is the code I have for my query command button
Private Sub Command809_Click()
On Error GoTo Err_Command809_Click
Dim stDocName1 As String
Dim stDocName2 As String
Dim stDocName3 As String
Dim stDocName4 As String
Dim stDocName5 As String
Dim stDocName6 As String
Dim stDocName7 As String
Dim stDocName8 As String
Dim stDocName9 As String
Dim stDocName10 As String
Dim stDocName11 As String
Dim stDocName12 As String
Dim stDocName13 As String
Dim stDocName14 As String
Dim stDocName15 As String
stDocName1 = "Geomorphology Score Query"
stDocName2 = "Geomorphology Value Query"
stDocName3 = "RV Value Query"
stDocName4 = "IWP Sum Query"
stDocName5 = "IWP Norm Query"
stDocName6 = "IWP Threat Query"
stDocName7 = "IWPR Sum Query"
stDocName8 = "IWPR Norm Query"
stDocName9 = "IWPR Threat Query"
stDocName10 = "TR Query"
stDocName11 = "Risk Query"
stDocName12 = "Impact Query"
stDocName13 = "EB Query"
stDocName14 = "EB Total Query"
stDocName15 = "EB per Dollar Query"
DoCmd.OpenQuery stDocName1, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit
DoCmd.OpenQuery stDocName3, acNormal, acEdit
DoCmd.OpenQuery stDocName4, acNormal, acEdit
DoCmd.OpenQuery stDocName5, acNormal, acEdit
DoCmd.OpenQuery stDocName6, acNormal, acEdit
DoCmd.OpenQuery stDocName7, acNormal, acEdit
DoCmd.OpenQuery stDocName8, acNormal, acEdit
DoCmd.OpenQuery stDocName9, acNormal, acEdit
DoCmd.OpenQuery stDocName10, acNormal, acEdit
DoCmd.OpenQuery stDocName11, acNormal, acEdit
DoCmd.OpenQuery stDocName12, acNormal, acEdit
DoCmd.OpenQuery stDocName13, acNormal, acEdit
DoCmd.OpenQuery stDocName14, acNormal, acEdit
DoCmd.OpenQuery stDocName15, acNormal, acEdit
Exit_Command809_Click:
Exit Sub
Err_Command809_Click:
MsgBox Err.Description
Resume Exit_Command809_Click
End Sub
I am pretty new to Access and VB but am starting to get the hang of it.
Cheers
I have a form on which the user will enter the details of a site assessment for environmental assests and threats. In order to obtain the final enviro benifits per dollar I have to run a number of update queries. It is important that the user cannot see how these queries work so I have placed a command button on the form to run the queries. The problem I have is if they decide to change one of their entries and run the query again the form does not update. The only way I can get it to update is to close the form and run the query separatly. So my question is is there a way to get the command button to run multiple update queries at once and if the data on the form is changed can it simply be pressed again to rerun the update query with the new data.
Here is the code I have for my query command button
Private Sub Command809_Click()
On Error GoTo Err_Command809_Click
Dim stDocName1 As String
Dim stDocName2 As String
Dim stDocName3 As String
Dim stDocName4 As String
Dim stDocName5 As String
Dim stDocName6 As String
Dim stDocName7 As String
Dim stDocName8 As String
Dim stDocName9 As String
Dim stDocName10 As String
Dim stDocName11 As String
Dim stDocName12 As String
Dim stDocName13 As String
Dim stDocName14 As String
Dim stDocName15 As String
stDocName1 = "Geomorphology Score Query"
stDocName2 = "Geomorphology Value Query"
stDocName3 = "RV Value Query"
stDocName4 = "IWP Sum Query"
stDocName5 = "IWP Norm Query"
stDocName6 = "IWP Threat Query"
stDocName7 = "IWPR Sum Query"
stDocName8 = "IWPR Norm Query"
stDocName9 = "IWPR Threat Query"
stDocName10 = "TR Query"
stDocName11 = "Risk Query"
stDocName12 = "Impact Query"
stDocName13 = "EB Query"
stDocName14 = "EB Total Query"
stDocName15 = "EB per Dollar Query"
DoCmd.OpenQuery stDocName1, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit
DoCmd.OpenQuery stDocName3, acNormal, acEdit
DoCmd.OpenQuery stDocName4, acNormal, acEdit
DoCmd.OpenQuery stDocName5, acNormal, acEdit
DoCmd.OpenQuery stDocName6, acNormal, acEdit
DoCmd.OpenQuery stDocName7, acNormal, acEdit
DoCmd.OpenQuery stDocName8, acNormal, acEdit
DoCmd.OpenQuery stDocName9, acNormal, acEdit
DoCmd.OpenQuery stDocName10, acNormal, acEdit
DoCmd.OpenQuery stDocName11, acNormal, acEdit
DoCmd.OpenQuery stDocName12, acNormal, acEdit
DoCmd.OpenQuery stDocName13, acNormal, acEdit
DoCmd.OpenQuery stDocName14, acNormal, acEdit
DoCmd.OpenQuery stDocName15, acNormal, acEdit
Exit_Command809_Click:
Exit Sub
Err_Command809_Click:
MsgBox Err.Description
Resume Exit_Command809_Click
End Sub
I am pretty new to Access and VB but am starting to get the hang of it.
Cheers