use DBI;
my $datasource = "driver=Microsoft Access Driver (*.mdb);dbq=new.mdb";
my $username = 'admin';
my $password = '';
my $dbh = DBI->connect("dbi:ODBC:$datasource", $username, $password)
|| die "Error connecting: $!";
my $sql = "CREATE TABLE DBITable (FirstName TEXT, LastName TEXT)";
my $sth = $dbh->prepare($sql);
$sth->execute;
####
use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft ADO Ext. 2.5 for DDL and Security';
# The "catalog" is the db
my $cat = Win32::OLE->new('ADOX.Catalog');
# Tweak the following line for your JetDB
$cat->Create('Provider=Microsoft.Jet.OLEDB.3.51;Data Source=new.mdb');
#first create the table, modify it, then append it to the
#tables collection
my $table = Win32::OLE->new('ADOX.Table');
$table->{Name} = 'MyADOTable';
$table->Columns->Append('ID', adInteger);
$table->Columns->Append('Desc', adVarChar);
$cat->Tables->Append($table);
##
##
use strict;
use warnings;
use Win32::OLE;
# The next two lines would need to be tweaked
# Off the top of my head, I think DAO 3.6 (or 4.0?)is for Access 2000
# Look in HKEY_CLASSES_ROOT for DAO for the actual numbers
use Win32::OLE::Const 'Microsoft DAO 3.51 Object Library';
my $acc = Win32::OLE->new("DAO.DBEngine.35", 'quit');
my $db = $acc->CreateDatabase('new.mdb', dbLangGeneral);
my $tab = $db->CreateTableDef('MyDAOTable');
my $fld = $tab->CreateField('ID', dbInteger);
$tab->Fields->Append($fld);
$fld = $tab->CreateField('Desc', dbText);
$tab->Fields->Append($fld);
$db->TableDefs->Append($tab);
$db->TableDefs->Refresh;