Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    233

    Unanswered: Vba with reports

    I need to learn how to use vba with reports, as much as i can, i cant find in my book, or from google can anyone recomend a site?

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Best way to learn (I think) is to look at other examples people have done. There are a few report type mdbs in the Access Code Bank (first thread in the MSAccess threads) which show some different techniques.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I am not sure about other people, but I mainly use code in reports to make optional information appear and disappear. I also use it form extra formatting. Other than that I am not sure what else you do on a regualr basis.

    I use the On Format event for the Detail section the most. For every detail record that prints, this event fires. Back in the day, before Conditional Formatting, I would use this event to make every other line a different color.

    I don't think you will find too many specific examples of code behind a report. I think you will get better information by asking specific questions here.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    There's many different ways to set up a reporting type system and different ways to code forms (or open recordsets in vba) to launch reports. Some base reports off of criteria on a form while others put criteria in the query for the report, or you can make a table the report is based off of, or you can open up recordsets and code certain fields on the report to display values (i.e. a Timesheet report for example where you might open a recordset and write to specific static fields on a report in the onFormat event). You may have need of a crosstab type report, or as DCKunkle stated, you may need to just format certain fields on the report.

    vba coding for reports is a general question and unless you specify exactly what you want to do, the best advice I could offer is for you to look at what others have done and see how they've set up a reporting type system (where there are many different ways) which is what I've assumed you're referring to. If it's different, I apologize for assuming wrong.

    Here is one example of a reporting type system which has many different ways to do reports: http://www.dbforums.com/showpost.php...5&postcount=55

    There's also a crosstab report example and other report examples in the code bank (there's even one which shows how to do the alternating green bar for every other record as DCKunkle mentioned - see FormManipulation2 in code bank for how to do something like this which has a report example.)
    Last edited by pkstormy; 11-15-07 at 18:53.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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