You want to look at DBI and DBD::ODBC. This will give you a way of sending SQL commands to an ODBC data source.

Then you want to find out what SQL you want to send...

For the tables, you can send plain CREATE TABLE statements, but I doubt that you could save the query into the Access database from ODBC.

If you create the tables and queries beforehand, creating the query is no problem... The only thing then is to find the value of the autonumber field from Table1, and insert that into Table2. I've no idea how to do that, so I'd suggest you add a Folder field (text) to Table2. Then do

DELETE * FROM Table1; DELETE * FROM Table2;
Followed by a number of
INSERT INTO Table1 (Folder) VALUES ('myfolder1'); INSERT INTO Table2 (Account, Type, Folder) VALUES ('Account1', 'type1' +, 'myfolder1');
When you are done, do
UPDATE Table2 SET Table2.Folder_ID = Table1.Folder_ID WHERE Table1.Fol +der = Table2.Folder;

In reply to Re: Automating the creation process of MS Access Tables by alftheo
in thread Automating the creation process of MS Access Tables by blackadder

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.