Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / March 2007

Tip: Looking for answers? Try searching our database.

Macros Won't Run

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
connellg - 29 Mar 2007 17:35 GMT
This is the VBA code executed from OnClick on a form's command button, to run
4 macros:

Private Sub Command160_Click()
   DBEngine(0)(0).Execute "Append to Delivery List Table", dbFailOnError
   DBEngine(0)(0).Execute "Print Work Order", dbFailOnError
   DBEngine(0)(0).Execute "Print Final Inspection", dbFailOnError
   DBEngine(0)(0).Execute "New Record", dbFailOnError
End Sub

An error message states  "Compile Error", "Variable Not Defined"

Would appreciate your help in de-bugging this. Thanks.
SteveS - 31 Mar 2007 07:52 GMT
If these are true "Macros", according to Help:

CurrentDB.Execute ()

Runs an action query or executes an SQL statement on a specified Connection
or Database object

If you want to run a "Macro" in VBA code, the syntax is

    DoCmd.RunMacro "My Macro"

I do not use macros; they have no error handling and, IMO, are to limiting.
I would suggest converting the macros to code....

To convert global macros to Visual Basic:

1. In the Database window, click Macros  under Objects.

2. Click the name of the macro you want to convert.

3. On the File menu, click Save As.

4. In the Save As dialog box, click Module and click OK.

5. In the Convert macro dialog box, select the options you want, and click
Convert.

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> This is the VBA code executed from OnClick on a form's command button, to run
> 4 macros:
[quoted text clipped - 9 lines]
>
> Would appreciate your help in de-bugging this. Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.