sub getTableDefs { $accessConst = Win32::OLE::Const->Load('Microsoft Access 8.0 Object Library'); $daoConst = Win32::OLE::Const->Load('Microsoft DAO 3.51 Object Library'); #array to hold table names my @names; #Create a new OLE Access.Application object my $app = Win32::OLE->new('Access.Application'); #Open the database being worked in $app->OpenCurrentDatabase($datasource); #Get the database object my $database = $app->CurrentDb(); #Save every table name that is not a system or linked table foreach my $i (0..($database->TableDefs->{Count}-1)) { #If the attributes are 0 (ie a normal table) if(!$database->TableDefs($i)->{Attributes} || $database->TableDefs($i)->{Attributes} eq $daoConst->{'dbAttachedTable'}) { #add it to the list of valid selections push @names $database->TableDefs($i)->{Name}; } } #Quit the application $app->DoCmd->Quit($accessConst->{'acQuitSaveNone'}); #Return the list of valid table names return @names; }