http://www.perlmonks.org?node_id=1128184


in reply to Re^5: How can I import text to Access
in thread How can I import text to Access

#!/usr/bin/perl use strict; use warnings; use Win32::OLE; my $DBFile; my $Jet; my $DB; my $SQLquery; $DBFile = 'W:/Glenn-123456/Test/DevComm1.mdb'; #my $DBFile = qw( W:\\Glenn-123456\\Test\\DevComm1.mdb ); #my $MSACCESS_DSN ='Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$DBF +ile ;Persist Security Info=False;'; #my $msaccess_dbh = DBI->connect("dbi:ODBC:$MSACCESS_DSN"); #Choose appropriate version of Jet for your system; $Jet = Win32::OLE->CreateObject('DAO.DBEngine.36') or die "Can't cre +ate Jet database engine."; $DB = $Jet->OpenDatabase( $DBFile ); $SQLquery = "SELECT * INTO [Input] FROM [Text;DATABASE=W:/Glenn-123456 +/Test/;HDR=No].[DevComm1.txt]"; $DB->Execute($SQLquery, 128); #128=DBFailOnError #Ok here is updated code, but still getting an error #Can't create Jet Database engine at line 17

Replies are listed 'Best First'.
Re^7: How can I import text to Access
by GotToBTru (Prior) on May 28, 2015 at 20:14 UTC

    And now you're in the realm of OLE errors, and I can't help there (others here might). Perhaps Win32::OLE->LastError() contains some useful information?

    Dum Spiro Spero
      added Win32::OLE->LastError() no new information