Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Including Queries With Active/Inactive Button

Status
Not open for further replies.

leadpro

Technical User
Jan 7, 2005
34
0
0
US
I need a module that will only run a series of select/update queries that have the button [Active/Inactive] = -1 in each select query. The update queries are based on each respective select query.

The sequence would look like this:

If Active/Inactive=-1, then

Run Select Query1
Run Update Query1
Run Select Query2
Run Update Query2
 
Create your queris from the query design window then go to the SQL view copy it and paste it where it to be in the code below. Then you can run the sub on click event of a command button
Code:
RunQuries

Code:
Sub RunQuries()
Dim strSQL1, strSQL2, strSQL3, strSQL4 As String
strSQL1 = "Select Query1 SQL code here"
strSQL2 = "Update Query1 SQL code here"
strSQL3 = "Select Query2 SQL code here"
strSQL4 = "Update Query2 SQL code here"
    DoCmd.SetWarnings False
        DoCmd.RunSQL (strSQL1)
        DoCmd.RunSQL (strSQL2)
        DoCmd.RunSQL (strSQL3)
        DoCmd.RunSQL (strSQL4)
    DoCmd.SetWarnings True
End Sub
hope this helps

________________________________________________________________________
Zameer Abdulla
Visit Me
Children are poor men's riches.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top