Click here to get back home

Microsoft Access & Win32::Ole

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Microsoft Access & Win32::Ole BartlebyScrivener 10-28-2005
Posted by BartlebyScrivener on October 28, 2005, 4:03 pm
Please log in for more thread options


I have a database called Quotations2005 which I can open with the
following. I would also like to run some event code contained in the
switchboard form. The code is contained in Private Sub
Command23_Click()

Is this even possible? Does one use the Run Macro Command as in Word?

use strict;
use warnings;
use Win32::OLE;

my $access = CreateObject Win32::OLE 'Access.Application' || die
"Cannot create Access object\n$!\n";

$access -> = 1;
$access -> OpenCurrentDatabase('d:\Access
Databases\Quotations2005.mdb');

# Here's the scary part

$access -> DoCmd -> RunMacro(Form_Switchboard.Command23_Click);
$access->Quit();

Thank you for any help.



Posted by BartlebyScrivener on October 29, 2005, 7:50 am
Please log in for more thread options


Apologies to all. I'm answering myself to prevent anyone from doing
unnecessary work. I found the answer at:

ACC: Using Microsoft Access as an Automation Server
http://support.microsoft.com/?id=147816

Calling Custom Procedures

In your Automation code, you can call a custom Visual Basic procedure
stored in a Microsoft Access database by using the Run method of the
Application object. The custom procedure must be declared as Public
and located in a standard module (not a form or report module). For
example, to run MyDateAdd function, add the following sample code to
your Automation Controller:

# Dim objAccess as Object, newdate as Date
# Set objAccess = GetObject _
# ("C:\Program Files\Microsoft
Office\Office\Samples\Northwind.mdb")
# newdate = objAccess.Run("MyDateAdd", "m", 1, Date)
# MsgBox newdate,,"MyDateAdd returned"



Similar ThreadsPosted
XP, Perl, Win32::ODBC, Microsoft Access 2002 SP3, & Chinese characters January 22, 2008, 4:18 pm
Win32::OLE::Const 'Microsoft Excel' - sort & freeze pane April 30, 2008, 12:48 am
Module to use for win32 registry access? April 4, 2007, 8:32 pm
Announce: Win32::SqlServer - access SQL Server from Perl November 27, 2005, 5:03 pm
Do Win32::ODBC module support Chinese characters when used with MS Access? September 15, 2004, 10:33 pm
Microsoft SQL Server 2000 perl module November 11, 2004, 2:12 am
Dave Roth's site (Win32::AdminMisc, Win32::ODBC, etc.) not available. December 22, 2005, 8:46 am
new module Logfile::Access October 23, 2004, 8:30 pm
Perl under MS IIS with access to MySQL June 19, 2005, 11:24 pm
Access a c++ module from Perl October 24, 2005, 6:21 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap