Yes, it is possible to open MSAccess files, as clemburg noted. You can also add, edit, delete, and query records in your MSAccess dbs from your Perl program.

Because MSAccess is an ODBC source, you can work with its files using Win32::ODBC in your program. Win32::ODBC is part of the libwin32 libraries in the Perl standard distribution.

Set up ODBC (if needed), then add the specific database as an the ODBC source.

To do this, go to your control panel and click "ODBC Data Sources". Under the User DSN tab, you should see something like "MS Access 2000 Database" and on the same line, "Microsoft Access Driver". If you do, you're good. If you don't, you'll need to install the additional ODBC drivers from your Win2k cd.

After you've confirmed that that the Access Driver is installed, click "Add" (in the User DSN window), select the Access Driver, then click Finish. Now you're at the setup window. Enter a mnemonic data source name, a short description, then click "Select" and browse to the Access db. If the db is password protected, click "Advanced" and enter the u/p.

At this point the db is registered as an ODBC source.

In your program, use Win32::ODBC and from there, it's straight SQL statements to insert, delete, query, etc.. Docs for Win32::ODBC are here. Here's some sample code:

use Win32::ODBC; my $db = Win32::ODBC->new('datasourcename'); # as defined in your ODBC + panel $db->Sql( "INSERT INTO tablename ( Field ) VALUES( 'text to insert' ) +); $db->Close();

Win32::ODBC is part of the libwin32 libraries, so if ActivePerl is installed, it ought to be installed correctly already. But you may want to install a more current version if available, which you can do by using the ppm manager (ppm.bat in your perl directory) and typing install libwin32 at the prompt.

Hope this helps,
Jasmine


In reply to Setting up MS Access as an ODBC Data Source by Jazz
in thread Opening files in MS Access by naive

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.