Results 1 to 7 of 7

Thread: Report Properties [Resolved]

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    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.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    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.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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.

  4. #4

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    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.

    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  5. #5
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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.

  6. #6

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    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!
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  7. #7

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Nevermind, I got it

    Stupid Access is f-ing picky.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width