command button query

King

New Member
Joined
Jul 13, 2004
Messages
36
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
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
This might get you started -

Create a blank form _ colour e.g. grey.
Produce a Macro to achieve the very basic steps you require.
At the appropraite point insert a row that opens the Blank form
then Insert a row that maximises the same form.
Once\if this works to hide the query(s) then view the code behind the Macro and adapt to your VBA routine as necessary.

HTH

Bernard
 
Upvote 0

Forum statistics

Threads
1,221,814
Messages
6,162,135
Members
451,743
Latest member
matt3388

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top