|
-
Dec 10th, 2003, 09:58 AM
#1
Thread Starter
Frenzied Member
Report Properties [Resolved]
Is there any way to change the query that is run for a report through VBA?
Currently a report of mine runs a certain query to populate the report. Depending on certain conditions, I want to change the query that is used for that report.
Last edited by ober0330; Dec 10th, 2003 at 02:16 PM.
-
Dec 10th, 2003, 10:46 AM
#2
Thread Starter
Frenzied Member
Also, does the Order By clause not work for reports? I have it in my query and if you run the query seperately, it works fine. But when I use the query with a function, it doesn't put them in order.
-
Dec 10th, 2003, 11:52 AM
#3
Frenzied Member
How are you making your queries? In Access or through building SQL in VB code? I have a project where some queries are created in Access, put in a macro, which is then invoked by code as well.
Wouldn't it be easier to write your own apps instead of dealing with others code? I know it would be for me.
-
Dec 10th, 2003, 11:56 AM
#4
Thread Starter
Frenzied Member
I'm building the queries in SQL through the VBA editor.
I've solved the first two problems, but now I'm having another problem... after I create the SQL statement, I write it out to a query so that it can be used by the "DoCmd.OpenReport" call. But whenever it writes the Access query, it puts extra parenthesis "()" around the query and then it doesn't work right. If I go into the query and delete the outermost parenthesis, the query works fine. But I have to create it on the fly and the stupid thing keeps putting those "()" in there.
-
Dec 10th, 2003, 12:33 PM
#5
Frenzied Member
Are you adding parantheses when you build the query? If so, try leaving a pair off. I've noticed that if you use the design view to build a query, Access throws a bunch of parantheses in when you look at the query in SQL view.
-
Dec 10th, 2003, 12:54 PM
#6
Thread Starter
Frenzied Member
I'm not putting any parens in when I create the statement. It puts them all in by itself and hence screws up my report!
-
Dec 10th, 2003, 02:15 PM
#7
Thread Starter
Frenzied Member
Nevermind, I got it 
Stupid Access is f-ing picky.
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
|