Grygonos has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl script that runs in conjuction with an MS-Access database. The script is invoked via a form click. The script works.

I have also written myself an Ms-Access module, so as to not copy and paste silly code over and over from program to program.

My Access module has a problem in its printReport function. This function works fine locally(running it from textpad by opening it from the novell drive), but bombs when calling it from the context of the db.

I think where the problem lies is in the drive naming, since my local machine knows this novell volume as drive K: , but novell calls is \\nv_vol\xxx\ I thought this would work from any drive, guess I was mistaken.

Access.Application.OpenCurrentDatabase will invoke die whether or not it is successful, so I'm assuming that's what's happening. below is the function that sets the datasource of my Access.pm module.
sub activeDatabase { #get the present working directory $pwd = `cd`; #remove its \n chomp $pwd; return ($pwd . "\\xxx.mdb"); }

here is the function that prints the report from my access module.
$Access::datasource is set to the value returned by the above function.
##Prints a report## sub printReport { my $source = shift; my $report_name = shift; #Make an Access.Application object my $app = Win32::OLE->new('Access.Application') or die "Failed to +print report!"; #Open the database $app->OpenCurrentDatabase($datasource); #Make it Invisible $app->{Visible} = 0; #Open the report in design mode $app->DoCmd->OpenReport($report_name,$accessConst->{'acViewDesign' +}); #Change the reports RecordSource property $app->Reports->Item($report_name)->{RecordSource} = $source; #Save the report $app->DoCmd->Save($accessConst->{'acReport'},$report_name); #Close the report $app->DoCmd->Close($accessConst->{'acReport'},$report_name); #Print the report $app->DoCmd->OpenReport($report_name); #Quit the application $app->DoCmd->Quit($accessConst->{'acQuitSaveNone'}); }
I can't capture the error because the screen dies before I can get a pause on it. But I have seen the error before and can tell you what it says basically.

It gripes at the line where I access the Recordsource property saying I can't use an undefined value as a hash reference or something to that effect.
In my past expereinces of debugging this module, that usually means the database wasn't openend by Access.Application.OpenCurrentDatabase. Does ANYONE have an inkling of an idea what I can do to fix this?

Replies are listed 'Best First'.
Re: Running scripts on novell drives
by gellyfish (Monsignor) on Jul 07, 2003 at 13:38 UTC

    In the dim and distant past (it is four years since I have worked with Netware) - I have have used Win32::NetResource to map remote Netware drives with local names - it is possible that Access doesn't like UNC paths.

    /J\
    
      Cool I'll check it out.. thanks :)

      It's early in the morning so I can't believe I didn't think to do this.. I just ran my activeDatabase() function from the novell drive. It printed the path to my usernames MyDocuments directory... which is odd...