ACC95: How to Run MS Access Wizards Using Visual BasicLast reviewed: May 13, 1997Article ID: Q148506 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. This article describes how to start the Microsoft Access version 7.0 wizards using Visual Basic for Applications. CAUTION: If you plan to create a custom application using the Microsoft Access Developer's Toolkit (ADT) for Windows 95, you should not programmatically start the Microsoft Access Wizards in your database. Any Visual Basic code that runs the wizards can fail in the run-time environment because you cannot distribute the required library files with your application. You must have a single, licensed copy of Microsoft Access for Windows 95 installed on your computer to run the Microsoft Access Wizards using the methods described in this article.
MORE INFORMATIONThe procedures for running the Microsoft Access Wizards are contained in the Wzmain70.mda and Wztool70.mda library databases, which are located in your Microsoft Access folder (for example, C:\Msoffice\Access). The Wzmain70.mda library database contains the following procedures for specific wizards:
Wizard Procedures --------------------------------------------------------------------- Form frui_Entry([TableName as String], ObjectType _ Report as Integer) Simple Query Crosstab Query xtq_Entry() AutoForm: Columnar auto_Entry(TableName as String, DocumentType _ AutoForm: Datasheet as Integer, ObjectType as Integer) AutoForm: Tabular AutoReport: Columnar AutoReport: Tabular PivotTable pvt_Entry([TableName as String]) Word for Windows Merge pm_Entry(TableName as String) MailingLabel mlbl_Entry(TableName as String) Table tw_Entry()The Wztool70.mda library database contains the following procedures for specific wizards:
Wizard Procedures ------------------------------------------------------------------ Attachment att_Entry() Form Chart cw_WizardEntry(TableName as String, _ Report Chart ObjectType as Integer, Unused as Integer) Find Duplicates Query dup_Entry() Find Unmatched Query dwz_Entry() Calling the WizardsWhen you call a procedure in the Wztool70.mda or Wzmain70.mda library database, the required syntax can vary, depending on if you have a reference to the library within your database.
Syntax with a ReferenceIf your database has a reference to Wztool70.mda and Wzmain70.mda, you can call the wizard procedures using standard syntax for running a function or subroutine. For example, to start a specific wizard from a form, you can copy the sample syntax below to the OnClick property of a command button on the form:
Wizard Calling Syntax --------------------------------------------------------- Attachment =att_Entry() AutoForm: Columnar =auto_Entry("Customers", 1 , 2 ) AutoForm: Datasheet =auto_Entry("Customers", 3 , 2 ) AutoForm: Tabular =auto_Entry("Customers", 2 , 2 ) AutoReport: Columnar =auto_Entry("Customers", 1 , 3 ) AutoReport: Tabular =auto_Entry("Customers", 2 , 3 ) Crosstab Query =xtq_Entry() Find Duplicates Query =dup_Entry() Find Unmatched Query =dwz_Entry() Simple Query =frui_Entry("Customers",1) Form =frui_Entry("",2) Form Chart =cw_WizardEntry("Customers",2,0) MailingLabel =mlbl_Entry("Customers") PivotTable =pvt_Entry([TableName as String]) Report =frui_Entry("Customers" ,3) Report Chart =cw_WizardEntry("Customers",3,0) Table =tw_Entry() Word for Windows Merge =pm_Entry("Customers")NOTE: You cannot programmatically create a reference using Visual Basic; it must be created manually. The basic steps are as follows:
Syntax Using a ReferenceIf you want to avoid creating a reference to Wztool70.mda and Wzmain70.mda, you can use the Run method of the Application object in a Visual Basic procedure to call a wizard, for example:
Application.Run "<library>.<function>", [arguments]To start a specific wizard, use Application.Run with the following sample "library.function" syntax:
Wizard "<library>.<function>" ----------------------------------------------------------------------- Attachment "Wztool70.att_Entry" AutoForm: Columnar "Wzmain70.auto_Entry", "Customers",1,acForm AutoForm: Datasheet "Wzmain70.auto_Entry", "Customers",3,acForm AutoForm: Tabular "Wzmain70.auto_Entry", "Customers",2,acForm AutoReport: Columnar "Wzmain70.auto_Entry", "Customers",1,acReport AutoReport: Tabular "Wzmain70.auto_Entry", "Customers",2,acReport Crosstab Query "Wzmain70.xtq_Entry" Find Duplicates Query "Wztool70.dup_Entry" Find Unmatched Query "Wztool70.dwz_Entry" Simple Query "Wzmain70.frui_Entry", "Customers",acQuery Form "Wzmain70.frui_Entry", "",acForm Form Chart "Wztool70.cw_WizardEntry", "Customers",acForm,0 MailingLabel "Wzmain70.mlbl_Entry", "Customers" PivotTable "Wzmain70.pvt_Entry","Customers" Report "Wzmain70.frui_Entry", "Customers" ,acReport Report Chart "Wztool70.cw_WizardEntry", "Customers",acReport,0 Table "Wzmain70.tw_Entry" Word for Windows Merge "Wzmain70.pm_Entry", "Customers" REFERENCESMicrosoft Access "Building Applications with Microsoft Access for Windows 95," version 7.0, Chapter 12, "Using Library Databases and Dynamic-Link Libraries," pages 292-294. For more information about starting Microsoft Wizards in Microsoft Access version 2.0, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q115121 TITLE: ACC2: How to Start MS Access Wizards with WLib_WizMain Function |
Keywords : kbusage WzHowto
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |