sirius98 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Is there any way to write Access reports through DBI?
  • Comment on Generating MS Access reports through Perl DBI

Replies are listed 'Best First'.
Re: Generating MS Access reports through Perl DBI
by jbrugger (Parson) on Mar 21, 2005 at 09:08 UTC
    Hi, not sure what you exactly want, but can you use DBD::ODBC? thats the ODBC driver for DBI.
    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
      Well you know how you can generate reports through access, i was wondering if there is anyway to do it in DBI. I need to generate a bunch of nicely formatted reports with different field criteria. I though somehow i could do like an sql type query to generate the report in access.
Re: Generating MS Access reports through Perl DBI
by jhourcle (Prior) on Mar 21, 2005 at 11:22 UTC

    When most people talk about 'Access reports', they are refering to making the reports from within Access. In that case, no, because Access and DBI are both mutually exclusive database clients. (well, Access also has an MS Jet Database built into it, but I think of them as two seperate parts)

    If, however, you want to make reports in Access from something which is being edited via DBI, you may be able to -- but it's a function of the database, and mostly unrelated to DBI.

    If your database supports ODBC, you can set up a DSN with your connection info, and point to that. (there are probably ways to handle it without a DSN, but I like the encapsulation). You'll want to search some of the MS Access websites on how to do it. I haven't had to do this in ~5-6 years, so it's possible that anything I've remembered is wrong, or has since changed.

Re: Generating MS Access reports through Perl DBI
by jZed (Prior) on Mar 21, 2005 at 17:02 UTC
    You could possibly use one of the Win32::* modules to automate Access and have it spit out a report. If you want to actually create the report outside of Access, DBI with ODBC will take care of the SQL end - it will allow you to make any query you could make from within Access. Then to generate the report, you could use DBI::Format or a templating system like HTML:Template or Template::Toolkit.
Re: Generating MS Access reports through Perl DBI
by manav (Scribe) on Mar 21, 2005 at 10:51 UTC
    If you have extracted data from the database, the format keyword can be used to design output formats.

    See the perldoc perlform document for everything on how to design and use such formats.

    Manav