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?

In reply to Running scripts on novell drives by Grygonos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.