Results 1 to 2 of 2

Thread: VBA, SQL & MS Access Reporting

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2004
    Posts
    28

    VBA, SQL & MS Access Reporting

    This code outputs a report to an rtf file:
    VB Code:
    1. Set dbs = CurrentDb
    2. Set qdf = dbs.QueryDefs("qryrptScheduleA")
    3. qdf.sql = "Select * from vwScheduleA " & strWhere
    4. DoCmd.OutputTo acOutputReport, "rptScheduleArtf", acFormatRTF, "H:\ProviderPDF\in\file.rtf"
    I need to create multiple rtf files after grouping by an item in vwScheduleA. Not sure how create a variable in strWhere to loop through the report and return 1 record at a time. The filename (file.rtf) will become a variable.

    desired output:
    item1.rtf
    item2.rtf
    item3.rtf

    I greatly appreciate suggestions!

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Open a recordset with all the records you need.
    Loop through and for each group, use to filter the stroed procedure/query. Then output.

    Not the best, but should work.


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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