x-lours has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,
I would like to export all the modules from an MS ACCESS database (mdb or accdb).
In order to do this, I have to use "OpenCurrentDatabase" to access the Modules, Forms->Module, Reports->Module. BUT, when I choose a database, the folllowing error message appears:
"Inappropriate I/O control operation at <path/mydatabase.mdb>" !
I am using ActivePerl 5.24.0 and http://code.activestate.com/lists/perl-win32-users/33000/ for the skeleton.
Here is the beginning of my code up to the trouble point:
... my $strBase = Tkx::tk___getOpenFile(-title => ... ... my $AppAccess = Win32::OLE->new('Access.Application', 'Quit') or die " +Couldn't start new Access instance: $!"; $AppAccess->OpenCurrentDatabase($strBase) or die "Unable to open Acces +s database : $!";
That is where it stops, and gives me the above-mentioned message.
Could someone help me solve this problem? What have I missed?

Any help is much appreciated!

All best

Replies are listed 'Best First'.
Re: Win32::OLe and OpenCurrentDatabase
by Corion (Patriarch) on Dec 23, 2016 at 13:43 UTC

    This likely means that $strBase does not contain the (full name to) the database, or maybe that database is locked (do you have Access open?).

    Maybe consider not using Tkx and hardcoding the filename? Also consider creating an actual short program we can try out locally, as SSCCE describes.

      thanks for reading.
      finally I found it : the  or die is the problem.
      returning nothing $AppAccess->OpenCurrentDatabase($strBase) or die "Unable to open Access database : $!"; always failed ... but $AppAccess->OpenCurrentDatabase($strBase); works. Happy to finally learn this.

      thanks for all

        Yep...the documentation says:

        Return Value: Nothing

        Which is odd, for a function that's opening a database file. Not sure how you detect failures, but it is documented behavior.