|
-
Jul 25th, 2008, 04:05 AM
#1
Thread Starter
Junior Member
Another filter queries request
I've seen a few posts about this but nothing i can see relating to what i'm doing.
I have 3 queries, the second takes some of its fields from the first, the third takes some of its fileds from the second, i.e. they all depend on each other.
SO to remove the need to run all 3 queries i wanted to automate the process in VBA.
So far I have managed to get this going with
DoCmd.OpenQuery 3 times and using DoCMd.Close acQuery to close the first two once they have run.
There are 2 things id like to know,
>Is it possible to run the first two queries without ever having them displayed?
>i would like to make it so that the second query receives information from an inputbox (or is at least filtered once run) is there a way to apply a filter to a query in VBA automatically? I just got something doing this with reports but it seems you cant do it the same way with queries!
My code is as follows
Public Sub Run_Queries()
Dim Qu1 As String
Dim Qu2 As String
Dim Qu3 As String
Dim UserInput As String
Qu1 = "qry_User_Details"
Qu2 = "qry_User_Org_Details"
Qu3 = "qry_User_Org_Roles"
UserInput = InputBox("Enter An Org Id")
DoCmd.OpenQuery Qu1, acViewNormal
DoCmd.Close acQuery, Qu1
DoCmd.OpenQuery Qu2, acViewNormal
DoCmd.ApplyFilter ORG_ID = UserInput 'Obviously this doesnt work
DoCmd.Close acQuery, Qu2
DoCmd.OpenQuery Qu3, acViewNormal
End Sub
-
Jul 25th, 2008, 05:08 AM
#2
Thread Starter
Junior Member
Re: Another filter queries request
Dont worry i got it sorted im just going to use a combo box instead of an input box
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|