Copyright: Copyright 1993 Microsoft Corp.
Citation: Copyright 1993 Microsoft Corporation. All rights reserved.


 Access 2.x Knowledge Base

Prepared 08/22/94

 How to Query in the Knowledge Base (KB) Help File

 Knowledge Base Articles

 More Information on the Knowledge Base

 Survey for KB Help Users

THE INFORMATION IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES EITHER EXPRESSED OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS, OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FORGOING EXCLUSION OR LIMITATION MAY NOT APPLY.Copyright (c) 1994 Microsoft Corporation.  All rights reserved.


How to Query in the Knowledge Base (KB) Help File
 Access 2.x Knowledge Base

 How to Query in the Knowledge Base (KB) Help File

 INF: How to Query on Category Keywords

 INF: Microsoft Access KB Categories and Subcategories

 Knowledge Base Articles

 More Information on the Knowledge Base

 Survey for KB Help Users


Knowledge Base Articles
 Access 2.x Knowledge Base

 How to Query in the Knowledge Base (KB) Help File

 Knowledge Base Articles

 INF: "#Name?" or Control is Blank on Form Based on a Query

 INF: "Continued..." Header for Groups That Span Multiple Pages

 INF: "Form Is Read Only" Error Message

 INF: "Incorrect Syntax Near '-'" Using TransferDatabase Action

 INF: Access Basic Error-Handling Supplemental Information

 INF: Adding a Dynamic Counter to a Query to Count Records

 INF: Adding a New Record to a Combo Box with a Double-Click

 INF: Additions to User's Guide Appendix A Specifications (2.0)

 INF: Administrator Setup Does Not Create SETUP Subdirectory

 INF: Attach R:BASE Table by Exporting dBASE Format in R:BASE

 INF: Attached Table Must Be Opened as Dynaset from Modules

 INF: Attaching Clipper Tables to Microsoft Access Databases

 INF: Avoid Using Different Palettes for Simultaneous Forms

 INF: Base Combo Box on Parameter Query to Filter Values

 INF: Btrieve File Owner Names, Passwords, and Security

 INF: Calculated Fields Must Be Shown to Perform Calculations

 INF: Calling RegQueryValue() to get an OLE Object Class Name

 INF: Case Sensitivity in Queries Differs with Attached Tables

 INF: Changes in Security in Version 2.0

 INF: Changing Area Codes Based on a Telephone Number Prefix

 INF: Click Right Mouse Button for Object Frame, OLE Properties

 INF: Compound Indexes Must Restrict First Indexed Field

 INF: Concatenating Fields in a Text box to Remove Blank Lines

 INF: Connecting to SYBASE SQL Server from an ODBC Application

 INF: Conversion of Oracle Data Types to Microsoft Access

 INF: Converting Graphs from Microsoft Graph Version 3.0 to 5.0

 INF: Converting Julian Dates with Access Basic

 INF: Copying Query that Cannot Be Opened in Design View

 INF: Correct Syntax for TransferDatabase to dBASE and Paradox

 INF: Could not Find SYSTEM.MDA or UTILITY.MDA File

 INF: Count() Ignores Null Values

 INF: Create and Drop Tables and Relationships Using SQL DDL

 INF: CreateControl() and CreateReportControl() Functions

 INF: Creating a Crosstab Query with Multiple Value Fields

 INF: Creating Fixed-Scale Graphs in Reports and Forms

 INF: Creating Floating Pop-Up Menus

 INF: Creating Mailing Labels for Dot-Matrix Printers

 INF: Creating Reports to Mail Merge Microsoft Access Data

 INF: Creating Virtual Indexes with SQL Data-Definition Queries

 INF: Criteria Parameters Require Concatenated References

 INF: Currency is Significant to Four Digits

 INF: Custom Domain Functions Similar to DFirst() and DLast()

 INF: DAO2016.DLL Not Available from External Applications

 INF: Data Source Dialog Box Does Not List ODBC Data Sources

 INF: Data Type of Value Overrides Data Type of Variable

 INF: Database Normalization Basics

 INF: dBASE SET DELETED Characteristic in Microsoft Access

 INF: DDE Link Cannot Find Data; Opens 2nd Copy of Server App

 INF: Debugging & Troubleshooting Tips for Attached SQL Tables

 INF: Defragment and Compact Database to Improve Performance

 INF: DeleteControl, DeleteReportControl, and CreateGroupLevel

 INF: Deleting Duplicate Records from Two Tables

 INF: Deleting Objects in Access Basic

 INF: Description of Btrieve

 INF: Description of Btrieve Section of WIN.INI File

 INF: Description of Btrieve/Xtrieve .DDF files

 INF: Description of the Visual Basic Compatibility Layer

 INF: Description of Vendor Independent Mail (VIM)

 INF: Determining How Many Instances of Application Are Active

 INF: Differences Between Native and Attached Tables

 INF: Displaying List or Combo Boxes with More Than One Field

 INF: Displaying Start, Finish, and Elapsed Times on a Form

 INF: DLookup() Usage, Examples, and Troubleshooting Tips

 INF: DoCmd Statement in Transaction Not Affected by Rollback

 INF: DoEvents, SendKeys May Not Be Supported in UDFs

 INF: Eliminating White Space in Reports with CanShrink and AB

 INF: Enforcing Transactions on Attached SQL Server Tables

 INF: Error Message Using AutoKeys Macro

 INF: Error Message with Blank or Incorrect Data Type

 INF: Error Messages May Be Caused by International Setting

 INF: Error Messages When Concatenating Variables or Controls

 INF: Error Msg "Operation Not Supported on Paradox Table..."

 INF: Error Msg: Cannot Hide the Control that Has Focus

 INF: Error When Opening Table in Table Design View

 INF: Error() Function Does Not Return Detailed Information

 INF: Errors When RunSQL Action Argument Exceeds 256 Characters

 INF: Explanation of Compliance Checking Program (CCP)

 INF: Explanation of the KeepTogether Property for Sections

 INF: Export Btrieve Table Without Existing Xtrieve FILE.DDF

 INF: Exporting Queries to ASCII

 INF: Exporting WordPerfect Secondary Files to Microsoft Access

 INF: Expressions to Count Yes, No, and Other Responses

 INF: Extend Mode and ESC in Form View

 INF: Field and Record Validation Rule Enforced at Engine Level

 INF: Fill New Record with Data from Prev. Record Automatically

 INF: Filling a Multiple-Column List Box Using Access Basic

 INF: FindEOM() Sample Function to Find Last Day of Month

 INF: Finding the OLE ClassKey of an Embedded Object

 INF: Force MS Access to Use "Snapshot" Mode for Attached Data

 INF: Form and Report Modules Have Local Scope

 INF: Form OnOpen Property May Not Set Unbound Control Values

 INF: Formatting a Label for Each Axis of a Graph

 INF: Formatting Immediate IF (IIF) Statements in Reports

 INF: Four Ways to Move to a Record from a Combo Box Selection

 INF: Function to Determine Retail or Run-Time Version

 INF: Function to Show Date/Time as Hours, Minutes, and Seconds

 INF: Functions to Left and Right Pad Character Strings

 INF: Hiding the Database Window Menu Bar

 INF: Hints for Printing Mailing Labels

 INF: How First Line of Data is Used to Import Delimited Text

 INF: How Microsoft Access Deletes Objects from a Database

 INF: How Microsoft Access Uses SHARE.EXE

 INF: How MS Access Variable-Length Fields Export to dBASE

 INF: How to Activate an Application with Class Name

 INF: How to Add a User to a Group with CreateUser Method

 INF: How to Add an Icon to Program Manager Using DDE

 INF: How to Base Subforms on SQL Pass-Through Queries

 INF: How to Calculate a Credit Card Expiration Date

 INF: How to Calculate Averages That Exclude Zero Values

 INF: How to Call Functions Using a String Variable

 INF: How to Call the Windows Help Search Dialog Box

 INF: How to Change the "Microsoft Access" Window Caption

 INF: How to Change the Caption on the Microsoft Access Window

 INF: How to Change the Font for the Zoom Box

 INF: How to Change the Order of Columns in a Graph

 INF: How to Change the Status Bar Text Using SysCmd()

 INF: How to Check a Menu Item Using Access Basic

 INF: How to Check for Duplicate Values in Primary Key Fields

 INF: How to Communicate with NetDDE

 INF: How To Compute Moving Averages in Access Basic

 INF: How to Convert Currency or Numbers into English Words

 INF: How to Convert To and From Unsigned Integers

 INF: How to Convert Twips to Pixels

 INF: How to Correctly Back Up Multiuser Databases

 INF: How to Create a "Please Wait" Message

 INF: How to Create a Custom Startup "Splash" Screen

 INF: How to Create a Custom Toolbar Using a Form

 INF: How to Create a Cyclic Tab Order in a Form

 INF: How to Create a Graph Bound to Two Combo Boxes

 INF: How to Create a Multiuser Custom Counter

 INF: How to Create a Parameter In() Statement

 INF: How to Create a Running Sum on a Form

 INF: How to Create an SQL Pass-Through Query in Access Basic

 INF: How to Create an Undo Record Button on a Form

 INF: How to Create and Use Subqueries

 INF: How to Create Custom Domain Function Similar to DCount()

 INF: How to Create Custom Navigation (VCR) Buttons on a Form

 INF: How to Create Do While/Do Until Loops in a Macro

 INF: How to Create For Next Loops In a Macro

 INF: How to Create Synchronized Combo Boxes

 INF: How to Create Tasks in MS Project for Windows Using DDE

 INF: How to Create, Debug, and Use a Microsoft Access Library

 INF: How to Declare C++ Functions Called from Access Basic

 INF: How to Delete Duplicate Records from a Table

 INF: How to Determine If a Form Exists in a Database

 INF: How to Determine if a Specific Windows Program Is Running

 INF: How to Determine If a Table or Query Exists

 INF: How to Determine If Current Database Is Open Exclusively

 INF: How to Determine Number of Working Days Between Two Dates

 INF: How to Determine the Current Screen Resolution (Size)

 INF: How to Determine Version of INSTCAT.SQL File on Server

 INF: How to Dial a Phone Number in Microsoft Access

 INF: How to Dim (Gray) Menu Items with Access Basic

 INF: How to Direct DDE to a Specific Instance of a Server

 INF: How to Disable PAGE UP and PAGE DOWN Keys in a Form (2.0)

 INF: How to Display Immediate Window Without Module Window

 INF: How to Display Intervals Greater Than 24 Hours

 INF: How to Dynamically Create a Filter

 INF: How to Edit Library Databases

 INF: How to Fill an Array Using Access Basic

 INF: How to Fill Text Boxes on a Report with Access Basic

 INF: How to Filter a Subform by Changing the Record Source

 INF: How to Find a Record in a Form Using Access Basic

 INF: How to Find a Record Using a Bound Control (2.0)

 INF: How to Find Access Basic Error Codes

 INF: How to Find If an Object Exists in the Database

 INF: How to Find the Number of Days In a Month

 INF: How to Find the Windows and System Paths

 INF: How to Float Windows on Other Windows

 INF: How to Force a New Line in a MsgBox Statement

 INF: How to Get and Use the Microsoft Access Window Handle

 INF: How to Get Field Data Types from a Table Using DDE

 INF: How To Get Microsoft Works Files into Microsoft Access

 INF: How to Get Record Position Number from Record Selector

 INF: How to Get Red, Green, or Blue Components from RGB Value

 INF: How to Get the Last Two Digits of the Year

 INF: How to Get the Name and Path of the Current Database

 INF: How to Give Users the Ability to Change Passwords

 INF: How to Group Column Headings in a Crosstab Query

 INF: How to Hide Objects In the Database Window

 INF: How to Hide the Database Window at Startup

 INF: How to Import a Data File to a Control on a Form

 INF: How to Import a Microsoft Windows Cardfile Data File

 INF: How to Import FoxBase for Macintosh Files

 INF: How To Import or Attach Paradox for Windows 1.0 Files

 INF: How to Import Several dBASE Databases Simultaneously

 INF: How to Index an Existing Field with DAO

 INF: How to Launch MS Wizards with WLib_WizMain() Function

 INF: How to Make a Combo Box Default to First Item in List

 INF: How to Make the Immediate Window Available at All Times

 INF: How to Make Welcome to MS Access Opening Screen Display

 INF: How to Minimize, Maximize, and Restore Microsoft Access

 INF: How to Not Display the Form Name in the Caption Bar

 INF: How to Open UTILITY.MDA

 INF: How to Optimize Microsoft Access Version 2.0 Performance

 INF: How to Optimize Microsoft Access Version 2.0 Queries

 INF: How to Optimize MS Access Using ODBC Data Sources

 INF: How to Order Data in a Graph

 INF: How to Pass an Array As an Argument to a Procedure

 INF: How to Play .WAV Sounds on Events in Microsoft Access

 INF: How to Position Microsoft Access on the Screen

 INF: How to Print a Conditional Page Header in a Report

 INF: How to Print a Single Record from a Form in a Report

 INF: How to Print Duplicate Mailing Labels for Each Record

 INF: How to Print Odd or Even Pages of a Report

 INF: How to Print Text to Default Printer with Access Basic

 INF: How to Programmatically Embed or Link an Object in a Form

 INF: How to Query an Oracle Table Without Attaching It

 INF: How to Query SQL Server Tables Without Attaching

 INF: How to Remove Attached Tables with a Macro

 INF: How to Remove the Menu Bar from a Form

 INF: How to Repair a Damaged Database

 INF: How to Replace a String with Another String

 INF: How to Retrieve Information from the Clipboard

 INF: How to Retrieve the Path of an Attached MS Access Table

 INF: How to Retrieve Windows For Workgroups User Information

 INF: How to Return Records in a Many-to-Many Relationship

 INF: How to Run Access Basic Functions with DDE

 INF: How to Search for Characters or Strings in Records

 INF: How to Search the CompuServe Knowledge Base

 INF: How to Select Controls on Subforms with SetFocus Method

 INF: How to Select More Than One Item from a List Box

 INF: How to Send Information to the Clipboard

 INF: How to Shell to a Windowed MS-DOS Application

 INF: How to Skip Used Mailing Labels and Print Duplicates

 INF: How to Specify a Custom Starting Page Number for a Report

 INF: How to Speed Up Iterative Processes in Access Basic

 INF: How to Start the AutoDialer Without the Toolbar Button

 INF: How to Start the Mail Merge Wizard Without the Toolbar

 INF: How to Synchronize Two Combo Boxes on a Form

 INF: How to Take a Control Out of the Tab Order

 INF: How to Trap Keystrokes that Leave a Control on a Form

 INF: How to Uninstall Microsoft Access Version 2.0

 INF: How to Update a Table Based on Values in a Second Table

 INF: How to Use a Query to Filter Unique Data

 INF: How to Use a Toggle Button to Hide and Display a Subform

 INF: How to Use Aggregate Functions in a Query

 INF: How to Use Command Line Switches

 INF: How to Use Criteria Queries Without Join Lines

 INF: How to Use DAO to Assign or View Permissions

 INF: How to Use DataPerfect Data in Microsoft Access

 INF: How to Use DDE to Communicate with a Run-Time Application

 INF: How to Use DDE to Fill a List Box

 INF: How to Use DDE to Pass Information to MS Access v. 2.0

 INF: How to Use Get, WritePrivateProfileString

 INF: How to Use Graphic Images as Wallpaper for Forms

 INF: How to Use In-Place Activation with OLE Objects

 INF: How to Use OLE Automation to Transfer Data to MS Excel

 INF: How to Use Seek Method with Multiple-Field Index

 INF: How to Use SendKeys in a Macro to Change an OLE Link

 INF: How to Use the Attributes Property for TableDef Objects

 INF: How to Use the ColumnWidth Property

 INF: How to Use the GetSystemMetrics() API Call

 INF: How to Use the IIf() (Immediate If) Function

 INF: How to Use the LIKE Operator in Parameter Queries

 INF: How to Use the Parent Property of a Subform

 INF: How to Use the Query by Form (QBF) Technique

 INF: How to Use the Quit Macro Action

 INF: How to Use the Status Bar Progress Meter

 INF: How to Use the Windows OpenFile Dialog Box

 INF: How to Use TimeValue() to Calculate Difference in Times

 INF: How to Wait for a Shelled Process to Finish

 INF: Implementing Counter Values on Attached SQL Server Tables

 INF: Import/Export Accepts Only 24-Hour Time Format

 INF: Imported Microsoft Excel Date Fields Are Off by 4 Years

 INF: Importing an Entire Sheet from a MS Excel 5.0 Workbook

 INF: Importing DataEase Data Files

 INF: Importing Word Print Merge Data Files to Microsoft Access

 INF: Importing, Exporting, and Attaching FoxPro 2.0, 2.5 Data

 INF: Incrementing the Numeric Portion of a String

 INF: Introduction to Windows Programming for MS-DOS Programmer

 INF: Join Type Mismatch Errors Caught at Runtime

 INF: Like vs. = with Wildcard Characters in Query Searches

 INF: Limitations on Setting Report Properties at Run Time

 INF: LimitToList Property Set to Yes Needs a Unique Entry

 INF: Links to Formatted DDE Items Result in Text

 INF: List of Articles Relating to MSACCESS.INI File

 INF: List of Categories and Examples from SOLUTION.MDB

 INF: List of Constants in Macros and Modules

 INF: List of OLE 2.0 Features Supported in MS Access v. 2.0

 INF: Macro to Check for Duplicate Values in a Field

 INF: Macro to Enter Date Record Was Last Modified

 INF: Maximum Number of Rows in Table When Counter is the Key

 INF: Microsoft Access 2.0 Disk Contents (3.5", 1.44 MB)

 INF: Microsoft Access 2.0 Readme Help File Contents

 INF: Microsoft Access 2.0 Wizards Use More Global Memory Space

 INF: Microsoft Access and ORACLE ODBC Drivers

 INF: Microsoft Access and Untested Networks

 INF: Microsoft Access Does Not Use Record Numbers

 INF: Microsoft Access, Scanners, and Scanning Software

 INF: Microsoft Graph Changes May Not Be Retained

 INF: MS Access Saves Printer Information with Each Form/Report

 INF: Network Users Can Open Their Own SYSTEM.MDA Exclusively

 INF: New Events and Properties in Microsoft Access v. 2.0

 INF: New ODBC Driver for Microsoft Access Version 2.0

 INF: New Version Argument for DoMenuItem in Version 2.0

 INF: No Custom Printer Setup for Mailing Labels ReportWizard

 INF: No Permission to Modify Data in a Table

 INF: Norton Desktop 1.x Not Compatible with Microsoft Access

 INF: Number of Times a Custom Function Executes in a Query

 INF: Obtain Name of Current User Database Using Access Basic

 INF: ODBC Setup for Microsoft Access and SQL Server

 INF: OpenDatabase and CloseDatabase Pseudo Actions

 INF: Opening Databases as Read-Only Causes Error Message

 INF: OpenTable Method on Attached Table Causes Error

 INF: Overview of Conversion Issues from Version 1.1 to 2.0

 INF: Overview of MS Access Developer's Toolkit (ADT) v. 2.0

 INF: Overview of New Query Features in Version 2.0

 INF: Overview of Version 2.0 Add-Ins, Builders, and Wizards

 INF: Page Header Will Span Full Width Of Multi-Column Report

 INF: Page Locking, No Cluster Indexing Support

 INF: Paradox 4.x OLE Field Names Visible Only

 INF: Paradox Tables, Indexes, and Multiple Connections

 INF: Part 1: DDE in Visual Basic to Request MS Access Data

 INF: Part 2 DDE in Visual Basic to Request Data from MS Access

 INF: Passing Values from a Form to a Parameter Query

 INF: Placing the User Login Name on a Form or in the Title Bar

 INF: Print a Sequential Number for Each Record/Group on Report

 INF: Printing Microsoft Access Reports on HP Laserjet II

 INF: Programmatically Add Counter Field to Table Using DAO

 INF: Query by Form (QBF) Using Dynamic QueryDef

 INF: Query with Parameters to Evaluate Complex Criteria

 INF: Questions and Answers About .LDB Files

 INF: Reading, Storing, & Writing Binary Large Objects (BLOBs)

 INF: README.TXT File and Novell Locking Issues

 INF: Relationship Between Btrieve and Microsoft Access

 INF: Reporting the Median Value of a Group of Records

 INF: Requery Control Err Msg: There Is No Control Called...

 INF: Requery, Repaint, and Records Refresh

 INF: Requirements to Connect to SYBASE SQL Server

 INF: Reserved Words in Microsoft Access

 INF: Returning Case-Sensitive Match in Queries

 INF: Row Fix-up in the NWIND.MDB Order Form

 INF: Running a MS Access Macro from Visual Basic Using DDE

 INF: Running MS-DOS SHARE with Windows for Workgroups

 INF: Sample DDE Macro Communicates with Microsoft Excel 4.0

 INF: Sample Expressions to Extract Portion of Text String

 INF: Sample Function CopyFile() to Copy Disk Files

 INF: Sample Function to Build a Repeating String

 INF: Sample Function to Capitalize Words and Phrases

 INF: Sample Function to Determine the Access Startup Directory

 INF: Sample Function to Determine the Existence of a Query

 INF: Sample Function to Find File Associations

 INF: Sample Function to Generate a Random Temporary File Name

 INF: Sample Function to List Groups in System Database

 INF: Sample Function to Make ENTER Add Lines in a Text Box

 INF: Sample Function to Open a Form to a Particular Record

 INF: Sample Function to Provide Password for Attached Tables

 INF: Sample Function to Remove Alphas from a Numeric Field

 INF: Sample Function to Replace Special Characters

 INF: Sample Function to Return a Random Record

 INF: Sample Function to Return Variable's Data Type Name

 INF: Sample Function to Use the COMMDLG Color Dialog Box

 INF: Sample Functions to Send MCI Commands from Access Basic

 INF: Sample Macro for Repair/Compact Operations

 INF: Sample Macro to Reset Page Number on Group Level Report

 INF: Sample Table Design to Support Questionnaire Applications

 INF: Screen Fonts May Not Match Printer Output Fonts

 INF: Security Settings for Modifying Data in a Query Dynaset

 INF: Sending a MAPI Mail Message Using Access Basic

 INF: Set Focus to a Subform Control Using GoToControl Action

 INF: Setting a Database's V1xNullBehavior Property

 INF: Shortcut Method for Creating an SQL Union Query

 INF: Showing All Records (Including Null) in a Parameter Query

 INF: Shrinking Empty or Null OLE Object on Report

 INF: Snapshot and Underlying Table Updated Until Snapshot Full

 INF: Sort Order of Union Queries Affected by ALL Predicate

 INF: Sorting String Values Based on their Numeric Values

 INF: Sorting Titles Without Leading Articles (The, An, etc.)

 INF: Sorting/Grouping a Query Using a Portion of Field's Value

 INF: SQL Server Triggers and Key Values to and from MS Access

 INF: SQL Server Views Read-Only When Attached

 INF: Storing SQL Database Login IDs and Passwords Locally

 INF: Summary List of Known Issues for Version 2.0

 INF: System Objects Retain System Object Properties

 INF: Table Permissions Changes Not Effective with Open Form

 INF: Temporarily Disabling a Macro Action

 INF: Three Methods for Testing the VBCL

 INF: Tile, Cascade Menu Options Inconsistent with Prog Manager

 INF: Tips for Debugging Access Basic Code

 INF: Tips for Improving Combo and List Box Performance

 INF: Tips for Improving Subform Performance

 INF: Tips for Optimizing Queries on Attached SQL Tables

 INF: Tips on How to Troubleshoot Microsoft Access Macros

 INF: Topics Supported by Microsoft Access as a DDE Server

 INF: TraceSQLMode Setting Helps Debug SQL Queries to ODBC

 INF: Transparent Text Boxes Not Supported

 INF: Trapping SQL Server RAISERROR() Function Values

 INF: Troubleshooting Setup and Installation Problems

 INF: Troubleshooting Tips for Error Values

 INF: Two Functions to Calculate Age in Months and Years

 INF: Two Methods to Refer to a Field in a Previous Record

 INF: Understanding Event Order in MS Access 2.0

 INF: Unexpected Stored Procedures Found in SysObjects Table

 INF: Updating One Table with Data from a Second Table

 INF: Updating, Troubleshooting Novell NetWare VLM Installation

 INF: Upper Limit for QueryTimeout and LoginTimeout Parameters

 INF: Use a Query to Parse a Full Name into Two Fields

 INF: Use Append Query to Set Initial Value of Counter Field

 INF: Use AutoLookup Technique to Look Up Info. Automatically

 INF: Use SendKeys Macro Action to Open Combo Box Automatically

 INF: Users Can Edit but Not Commit Read-Only OLE Objects

 INF: Using "<", ">", and "=" Operators in Query Parameters

 INF: Using "Name" in Expressions

 INF: Using a Conditional Macro to Confirm Changes to a Field

 INF: Using a Form Reference Parameter Query in Access Basic

 INF: Using Access Basic to Derive a Statistical Median

 INF: Using Column Property of Combo Box to Update Text Box

 INF: Using Data from MS Access in a WordPerfect Mail Merge

 INF: Using Date/Time Data Type and Calculating Elapsed Time

 INF: Using Find Method to Find a Quotation Mark or Apostrophe

 INF: Using Microsoft Access 2.0 Databases with Visual Basic

 INF: Using Microsoft Access Macro to Quit Windows

 INF: Using Microsoft Word to Edit and Spell Check Memo Field

 INF: Using SetSysModalWindow API Call in Access Basic

 INF: Using SHARE.EXE and VSHARE.386 with Microsoft Access 2.0

 INF: Using SQL Server ODBC Driver with Sybase Servers

 INF: Using the AllowZeroLength and Required Properties

 INF: Using the DDE Item SQLText to Request the Text of a Query

 INF: Using the Generic Print Driver with Forms/Reports

 INF: Using the INSTCAT.SQL Script with an ODBC Application

 INF: Using the Scroll Bar Control to Move Through Records

 INF: Using the Windows 3.1 API to Connect to Network Resources

 INF: Using Undocumented CreateForm(), CreateReport() Functions

 INF: Using Variables in the Criteria Row of the QBE Grid

 INF: Using Version 1.1 Databases in Version 2.0

 INF: Using WIN.INI & ODBC.INI When Attaching SQL Server Table

 INF: Validation Rule to Accept Only Alphabetic Characters

 INF: Validation Rule to Require Uppercase in a Field

 INF: Word for Windows Print Merge Using Microsoft Access Data

 INF: Writing Functions Called from Events or Expressions

 INF: Xtrieve Data Dictionary (.DDF) File Information

 PRA: "#" Character in Input Mask Causes Unexpected Behavior

 PRA: "Internal Database Error -1310" Executing Large Query

 PRA: "Invalid Method in Expression in Query Expression" Error

 PRA: "Unexpected Error from External Database Driver [7]"

 PRA: 1.x Table/Query Datasheet Properties Not Converted to 2.0

 PRA: ADT Application Setup Fails with Error -1809

 PRA: Calendar Control Font and Color Properties Unavailable

 PRA: Cannot Connect to SQL Server w/ NetWare, Workgroups

 PRA: Cannot Convert Database with Same Name and Path

 PRA: Cannot Export Paradox/dBase Tables

 PRA: Changes to Linked Object Do Not Update Source Properties

 PRA: Changes to Print Setup Not Saved with Form or Report

 PRA: Code Called from OnFormat Creates Endless Formatting

 PRA: Converted Database Shows Incorrect Macro Definitions

 PRA: Datasheet Header and Footer Print at Constant Locations

 PRA: Device Independent Bitmap in Paste Special Dialog Twice

 PRA: Empty Recordset Report Hangs with Group KeepTogether

 PRA: ERR: Undefined Function Referencing Column Property

 PRA: Error "Setup Cannot Create SYSTEM.MDA File (-1809)"

 PRA: Error Adding Zero-Length String to SQL NOT NULL Column

 PRA: Error Deleting Value from Attached SQL Server Table

 PRA: Error In SQL Pass-Through Action Query Not Detected

 PRA: Error Previewing Subreports that Call Filter Macro

 PRA: Error When Import dBASE, FoxPro, or Paradox Table

 PRA: Extra White Space Between Last Section and Report Footer

 PRA: Find Does Not Locate Existing Item in dBASE Database

 PRA: GP Fault with MS Packager Object in Bound OLE Field

 PRA: GPF Closing Data Outline Control Properties Box

 PRA: GPF Using GetChunk Method as Argument for Put Statement

 PRA: GPF Using List Box Fill Function with Requery Method

 PRA: Graph 5.0 Legend Moves Each Time Graph Is Refreshed

 PRA: Help Topic "Converting Code" Sample Code Incorrect

 PRA: Installing MS Access with NT Creates New Program Group

 PRA: Mailing Label Wizard Creates One-Page Report

 PRA: Menu Bar Does Not Change When Closing Modal Pop-Up Form

 PRA: MS Access Setup Under MS Windows NT 3.1 Requires a Mouse

 PRA: No Serial Number In the About Microsoft Access Dialog Box

 PRA: Null Boolean Values Default to False

 PRA: ODBCTimeout Ignores MSACC20.INI ODBC Setting

 PRA: ODBCTimeout Set to Zero for New Pass-Through Queries

 PRA: OLE Objects Clipped Using Fahrenheit Video Driver

 PRA: OLE Objects Seem to Be Acceptable Filter Criteria

 PRA: OnError Property Does Not Trap Locking Error in Form

 PRA: Open OLE Objects Not Saved When Record Changes

 PRA: Options in Form and Report Wizards Are Not Displayed

 PRA: Oracle Driver Errors on Delimited Column Names

 PRA: Ownership of 1.x Objects Can Be Changed with 2.0 DAO

 PRA: Paradox Password Protection Bypassed by Multiple Users

 PRA: Printer Fonts Cause Text to Shift Down and Right

 PRA: Report Section with Subreport Not Included In Output File

 PRA: Reserved Error -1001 with Linked Crosstab Subreport

 PRA: RunningSum Text Box in Report Not Accumulating Values

 PRA: Selecting Options in Find Dialog Box

 PRA: Sent Keys Lost if Microsoft Access Yields Processor

 PRA: Setup Cannot Recognize Forward Slash in Path

 PRA: SQORA.DLL Does Not Allow Lengthy SQL Statements

 PRA: TransferDatabase Fails in Code, Not in Immediate Window

 PRA: Update or Delete Query Fails Without Generating Error

 PRA: Windows Setup Ignores ADK, ADT applications

 PRB:  GoToRecord Macro Does Not Work on Subform

 PRB: "#Error" Message Referencing Subreport Values (2.0)

 PRB: "#ERROR" Message When Referencing Subreport Controls

 PRB: "#NAME?" Error Referring to Combo Box Column in Subform

 PRB: "Btrieve-Out of Resources" Error Msg with Attached Table

 PRB: "Couldn't Find File WIZARD.MDA" Error Message

 PRB: "Couldn't Find Installable ISAM" Error Message

 PRB: "Couldn't Find Object <Tablename>" Error with Btrieve

 PRB: "Couldn't Lock File; SHARE.EXE Hasn't Been Loaded" Error

 PRB: "Couldn't Open File" Error Message Using Paradox Table

 PRB: "Couldn't Update; Currently Locked by User" Error Message

 PRB: "Field0" Appears in a Query But Not in the Source Table

 PRB: "Internal Database Error (-5001)" Msg Using Btrieve NLM

 PRB: "Invalid String or Buffer Length" Using Raima ODBC Driver

 PRB: "Invalid Use of Null" or "#Error" in Defined Function

 PRB: "Not Enough Memory to Run SETUP.EXE" Error Message

 PRB: "Obsolete Database Format" Error Message from MS Query

 PRB: "ODBC Call Failed" When Exporting Table to SQL Server

 PRB: "ORA-00904: Invalid Column Name" Error Message in Query

 PRB: "Out of Memory" Error Message Loading Large Module

 PRB: "Out of Memory" or "Query Too Complex" Running Report

 PRB: "Out of Stack Memory" Error Message with SendKeys Macro

 PRB: "Output To" of Print Definition Contains Only Headers

 PRB: "Page, Pages Properties" Help Topic Misleading

 PRB: "Record Lock Threshold Exceeded" with Large Action Query

 PRB: "Save Changes to Form" Prompt When No Changes Made

 PRB: "Setup Parse Error..." Error Message in Run-Time Setup

 PRB: "Table Exclusively Locked" Error Switching to Form View

 PRB: "Unexpected Error from External Database Driver [20]"

 PRB: "Unexpected Error from External Database Driver [22]"

 PRB: #Error When Control Name Used in ControlSource Expression

 PRB: 'Unable to Load Communication Module'

 PRB: AccessWizards Button Unavailable

 PRB: Activate, Deactivate Events Do Not Occur on Pop-Up Form

 PRB: Adding Records to AutoLookup Form Generates Error

 PRB: AddNew Method Uses Table Default Values

 PRB: Append Query Results in Duplicate Counter Numbers

 PRB: Avery 4xxx-Series Labels Do Not Work on Laser Printer

 PRB: BeforeUpdate and AfterUpdate Field Properties Not Working

 PRB: BeforeUpdate Macro Running Twice

 PRB: Bitwise AND Operator with Hex Values Results Incorrect

 PRB: Bound OLE Object Blank in Form View

 PRB: Bound SubReport Does Not Show DDE Data

 PRB: Btrieve Files Created with Btrieve 6.0 NLM Not Supported

 PRB: Btrieve ISAM Is Not Installed with Typical Setup

 PRB: Canceling a DoCmd Print Returns Error Messages

 PRB: Cannot Add Security Items to Custom Menu

 PRB: Cannot Attach Paradox Table on Read-Only Drive

 PRB: Cannot Change Combo Box Value If ControlSource Is Counter

 PRB: Cannot Change Some Properties of Attached Tables

 PRB: Cannot Choose Custom Bitmap for Toolbar Button

 PRB: Cannot Connect DDE from Word 6.0 to Microsoft Access

 PRB: Cannot Delete Admin User

 PRB: Cannot Delete Item When You Exit a LimitToList Combo Box

 PRB: Cannot Display More Than 4 Graph Objects At One Time

 PRB: Cannot Enforce Referential Integrity in Relationship

 PRB: Cannot Open Datasheet as a Pop-Up or Modal Form

 PRB: Cannot Open Multiple Instances of the Same Form

 PRB: Cannot Open Paradox 4.x Table

 PRB: Cannot Perform OpenTable Method on an Attached Table

 PRB: Cannot Run Setup for Solutions Pack on Workstation

 PRB: Cannot Save a Blank Record in a Table or Form

 PRB: Cannot Sum Calculated Controls in Forms or Reports

 PRB: Cannot Use "y," "n," "t," or "f" in Yes/No Field

 PRB: Close Action from Function Does Not Trigger OnClose Error

 PRB: Closing Forms, Tables, or Queries Is Slow

 PRB: Color Builder Does Not Save Custom Colors

 PRB: Column Widths in Table Design Not Saved

 PRB: Concatenation of Memo Fields Creates Text Field

 PRB: Counter Starts at 2 in Table Created by Make-Table Query

 PRB: Creating Multiple New Import/Export Specifications

 PRB: Data Not Sorted In Index Field Order

 PRB: Databases Truncated with LAN Manager 2.1a and Earlier

 PRB: DateAdd() "w" Interval Does Not Work As Expected

 PRB: DateDiff "W" Option Does Not Work

 PRB: DateDiff() Function Returns Incorrect Value

 PRB: DDEPoke to Word for Windows Incorrectly Formatted

 PRB: DebugLibraries=True Instead of DebugLibraries=Yes

 PRB: Default Width in Report Design Does Not Reflect Margins

 PRB: Detail Section Blank When Form Is Printed or Previewed

 PRB: DFirst() and DLast() Functions Return Unexpected Records

 PRB: Duplicate Procedure Errors After Installing OUTPUTAS.MDA

 PRB: Edit Find Dialog Box Is Modal in Form View

 PRB: Empty Field List in Report or Form's Design View

 PRB: Empty Row in List Box Can Be Selected

 PRB: Empty Table List When Attaching Btrieve Table

 PRB: Err Msg "The Other Application Quit" with MS Excel 4.0

 PRB: Err: "Data Source Not Found, No Default Driver Specified"

 PRB: Error in FontBold Property Help Menu Topic

 PRB: Error In Help Files for Custom Control Refresh Method

 PRB: Error Message "Couldn't Find Input Table or Query"

 PRB: Error Message "Couldn't Find Object [Object Name]"

 PRB: Error Message "Couldn't Open File" in Shared Environment

 PRB: Error Message "Couldn't Open Table MSysAccounts"

 PRB: Error Message "Expression Is Too Long for the QBE Grid"

 PRB: Error Message "Unable to Connect to Data Source"

 PRB: Error Message When Importing Informix Delimited Text File

 PRB: Error Message When Opening Second Instance of .MDB File

 PRB: Error Message: Cannot Change Working Directory to Default

 PRB: Error Msg. "Error Occurred in WriteSTF" in Setup Wizard

 PRB: Error When Trying to Enforce Referential Integrity

 PRB: ESC While Creating Control Does not Deselect Control

 PRB: Every Other Page Blank in Printed Reports

 PRB: Export Table to Other Database Type Does Not Create Index

 PRB: Exporting Date Fields to Text Includes Time Format

 PRB: Exporting Table with OLE Object or Memo Field to Paradox

 PRB: Exporting to Fixed-Width Text File Left Justifies Numbers

 PRB: Exporting to SQL Server Does Not Create Indexes

 PRB: Field Object Type Property Returns "Invalid Operation"

 PRB: Floating Objects Can Cause Unusual Effects

 PRB: Fonts May Change Zooming Out in Print Preview

 PRB: Form Opened in Form View Is Completely Blank

 PRB: Form or Report Cannot Be Opened or Previewed

 PRB: Forms and Reports Print Slowly, Large Temporary Files

 PRB: Global Custom Menu Overrides Form or Report Custom Menu

 PRB: GoToControl to Control with Focus in AfterUpdate Ignored

 PRB: GP Fault Using an Out of Date ODBC Driver

 PRB: GPF with Diamond Viper VESA Local Bus Video Driver V1.01

 PRB: Graph Object Is Dimmed in Form View

 PRB: HelpContextID Property Accepts Valid Negative Values

 PRB: Hewlett-Packard Dashboard GP Faults in Microsoft Access

 PRB: Hourglass May Not Change After Illegal Function Call

 PRB: How the Scaling Property Affects Embedded MS Draw Object

 PRB: Imported MS Excel Carriage Returns Become Vertical Bars

 PRB: Incorrect Catalog Stored Procedures Error Message

 PRB: Input Mask Character (!) Does Not Work Correctly

 PRB: Insert Object Dirties Record

 PRB: Invalid Path Error Message Using UNC with 10+ Characters

 PRB: Invalid Reference to Field '<Value>' Using SetValue

 PRB: Invalid Use of Null Alert Assigning Null Control

 PRB: Irregular Characters in Attached dBASE IV Memo Field

 PRB: Join Is Broken by Value(s) in Fields '[Field Name]'

 PRB: Launching MS Access 2.0 Help Returns Error Message

 PRB: List Box Column Property Gets Incorrect Row Information

 PRB: List Box Not Dimmed When Disabled

 PRB: Locking First Record Also Locks Last Record

 PRB: Macro Condition Evaluates True if Control Is Null

 PRB: Macro on Subform Control Executed by Main Form

 PRB: Macro with Two SendKeys Actions Loops Infinitely

 PRB: Make-Table Query Causes Existing Table to Be Deleted

 PRB: Make-Table Query Does Not Copy Field Descriptions

 PRB: Margins Do Not Relate to Printable Area

 PRB: Minimizing Pop-Up and Modal Form Loses Application Focus

 PRB: Network Problems May Cause "Segment Load Failure" Error

 PRB: No AutoRepeat with GoToRecord/Next and DoMenuItem

 PRB: No Implicit Parameters on Crosstab Queries

 PRB: No Password Prompt Using Microsoft Access .MDB with ODBC

 PRB: No Prompt for Second Parameter in Query

 PRB: Null Value Does Not Pass Validation Rule

 PRB: Nulls Not Concatenated with "+" Operator

 PRB: Objects Cannot Be User-Defined Data Type Elements

 PRB: Office Manager 4.2 Will Not Load Microsoft Access 2.0

 PRB: OnChange Property Not Triggered with Combo Box Selection

 PRB: OnExit Macro Runs with AfterUpdate Macro in Option Group

 PRB: Opening a Database Read-Only Forces Others to Read-Only

 PRB: Operation Stops when Editing Attached SQL Tables

 PRB: Option Button Appears Fuzzy in Datasheet View

 PRB: Out of Disk Space Error Makes Paradox Table Unusable

 PRB: Out Of Memory When Pasting Text Into Module

 PRB: Parameter Limit for Access Basic Functions in Validation

 PRB: Paste Unavailable After Record Is Copied to Clipboard

 PRB: Permissions Command Unavailable When Logged in as Guest

 PRB: Printing on Avery 5267 labels

 PRB: Prompt to Save Libraries After Replace Operation

 PRB: Query by Form Returns No Rows When All Rows Expected

 PRB: Query Information Lost Switching to SQL-Specific Query

 PRB: Raised and Sunken Check Box and Option Button Controls

 PRB: Record Sort Order Is Different Than Expected

 PRB: RecordCount Property Incorrect Using OpenTable Method

 PRB: RecordCount Property Returns Incorrect Number of Records

 PRB: Removing User Admin from Admins Group Cannot Be Reversed

 PRB: Report or Form Bound to a Table Locks the Table

 PRB: Rounding Errors Importing/Exporting dBASE IV Values

 PRB: Rounding Errors Using Floating-Point Numbers

 PRB: SCSI Drives Can Generate Corrupt Error Loading Database

 PRB: Seek Method Is Faster Than Find Method

 PRB: SendKeys Macro Action Does Not Work on Toggle Keys

 PRB: SendKeys Macro Does Not Run

 PRB: SetWarnings Action Works Only While Macro Is Running

 PRB: Shortcut Menus Cannot Be Disabled In Microsoft Access

 PRB: Size To Fit Form Command Not Available

 PRB: Stacker 3.0 CHECK.EXE Reports Database Files as Corrupt

 PRB: Stored procedure 'PROCEDURE' not found -- Error Message

 PRB: Subform Control's OnExit Event Not Activated

 PRB: Subform Not Updated

 PRB: Subreport or Subform Data Missing from "Output To" Result

 PRB: System Error When Sharing Database on LAN Man/Workgroups

 PRB: Type Conversion Failure when Importing Excel Data

 PRB: Unable to Change Permissions (Security)

 PRB: Unable to Import Portion of Fixed-Width Text Files

 PRB: UndoCurrentRecord In BeforeUpdate Property Causes Error

 PRB: Unexpected Cursor Behavior in Text Box with Input Mask

 PRB: Unexpected Results with Make-Table or Append Query

 PRB: Union Queries Do Not Inherit Properties of Base Table

 PRB: Unknown Reference or Function in Validation Expression

 PRB: Update Query Based on Totals Query Fails

 PRB: Update Query on More than One Table Gives Inaccurate Data

 PRB: User Needs Read/Write Privileges for WORKDIR Directory

 PRB: User with Full Permissions Cannot Change a Query

 PRB: Using "MSACCESS" in DDE Initiate with Run-Time App

 PRB: Val() Function Returns "Invalid Use of Null" Message

 PRB: Validation Rules Evaluate Expressions in Unexpected Ways

 PRB: Wait Argument in SendKeys May Not Stop Macro Processing

 PRB: White Lines or Missing Data When Printing Reports

 PRB: Workstation Setup Option Not Available with DEC Pathworks

 PRB: Zoom Box Does Not Appear When SHIFT+F2 Is Pressed

 WX0994: Form and Report Questions and Answers

 WX0995: Table and Query Questions and Answers

 WX0996: Setup and Conversion Questions and Answers

 WX0997: Interoperability Questions and Answers

 WX0998: Macro and Module Questions and Answers

 WX0999: MS Access Dev. Toolkit Questions & Answers

 More Information on the Knowledge Base

 Survey for KB Help Users


More Information on the Knowledge Base
 Access 2.x Knowledge Base

 How to Query in the Knowledge Base (KB) Help File

 Knowledge Base Articles

 More Information on the Knowledge Base

 AAA: More Information on the Knowledge Base (KB) Help File

 Survey for KB Help Users


Survey for KB Help Users
 Access 2.x Knowledge Base

 How to Query in the Knowledge Base (KB) Help File

 Knowledge Base Articles

 More Information on the Knowledge Base

 Survey for KB Help Users

 AAA: Microsoft Access Knowledge Base Survey


INF: How to Query on Category Keywords

Article ID: Q119525

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version(s) 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Every Knowledge Base (KB) article contains a category and a subcategory.

You can query on the categories and subcategories to help you find specific

groups of articles. If you are using the KB Help file, you can use the Find

button on the toolbar to enter category queries.

The categories and subcategories are abbreviated and concatenated to form

unique words that you can query on. For example, FmsCmbo stands for Forms,

Combo/List Box, where Forms is the category and Combo/List Box is the

subcategory. Note that the first letter of the category and subcategory are

capitalized; this does not affect your queries, but makes it easier to

recognize the subcategory.

To display all the articles in a category, query on the category code with

a wildcard (for example, "Fms*"). To display all the articles in a specific

subcategory, query on the entire code (for example, "FmsCmbo"). You can use

the logical operator OR to query on more than one category or subcategory

(for example, "FmsCmbo OR FmsProp"). When you are looking for articles on a

specific subcategory it is often a good idea to include the Othr

subcategory as well--not all articles are put in the best possible

subcategory.

See the "References" section later in this article for information about

how to find a complete list of categories and subcategories for Microsoft

Access KB articles.

MORE INFORMATION

================

To query on one category, enter the category code and a wildcard. For

example, to display all Forms articles enter:

   Fms*

To query on more than one category, enter each category code with a

wildcard. For example, to display all the articles on Forms or Reports

enter:

   Fms* or Rpts* or Fmr*

To query on one subcategory, enter the complete code. For example, to

display all articles on Query, Joins enter:

   QryJoin

To query on more than one subcategory, enter all the complete codes. For

example, to display articles on Query, Joins and Query, Make Table enter:

   QryJoin or QryMktbl

You can also mix categories and subcategories in one query. For example, to

display articles on Reports, Labels and all Printing articles, enter:

   RptLabel or Ptr*

REFERENCES

==========

For a complete list of all the categories and subcategories used in

Microsoft Access KB articles, please see the following article in the

Microsoft Knowledge Base:

   ARTICLE-ID: Q119526

   TITLE     : INF: Microsoft Access KB Categories and Subcategories

For more information on how to query using the Find button, click the

Find button, then click the Hints button in the Search dialog box.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: KbCodes


INF: Microsoft Access KB Categories and Subcategories

Article ID: Q119526

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Every Knowledge Base (KB) article contains a category and a subcategory.

You can query on the categories and subcategories to help you find specific

groups of articles. The categories and subcategories are abbreviated and

concatenated to form unique words that you can query on. For example,

FmsCmbo stands for Forms, Combo/List Box, where Forms is the category and

Combo/List Box is the subcategory. Note that the first letter of the

category and subcategory are capitalized; this does not affect your

queries, but makes it easier to recognize the subcategory.

See the "References" section later in this article for information about

how to enter queries based on the categories and subcategories listed in

this article.

MORE INFORMATION

================

The following list contains all the categories and subcategories used in

Microsoft Access KB articles:

Conversion/Compatibility     2.0 Behaves Differently Than 1.x   CnvDif20

Conversion/Compatibility     Convert fails on a db              CnvNodb

Conversion/Compatibility     ConvertErrors table                CnvErtbl

Conversion/Compatibility     Errors while running Convert       CnvErrs

Conversion/Compatibility     General                            CnvGnrl

Conversion/Compatibility     Other                              CnvOthr

Conversion/Compatibility     Performance of Convert Utility     CnvPrfm

Conversion/Compatibility     Problems with conversion           CnvProb

Conversion/Compatibility     Rewriting/Optimizing for 2.0       CnvOpt20

Conversion/Compatibility     Running 1.x databases from 2.0     CnvRun1x

Conversion/Compatibility     Secured Databases                  CnvScrdb

Documentation/Sample Apps    Cue Cards                          DcmCucd

Documentation/Sample Apps    Help                               DcmHlp

Documentation/Sample Apps    Manuals                            DcmMnl

Documentation/Sample Apps    NWIND                              DcmNwd

Documentation/Sample Apps    Orders                             DcmOrds

Documentation/Sample Apps    Other                              DcmOthr

Documentation/Sample Apps    Solution                           DcmSltn

Environ/Config               GP Fault                           EvnGpf

Environ/Config               Hardware                           EvnHdwr

Environ/Config               Networks                           EvnNtw

Environ/Config               Operating System                   EvnOs

Environ/Config               Other                              EvnOthr

Environ/Config               Other Drivers                      EvnOdr

Environ/Config               System Performance                 EvnPrfm

Environ/Config               TEMP Directory                     EvnTemp

Environ/Config               TSR Problems                       EvnTsr

Environ/Config               Video Drivers                      EvnVido

Expressions                  Expression Builder                 ExrBldr

Expressions                  Functions                          ExrFnc

Expressions                  General                            ExrGnrl

Expressions                  Nulls and Zero-length strings      ExrNls

Expressions                  Other                              ExrOthr

Expressions                  Referencing Access Objects         ExrObj

Expressions                  String manipulation                ExrStrg

Forms (Specific)             Button Design Builder              FmsButb

Forms (Specific)             Combo/List Box                     FmsCmbo

Forms (Specific)             Combo/List Box Builder             FmsCmbob

Forms (Specific)             Custom Help/Help Compiler          FmsHlp

Forms (Specific)             Events (Calling Macro/Mods)        FmsEvnt

Forms (Specific)             Form Properties                    FmsProp

Forms (Specific)             How To                             FmsHowto

Forms (Specific)             Option Group Builder               FmsOptB

Forms (Specific)             Option Groups                      FmsOpt

Forms (Specific)             Other                              FmsOthr

Forms (Specific)             Problems                           FmsProb

Forms (Specific)             Requery/Refresh                    FmsRqry

Forms (Specific)             SubForm                            FmsSubf

Forms (Specific)             Wizard: AutoForm/Quick Form        FmsWiza

Forms (Specific)             Wizard: Main/Subform               FmsWizm

Forms/Reports (Common)       Code Behind Forms/Reports          FmrCdbeh

Forms/Reports (Common)       Code Builder                       FmrCodeb

Forms/Reports (Common)       Color Builder                      FmrColrb

Forms/Reports (Common)       Colors/Color Palette               FmrColr

Forms/Reports (Common)       Default Properties/Template        FmrProp

Forms/Reports (Common)       Field List                         FmrFld

Forms/Reports (Common)       How To                             FmrHowto

Forms/Reports (Common)       Other                              FmrOthr

Forms/Reports (Common)       Problems                           FmrProb

Forms/Reports (Common)       Toolbox                            FmrTlbx

FastTips Q&A scripts                                            Fstqa

General Functionality        Application Design                 GnlApp

General Functionality        Compact/Repair                     GnlCmp

General Functionality        Corrupted Database                 GnlBaddb

General Functionality        Data Entry/Editing                 GnlDe

General Functionality        Database Documentor/Print Def      GnlDbdoc

General Functionality        Encrypt/Decrypt                    GnlEncr

General Functionality        File Manipulation                  GnlFilem

General Functionality        Find/Replace                       GnlFnd

General Functionality        Formatting                         GnlFrmt

General Functionality        Global Settings (View Options)     GnlGlobl

General Functionality        Input Masks                        GnlInpt

General Functionality        MSACC20.INI                        GnlAcini

General Functionality        MultiUser/Locking                  GnlMu

General Functionality        Other                              GnlOthr

General Functionality        Performance Overall                GnlPrfm

General Functionality        Quick Sort                         GnlQksrt

General Functionality        Reserved Words                     GnlRsvd

General Functionality        Validation                         GnlValid

Interoperability             Custom Controls                    IntpCstm

Interoperability             DDE                                IntpDde

Interoperability             Graph                              IntpGrph

Interoperability             Mail (Send from File menu)         IntpMail

Interoperability             OLE                                IntpOle

Interoperability             OLE Automation                     IntpOlea

Interoperability             Other                              IntpOthr

Interoperability             Print Merge/Mail Merge             IntpPrtm

Interoperability             VB Mapping Layer                   IntpVb

Interoperability             Word 6.0/Merge It                  IntpWrd6

ISAM                         Btrieve                            IsmBtrv

ISAM                         Excel 2.0-4.0                      IsmExl4

ISAM                         Excel 5.0                          IsmExl5

ISAM                         Fox/xBase                          IsmXbase

ISAM                         General                            IsmGnrl

ISAM                         How To                             IsmHowto

ISAM                         Imp/Exp/Attach other Access MDBs   IsmIea

ISAM                         Import/Export Setup (specs)        IsmSetup

ISAM                         Import/Export Text (delimited)     IsmTxtd

ISAM                         Import/Export Text (fixed width)   IsmTxtfx

ISAM                         Lotus                              IsmLotus

ISAM                         Other                              IsmOthr

ISAM                         Paradox                            IsmPdox

ISAM                         Problems                           IsmProb

ISAM                         Works                              IsmWorks

Knowledge Base               Category Codes                     KbCodes

Macros                       Action Arguments                   McrArg

Macros                       Actions                            McrActn

Macros                       Condition Column                   McrCond

Macros                       General                            McrGnrl

Macros                       How To                             McrHowto

Macros                       Macro Builder                      McrBldr

Macros                       Macro Name                         McrName

Macros                       Other                              McrOthr

Macros                       Problems                           McrProb

Modules                      Adding/deleting records            MdlAdrec

Modules                      DAO                                MdlDao

Modules                      Declarations/DIM                   MdlDecl

Modules                      Editing Records                    MdlEdit

Modules                      Find Methods                       MdlFind

Modules                      General                            MdlGnrl

Modules                      Immediate Window                   MdlImmed

Modules                      Libraries (MDA)                    MdlLib

Modules                      Navigating                         MdlNav

Modules                      Other                              MdlOthr

Modules                      Performance                        MdlPrfm

Modules                      Problems                           MdlProb

Modules                      Querydefs                          MdlQry

Modules                      Recordsets                         MdlRcd

Modules                      Transactions                       MdlTran

Modules                      Using Bookmarks                    MdlBkmk

Modules                      VB Compatibility                   MdlVb

Non Product                  Chatter                            NpdChat

Non Product                  Compliment/complaint               NpdCmnt

Non Product                  CompuServe                         NpdCis

Non Product                  Legal/Licensing issues             NpdLegal

Non Product                  Manufacturing Issues               NpdMfg

Non Product                  Non MS Product                     NpdNotms

Non Product                  Other                              NpdOthr

Non Product                  Post-Sales Request                 NpdPstsl

Non Product                  PSS Support                        NpdPss

Non Product                  Sales Support                      NpdSales

ODBC                         Access 2.0 ODBC Driver             ObcAc20

ODBC                         Driver Pack                        ObcDrvpk

ODBC                         How To                             ObcHowto

ODBC                         MSysConf                           ObcMsys

ODBC                         Non-MS Drivers                     ObcNonms

ODBC                         Oracle                             ObcOracl

ODBC                         Other                              ObcOthr

ODBC                         Problems                           ObcProb

ODBC                         SQL Server: MS                     ObcSqlms

ODBC                         SQL Server: Sybase                 ObcSqlsy

Output To                    AutoStart option                   OtpAuto

Output To                    General                            OtpGnrl

Output To                    Microsoft Excel/Analyze It         OtpExl

Output To                    MS-DOS Text (*.txt)                OtpTxt

Output To                    Other                              OtpOthr

Output To                    Problems                           OtpProb

Output To                    Rich Text Format (*.rtf)           OtpRtf

Printing                     Controlling Printing Options       PtrOpt

Printing                     Other                              PtrOthr

Printing                     P. Preview doesn't match output    PtrPrev

Printing                     Print Dialog Box                   PtrDialg

Printing                     Print Fixed Font Output            PtrFxfnt

Printing                     Print Setup                        PtrSetup

Printing                     Printing Graphs/Lines              PtrGraph

Printing                     Printing Limitations               PtrLimit

Printing                     Problems/Performance               PtrProb

Programming/Logic            API/DLL Calls                      PgmApi

Programming/Logic            Error Handling/Debugging           PgmErr

Programming/Logic            How To                             PgmHowto

Programming/Logic            Object Manipulation                PgmObj

Programming/Logic            Other                              PgmOthr

Programming/Logic            Parsing Strings and Files          PgmParse

Programming/Logic            Performance/Optimization           PgmPrfm

Programming/Logic            Process Control                    PgmPrcs

Queries                      Append                             QryAppnd

Queries                      Criteria                           QryCrit

Queries                      Crosstab                           QryCross

Queries                      Delete                             QryDel

Queries                      Filters                            QryFiltr

Queries                      General                            QryGnrl

Queries                      How To                             QryHowto

Queries                      Joins                              QryJoin

Queries                      Make Table                         QryMktbl

Queries                      Other                              QryOthr

Queries                      Parameters/Referencing             QryParm

Queries                      Performance                        QryPrfm

Queries                      Problems                           QryProb

Queries                      Properties                         QryProp

Queries                      Rushmore                           QryRush

Queries                      SQL View/Syntax questions          QrySqlvw

Queries                      SQL: Data Definition query         QrySqldd

Queries                      SQL: Pass-Through query            QryPass

Queries                      SQL: Union query                   QryUnion

Queries                      Top N                              QryTopn

Queries                      Totals/Aggregate Functions         QryTotal

Queries                      Updatability/Row Fix-Up            QryFixup

Queries                      Update                             QryUpdat

Queries                      Wizard: Archive                    QryWiza

Queries                      Wizard: Crosstab                   QryWizc

Queries                      Wizard: Find Duplicates            QryWizd

Queries                      Wizard: Find Unmatched             QryWizu

Relationships                Can't save multiple layouts        RltNosav

Relationships                How to create relationships        RltCreat

Relationships                How to delete relationships        RltDel

Relationships                How to view relationships          RltView

Relationships                Need mouse to join tables          RltMous

Relationships                On attached Access tables          RltAttac

Relationships                Other                              RltOthr

Relationships                Referential Integrity              RltRef

Reports (Specific)           Envelopes                          RptEnv

Reports (Specific)           Events                             RptEvent

Reports (Specific)           Layout                             RptLayou

Reports (Specific)           Mailing Labels                     RptLabel

Reports (Specific)           Other                              RptOthr

Reports (Specific)           Page Numbers                       RptPagen

Reports (Specific)           Problems                           RptProb

Reports (Specific)           Report Properties                  RptProp

Reports (Specific)           Sorting and Grouping               RptSort

Reports (Specific)           SubReports                         RptSub

Reports (Specific)           Totaling                           RptTotal

Reports (Specific)           Wizard: AutoReport/Quick Report    RptWiza

Reports (Specific)           Wizard: Groups/Totals              RptWizg

Reports (Specific)           Wizard: Single-Column              RptWizsi

Reports (Specific)           Wizard: Snaking Columns            RptWizsn

Reports (Specific)           Wizard: Summary                    RptWizsu

Reports (Specific)           Wizard: Tabular                    RptWizt

Security                     Changing ownership                 ScrtOwnr

Security                     Default accounts                   ScrtDef

Security                     Implementing                       ScrtImpl

Security                     Other                              ScrtOthr

Security                     Permissions                        ScrtPerm

Security                     Users/Groups                       ScrtUsr

Security                     Workgroup Administrator            ScrtAdm

Setup                        Compliance Checking                StpComp

Setup                        Errors starting Access             StpErr

Setup                        How To                             StpHowto

Setup                        Install Options (Typical, etc.)    StpOptio

Setup                        Install: General Issues            StpGnrl

Setup                        Install: Side by side (1.x&2.0)    StpSide

Setup                        Install: Update (2.0 over 1.x)     StpUpdat

Setup                        Maintenance Install                StpMaint

Setup                        Network Install                    StpNet

Setup                        ODBC Setup                         StpOdbc

Setup                        Other                              StpOthr

Setup                        Registration errors (REG.DAT)      StpReg

Setup                        Setup fails                        StpFail

Tables                       Counters                           TblCount

Tables                       Data Types                         TblDatyp

Tables                       Database Design                    TblDsign

Tables                       Field Builder                      TblFldb

Tables                       Field Properties                   TblFldp

Tables                       How To                             TblHowto

Tables                       Modify                             TblModfy

Tables                       Other                              TblOthr

Tables                       Primary Keys/Indexes               TblPriky

Tables                       Problems                           TblProb

Tables                       Wizard: Table                      TblWiz

User Interface               Database window (container)        UiDbwin

User Interface               Datasheet view                     UiDatash

User Interface               Dialog Boxes                       UiDialog

User Interface               Keyboard                           UiKeybd

User Interface               Menu Builder                       UiMenub

User Interface               Menus                              UiMenu

User Interface               Other                              UiOthr

User Interface               Problems                           UiProb

User Interface               Right mouse menus                  UiRtmous

User Interface               Toolbars                           UiToolbr

Wizards                      Add-in Manager                     WzAdmgr

Wizards                      Attachment Manager                 WzAtmgr

Wizards                      Auto Dialer Builder                WzAutod

Wizards                      General                            WzGnrl

Wizards                      How To                             WzHowto

Wizards                      Import Database                    WzImport

Wizards                      Other                              WzOthr

Wizards                      Problems                           WzProb

REFERENCES

==========

For more information about how to query the KB using categories and

subcategories, please see the following article in the Microsoft Knowledge

Base:

   ARTICLE-ID: Q119525

   TITLE     : INF: How to Query on Category Keywords

For more information on how to query using the Find button, click the

Find button, then click the Hints button in the Search dialog box.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: KbCodes


INF: "#Name?" or Control is Blank on Form Based on a Query

Article ID: Q92683

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

----------------------------------------------------------------------

SUMMARY

=======

If you have a form based on a query, and the query contains multiple

fields with the same name (such as FieldA from Table1 and FieldA from

Table2), the control(s) on the form that are bound to that field name

will be blank or may display the error "#Name?".

MORE INFORMATION

================

Because the same field name appears multiple times in the query that

the form is based on, Microsoft Access does not know which field to

link to the control(s). Therefore, instead of making an assumption

about which field to bind to, it leaves the control(s) linked to

duplicate field names blank or displays the error "#Name?" in the

control.

To correct this problem, rename the field in the query.

To change a field name in a query:

1. In a query's Design view, place the insertion point in front of the

   first letter of the field name in the QBE grid.

2. Type the new name followed by a colon. Delete any names assigned by

   Microsoft Access, but do not delete the field name or expression.

NOTE: Changing a field name in a query's Design view changes the

heading in the query's Datasheet view and the field name in a form or

report based on the query. However, the underlying field name in the

table does not change.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, page 103

Additional reference words: 1.00 1.10 2.00 poundname tshoot

KBCategory:

KBSubcategory: QryOthr


INF: "Continued..." Header for Groups That Span Multiple Pages

Article ID: Q88156

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a label that will print at the

top of each report page when a data group spans multiple pages.

The events used in this technique capture the value of the group in the

page footer. If this value is the same as the page header value on the next

page, a label containing "Continued from previous page..." is printed at

the top of the page.

MORE INFORMATION

================

The steps below use the sample database NWIND.MDB to demonstrate how to

create a label that will print at the top of each report page when a data

group spans multiple pages:

 1. Open the NWIND database and create a new module.

 2. Enter the following global Declarations and functions in the

    module.

    NOTE: In the following sample code, underscores (_) are used as line-

    continuation characters. Remove the underscores when re-creating this

    code in Access Basic.

       '-----------------------------------------------

       'Global Declarations

       '-----------------------------------------------

       Global CurrentGroupVal as String

       '-----------------------------------------------

       'Code Section

       '-----------------------------------------------

       Function SetGlobalVar (InReport as Report)

          CurrentGroupVal = InReport!SetGroupVal

       End Function

       Function SetContinuedLabel (InReport as Report)

          If InReport.Page <> 1 then

          InReport!ContinuedLabel.Visible = _

             IIf(Trim(InReport!CheckGroupVal = _

                 Trim(CurrentGroupVal)), True, False)

          End If

       End Function

 3. Open the List Of Products By Category report in Design view.

 4. Increase the height of the detail section to approximately 1 inch.

 5. Increase the height of the page header section by about 0.5 inch. Add a

    label to the page header section. Position the label below the existing

    fields. Set the label's Caption property to "Continued from previous

    page..." and set its ControlName property to ContinuedLabel. (NOTE: In

    Microsoft Access version 2.0, the ControlName property is called the

    Name property.) Set the label's Visible property to No.

 6. From the View menu, choose Field List.

 7. Create a text box bound to the Category Name field by dragging the

    Category Name field to the page header section. Change the text box's

    ControlName property to CheckGroupVal, and set its Visible property to

    No.

 8. Click anywhere in the page header section not occupied by a control to

    display the page header properties in the property sheet. Set the page

    header's OnPrint property to:

       =SetContinuedLabel(Report)

 9. Create a text box bound to the Category Name field in the page footer

    section. Change the text box's ControlName property to SetGroupVal, and

    set its Visible property to No.

10. Click anywhere in the page footer section not occupied by a control.

    Set the page footer's OnPrint property to:

       =SetGlobalVar(Report)

11. Preview the report. Note the "Continued from previous page..." message

    at the top of any page whose category details span more than one page.

Note that the steps above are for illustrative purposes only; your report

may require adjustments other than those above. You may want to set the

section KeepTogether properties to Yes to keep sections from being split

across pages. In the example above, you may also want to set the Category

Name header section's ForceNewPage property to Before Section to help

control the page layout.

In Microsoft Access version 2.0, there is a new GroupKeepTogether property

that you can use to keep groups of records together, or to keep the group

header with the first record in the group. You may want to experiment with

this property to see how it affects your report's layout.

Additional reference words: 1.00 1.10 2.00 container

KBCategory:

KBSubcategory: RptSort


INF: "Form Is Read Only" Error Message

Article ID: Q98666

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The message "Form is read only" in Microsoft Access version 1.x or "This

Recordset is not updatable" in Microsoft Access version 2.0 is displayed

when you are trying to update data, but the form's DefaultEditing property

is not set to Read Only.

CAUSE

=====

If your form is based on a query with a property set to Read Only, you

will not be able to modify data in the form.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new query based on the Order Details table in the sample

   database NWIND.MDB.

      Query: Orders

      -------------------------------------

      Type:  Select Query

      Join:  None

      Field: Quantity

         Total: Group By

      Field: Unit Price

         Total: Group By

      Field: Expr1: [Unit Price]*[Quantity]

         Total: Expression

2. Run the query, and then try to change the Unit Price in any record.

   The computer beeps, and the status bar displays "Form is read only."

You will get the same result when you try to update a form based on

this query. If you remove the Total line in the query grid you will be

able to modify the records.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.x, Chapter 6, "Designing Select

Queries"

Microsoft Access "User's Guide," version 2.0, Chapter 11, "Designing Select

Queries"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsOthr


INF: "Incorrect Syntax Near '-'" Using TransferDatabase Action

Article ID: Q106244

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are running a TransferDatabase macro action to attach a SQL

Server table, the following error message may be generated:

   Connection Failed. SQL State 37000. SQL Server Error 102. Incorrect

   Syntax Near '-'.

MORE INFORMATION

================

This error is generated because there is an error in the database name

argument, or connect string, of the TransferDatabase macro action.

The Microsoft Access Help system suggests that the connect string can be

copied from the table properties of the attached table. When you copy the

connect string into the database name argument, a string similar to the

following example is produced:

NOTE: In the following example, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this

example.

   ODBC;DSN=MyServer;UID=User2;APP=Microsoft Access;WSID=User2; _

   DATABASE=pubs-->-->dbo.authors

The syntax error is caused by the text after the "pubs" database name. All

text after the database name should be removed from the string, and the

table name should be moved to the source argument.

The following example demonstrates correct arguments for the

TransferDatabase action:

   Transfer Type:  ATTACH.

   Database Type:  <SQL DATABASE>.

   Database Name:  ODBC;DSN=MyServer;UID=User2;APP=Microsoft Access; _

                      WSID=User2;DATABASE=pubs

   Object Type:    TABLE

   Source:         DBO.AUTHORS

   Destination:    DBO_AUTHORS

   Structure Only: NO

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 472-474

Additional reference words: 1.00 1.10 2.00 errmsg transfer

KBCategory:

KBSubcategory: ObcOthr


INF: Access Basic Error-Handling Supplemental Information

Article ID: Q101324

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article supplements the information available in the Microsoft Access

"Language Reference" manual about how to handle errors in an Access Basic

application.

MORE INFORMATION

================

There are times when your code becomes susceptible to user error

problems, even though the code itself is proven. The larger the

program, the more often situations arise that were not anticipated at

the time the code was written. For this reason, always include

error-handling routines in your code to prevent your application from

crashing when unexpected errors occur. Error-trapping routines offer

significant help in the debugging process.

On Error Statement

------------------

Access Basic includes the On Error statement for error trapping, as

well as several other commands for reporting and processing errors.

The On Error statement is followed by either a GoTo clause, which

causes program control to branch to a predefined label when an error

occurs, or by a Resume Next clause, which tells Access Basic to ignore

the error condition and continue to the next statement.

To create a label for an On Error GoTo statement, type the name of the

label, followed by a colon (:). The commands that follow the label are

executed when control is passed to the label by the On Error GoTo

statement.

Generally, you should place the label and its accompanying

error-handling routine at the bottom of the procedure, preceded by an

End Sub or End Function statement, to ensure that the routine executes

only when branched to and not by mistake.

NOTE: A label does not necessarily indicate a break in program flow.

Shown below is a Sub procedure that performs a SQL action based on a

SQL string value. The On Error Resume Next statement is used to handle

any errors generated by the first DeleteQueryDef method (for example,

if "TempQuery" does not exist). On Error GoTo SQLError means that if

any other errors occur, program control passes to the SQLError

error-handling routine. The On Error GoTo 0 statement is used at the

end of the procedure to disable error trapping.

   Sub PerformSQLAction (InDB As String, SQLStmt As String)

      Dim SQLDb As Database, SQLQuery As QueryDef

      On Error Resume Next

         Set SQLDb = OpenDatabase(InDB)

         SQLDb.DeleteQueryDef ("TempQuery")

      On Error GoTo SQLError:

         Set SQLQuery = SQLDb.CreateQueryDef("TempQuery", SQLStmt)

         SQLQuery.Execute

         SQLQuery.Close

         SQLDb.DeleteQueryDef ("TempQuery")

      On Error GoTo 0

      Exit Sub

   SQLError:

      MsgBox "An error occurred while executing the SQL statement."

      Exit Sub

   End Sub

The Exit Sub statement is required at the end of the error-handling

routine, even though the End Sub statement follows. In place of the

Exit Sub statement, you could use a Resume Next statement to return

control to the line following the line of code that caused the error.

Err(), Erl(), and Error$() Functions

------------------------------------

Access Basic includes the Err(), Erl(), and Error$() functions, all of

which return information about the error that occurred. The Error$()

function returns the error message as a string, the Err() function

returns a number representing the error message, and the Erl()

function returns the number of the line in which the error occurred.

Using these functions, you can code your error-trapping routine to

display meaningful error messages and trap for specific errors.

A generic error-trapping routine that uses both Error$() and Erl()

functions is shown below. This type of routine tells you what error

occurred and where; it also allows you to either ignore the error and

continue or cancel execution and further investigate the problem.

   On Error GoTo ErrorHandler

   ErrorHandler:

      If MsgBox("The following error has occurred at line " &_

         Trim(Str(Erl)) & ":" & Chr(13) & Chr(10) & Chr(13) &_

         Chr(10) & Error$, 17) = 1 Then Resume Next Else Stop

The following Sub procedure illustrates how the Error$() function can

create informative error messages to help you and your users debug

your program:

   Sub MyError ()

      On Error GoTo ErrorHandler

      INTEGERVAL% = 99999 'Generates Numeric Overflow error

      Debug.Print "Error was ignored"

      Exit Sub

   ErrorHandler:

      If MsgBox("The following error has occurred at line " &_

         Trim(Str(Erl)) & ":" & Chr(13) & Chr(10) & Chr(13) &_

         Chr(10) & Error$, 17) = 1 Then Resume Next Else Stop

      Exit Sub

   End Sub

You can use the Err() function to build a SQL SELECT statement that

traps for specific errors and takes a different action depending on

the error number. You can use the Erl() function to pinpoint exactly

which line is causing the problem in your program, to anticipate error

conditions in your program, and to handle errors more smoothly.

If you use the Erl() function, you do not need to number every line of

your code to find the offending line number. Instead, number only

those lines of code most likely to cause problems. (The line numbers

represent labels, rather than classic line numbers, as in other Basic

languages.) Then, if an error occurs in one of the numbered lines, the

Erl() function reports only that line number.

You can also use this method if you have two lines of code that may

generate the same error and you want to handle each case separately,

as in the following example:

   Function ErlTest()

      On Error Goto ErlTest_Err

      10: Open "AUTOEXECBAT" For Input As #1 'causes an error.

      20: Open "CONFIG.SYS" For Input As #2

      Close

   Exit Sub

   ErlTest_Err:

      If Erl = 10 Then

         MsgBox "Could not open AUTOEXEC.BAT file."

      ElseIf Erl = 20 Then

         MsgBox "Could not open CONFIG.SYS file."

      End If

      Exit Sub

   End Sub

Since there is no possibility that a file called "AUTOEXECBAT" exists,

this line of code errors out and program control passes to the error-

handling routine "ErlTest_Err". The Erl() function detects the number

of the line in which the error occurred and displays the "Could not

open AUTOEXEC.BAT file" error message.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 331-333

For more information about error-handling routines, search for "Error

handling" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 debugging

KBCategory:

KBSubcategory: PgmErr


INF: Adding a Dynamic Counter to a Query to Count Records

Article ID: Q94397

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use a dynamic counter value in a query field

for the following purposes:

 - Returning the top x number of records in a Microsoft Access version 1.x

   query. In Microsoft Access version 2.0, you can use the TopValues query

   property to accomplish this.

 - Displaying the record's position number on a form. For more information

   about this topic, query on the following words here in the Microsoft

   Knowledge base:

      record and position and number and form

 - Printing the top x number of records on a report. For more information

   about this topic, query on the following words here in the Microsoft

   Knowledge Base:

      top and 10 and records and report

   NOTE: If the report includes totals, totals will be displayed for all

   the records, not just the top x number of records. To total only the top

   x number of records, limit the records included in the report using the

   method described later in this article.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

Sample code to implement a dynamic counter is described later in this

article. There are several limitations to this method, including the

following:

 - You must reset the global counter to 0 before running the query

   each time. You can use the function SetToZero() to do this.

 - Any scrolling, minimizing, maximizing, switching focus away and back,

   and so on, causes a repaint to occur, which in turn causes the query to

   call the function again. For this reason, you should not use this

   function in a select query. Instead, you should base a report on the

   select query or run a make-table query and view the resulting table.

 - When basing a report on a select query with this function, scrolling

   back through the pages will cause the function to be called multiple

   times, and the counter expression will be off by the total number of

   records in the dynaset.

 - When you place criteria on the counter expression, the function

   will be called twice per record. For example, if you specify criteria of

   <=10 to return the first 10 records, the dynaset will contain 10

   records, but the counter expression will be off by the total number of

   records in the dynaset.

 - Do not place the counter expression in the first column of the

   query; the number will be off by one.

 - Do not combine criteria and sorting in a query with the counter

   expression. The criteria will be applied before the sort. Instead, you

   must create a make-table query with the sort, and then base a second

   query containing the counter expression on the new table with sorted

   data.

The Dynamic Counter Function

----------------------------

The following Access Basic functions, Qcntr() and SetToZero(), can be used

to implement a dynamic counter in a query.

   'Global Declarations Section

   Option Explicit

   Global Cntr

   '**********************************************************

   'Function:  Qcntr()

   '

   'Purpose: This function will increment and return a dynamic

   'counter. This function should be called from a query.

   '**********************************************************

   Function QCntr(x) As Long

      Cntr = Cntr + 1

      QCntr = Cntr

   End Function

   '**********************************************************

   'Function:  SetToZero()

   '

   'Purpose: This function will reset the global Cntr to 0. This

   'function should be called each time before running a query

   'containing the Qcntr() function.

   '**********************************************************

   Function SetToZero()

      Cntr = 0

   End Function

Returning the Top X Records

---------------------------

The following example uses the Orders table in the sample database

NWIND.MDB to demonstrate how to return the top 10 orders:

1. Create a new query based on the Orders table. Include the following

   fields:

      Field: Order ID

      Field: Customer ID

      Field: Order Date

      Field: Order Amount

         Sort: Descending

      Field: Expr1: Qcntr([order id])

2. From the Query menu, choose Make Table. When you are prompted for

   a table name, type "Sorted Orders" (without quotation marks).

3. Save the query as Make Sorted Orders.

4. Create a new query that will be based on the Sorted Orders table once

   it is created. For now, close the Add Table dialog box without adding

   a table to the query. From the view menu, choose SQL, and then enter

   the following SQL statement:

      Select * from [Sorted Orders] where [Expr1] <= 10

5. Save this query as Top 10 Orders and then close it.

6. Create the following new macro:

      Actions

      -----------

      RunCode

      SetWarnings

      OpenQuery

      OpenQuery

      Macro Action Arguments

      -----------------------------------

      RunCode

         Function Name: SetToZero()

      SetWarnings

         Warnings On: No

      OpenQuery

         Query Name: [Make Sorted Orders]

      OpenQuery

         Query Name: [Top 10 Orders]

7. Run the macro. The table Sorted Orders will be created, and then the

   Top 10 Orders query will be displayed.

NOTE: Since the Top 10 Orders query is based on a table, you can scroll

through the records and use criteria on the counter expression without

causing the function to be called multiple times per record.

Creating a Top 10 Report That Includes Totals

---------------------------------------------

1. Follow steps 1-5 in the above section.

2. Create a new report called Top 10 Orders based on the Top 10 Orders

   query.

3. Create the following new macro:

      Actions

      -----------

      RunCode

      SetWarnings

      OpenQuery

      OpenReport

      Macro Action Arguments

      -----------------------------------

      RunCode

         Function Name: SetToZero()

      SetWarnings

         Warnings On: No

      OpenQuery

         Query Name: [Make Sorted Orders]

      OpenReport

         Report Name: [Top 10 Orders]

4. Run the macro.

NOTE: The counter expression will not renumber if you change the sort order

or add grouping in the report, because it is calculated in the make-table

query. The counter expression is being used here to limit the dynaset to

the top 10 orders.

REFERENCES

==========

For information about when functions are executed in queries, query

on the following words here in the Microsoft Knowledge Base:

   custom and function and executes

Additional reference words: 1.00 1.10 2.00 rank top 10 custom

KBCategory:

KBSubcategory: QryOthr


INF: Adding a New Record to a Combo Box with a Double-Click

Article ID: Q88148

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to set up a macro so that you can add new values

to a combo box, using the Orders form in the sample database NWIND.MDB as

an example.

MORE INFORMATION

================

Follow these steps to modify the Orders form so that you can add new values

to the Salesperson combo box:

1. Open the NWIND database.

2. Create the following new macro, and save it as Macro1:

      Macro Name   Condition                   Action

      -----------------------------------------------------

      NewRecord                                OpenForm

      OnClose      [Employee ID] Is Not Null   DoMenuItem

                   ...                         SelectObject

                   ...                         ReQuery

                   ...                         SetValue

      NewRecord Actions

      --------------------------------------------------------

      OpenForm: Opens the Employees form to add a new employee

         Form Name: Employees

         View: Form

         Data Mode: Add

         Window Mode: Normal

      OnClose Actions

      -------------------------------------------------------------------

      DoMenuItem: Saves the record entered into the Employees form and

                  prevents errors if no record is entered

         Menu Bar: Form

         Menu Name: File

         Command: Save Record

      SelectObject: Selects the open Orders form

         Object Type: Form

         Object Name: Orders

         In Database Window: No

      ReQuery: Requery the combo box in the Orders form

         ControlName: Employee ID

      SetValue: Takes the value from the newly entered Employee ID in

                 the Employees form and puts it in the Employee ID in the

                 Orders form

         Item: Forms!Orders![Employee ID]

         Expression: Forms!Employees![Employee ID]

3. Change the properties of the Employee ID combo box on the Orders form

   as follows:

      OnDblClick: Macro1.NewRecord

      StatusBarText: Double-click to Add a New Employee

4. Change the OnClose property of the Employees form as follows:

      On Close: Macro1.OnClose

To see how this process works, open the Orders form in Form view, then

double-click the Salesperson combo box. The Employees form will open. After

filling in the pertinent data, close the form. When the form is closed, the

newly entered data will be transferred to the Orders form.

Additional reference words: 1.00 1.10 2.00 doubleclick update record

KBCategory:

KBSubcategory: FmsEvnt


INF: Additions to User's Guide Appendix A Specifications (2.0)

Article ID: Q115193

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists additions to the Microsoft Access specifications in

Appendix A of the Microsoft Access "User's Guide," version 2.0. Note that

some, but not all, of this information may already be in the Microsoft

Access "User's Guide."

MORE INFORMATION

================

Databases

---------

Attribute                                         Maximum

---------------------------------------------------------------------

Number of active breakpoints                      None (limited only

                                                  by memory)

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Appendix A, "Microsoft

Access Specifications"

Additional reference words: 2.00 limits docerr

KBCategory:

KBSubcategory: DcmOthr


INF: Administrator Setup Does Not Create SETUP Subdirectory

Article ID: Q115916

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists the directories created by Microsoft Access during an

Administrator Setup (SETUP /A) to a network server, and describes how to

run a workstation installation of Microsoft Access.

MORE INFORMATION

================

Setting up Microsoft Access with the Administrator Setup lets you run

Microsoft Access from a network server. This reduces the amount of disk

space needed by workstations running Microsoft Access by storing most of

the Microsoft Access files on the server.

When you run an Administrator Setup, the following subdirectories are

created on the server below the Microsoft Access directory:

 - SAMPAPPS

 - SHARED

 - SYSTEM

 - WORKDIR

Note that no SETUP subdirectory is created. The SETUP.EXE file is installed

in the Microsoft Access directory on the server.

To run a workstation installation, run SETUP.EXE from the Microsoft Access

directory on the server, not from the SETUP subdirectory as stated in the

Microsoft Access "User's Guide." Use the full path to the SETUP.EXE file to

run a workstation installation, as in the following example:

   N:\ACCESS\SETUP.EXE

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 1, "Setting Up

Microsoft Access," pages 4-6

For more information about installing to a network server, see the topic

"Network Installation" in the ACREADME.HLP file.

For more information about Setup, query on the following words here in the

Microsoft Knowledge Base:

   setup and conversions and questions

Additional reference words: 2.00 docerr

KBCategory:

KBSubcategory: StpNet


INF: Attach R:BASE Table by Exporting dBASE Format in R:BASE

Article ID: Q94037

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not ship with an ISAM driver that supports attaching

R:BASE tables to Microsoft Access databases. However, R:BASE can export

tables into several different formats that Microsoft Access can import.

To retain column names and data type definitions, export R:BASE tables

from R:BASE using the dBASE format.

MORE INFORMATION

================

R:BASE can export the following data types:

 - ASCII delimited

 - ASCII fixed width

 - DIF (VisiCalc or other program)

 - SYLK (Multiplan or other program)

 - dBASE II, dBASE III, or dBASE III Plus (DBF)

 - Lotus 1-2-3 (version 1.0 and 2.0) or Symphony (WKS, WK1, or WRK)

R:BASE and dBASE are manufactured by vendors independent of Microsoft; we

make no warranty, implied or otherwise, regarding these products'

performance or reliability.

Additional reference words: 1.00 1.10 2.00 rbase

KBCategory:

KBSubcategory: IntpOthr


INF: Attached Table Must Be Opened as Dynaset from Modules

Article ID: Q90817

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Access Basic modules, a table can be opened as the Table data type

in the following manner:

   Dim MyDB as Database

   Dim MyTable as Table

   Set MyDB = OpenDatabase("NWIND.MDB")

   Set MyTable = MyDB.OpenTable("Categories")

However, if you have an attached table that is in the database, it

cannot be opened as the Table data type. An attached table must be

opened as the Dynaset data type in the following manner:

   DIM MyDB as Database

   DIM MyDyn as Dynaset

   Set MyDB = OpenDatabase("NWIND.MDB")

   Set MyDyn = MyDB.CreateDynaset("AttachedTable")

MORE INFORMATION

================

If you try to execute the OpenTable action on an attached table, you

will receive the following error message in Microsoft Access version 1.x

(error # 3219):

   Can't perform operation; it is illegal

In Microsoft Access version 2.0, you will receive error # 3219:

   Invalid Operation

When you refer to a Table data type, the table must reside in the .MDB

file. This is why an attached database must be opened as a dynaset. An

attached table only has a pointer to where the table resides.

REFERENCES

==========

For more information on table objects, search for "OpenTable" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 datatype errmsg

KBCategory:

KBSubcategory: PgmObj


INF: Attaching Clipper Tables to Microsoft Access Databases

Article ID: Q95044

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

It is possible to attach Clipper .DBF files to a Microsoft Access

database. To do so, attach it as a dBASE IV file. Note, however, the

index may or may not be updateable.

Clipper provides an alternative indexing method (.NTX) to the dBASE

standard (.NDX). The Clipper index format is not recognized by

Microsoft Access, so Microsoft Access cannot update it correctly.

However, if the Clipper application was developed using the dBASE .NDX

format, Microsoft Access updates the index correctly.

Additional reference words: 1.00 1.10 2.00 indexes

KBCategory:

KBSubcategory: IntpOthr


INF: Avoid Using Different Palettes for Simultaneous Forms

Article ID: Q114508

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access version 2.0, forms have a new property called

PaletteSource that you can use to create a different color scheme for each

form. However, if you display multiple forms on the screen simultaneously,

Microsoft recommends that you set the palettes of all the forms to the same

colors.

Microsoft Windows can only display one color palette at a time. If multiple

forms that use different color palettes are displayed at the same time,

only the active form's colors will be correct, since the background forms

will be forced to use the active form's color palette.

To prevent this, make sure that all the forms that will be displayed

simultaneously use the same color palette. Another way to avoid this

behavior is to hide background forms while they are not active.

REFERENCES

==========

For more information about palettes, search for "PaletteSource" then

"PaletteSource Property" using the Microsoft Access Help menu.

Additional reference words: 2.00 Forms Reports

KBCategory:

KBSubcategory: FmrColr


INF: Base Combo Box on Parameter Query to Filter Values

Article ID: Q99937

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to filter values that appear in a combo box

by basing the combo box on a parameter query.

MORE INFORMATION

================

There may be situations in which you want to limit the values that

appear in a combo box. For example, you may want to show only

suppliers whose names begin with a certain letter. Although Microsoft

Access does not allow filters on combo boxes, basing your combo box on

a parameter query filters the values using a criteria clause.

This article describes the steps to create a combo box that displays

only the suppliers that meet the criteria you specify. The sample

database NWIND.MDB is used:

1. Create the following query to fill the combo box:

    Query:  Filtered Supplier List

    ------------------------------

    Type:  Select

    Field:  Company Name

       Table: Suppliers

       Sort:  Ascending

       Criteria: Like [My Criteria Box] & "*"

2. Create the following macro to update the combo box with new

   criteria:

    MacroName: CB Test Macro

    ------------------------

       Action: Requery

       ControlName: My combo box

3. Create the following unbound form to test your controls:

    Form: TestForm

    --------------

       Record Source: <None>

    TestForm Controls

    -----------------

    Combo Box: My combo box

       ControlSource: <None>

       RowSourceType: Table/Query

       RowSource: Filtered Supplier List

    Text Box: My Criteria Box

       After Update:  CB Test Macro

4. Open the form in Form view. Choose the arrow button. (Do not enter

   any value in the Criteria box.) Note that all suppliers are listed

   because you have not yet entered a filter criteria.

5. Type a single letter in the Criteria box (for example, "E").

6. Choose the arrow button. Note that only suppliers whose names begin

   with the letter "E" are displayed.

7. Give the Criteria box the focus. Type a new letter (for example,

   "P").

8. Choose the arrow button. Note that now only suppliers whose names

   begin with the letter "P" are displayed.

Additional reference words: 1.00 1.10 2.00 limit drop down list box ddb

KBCategory:

KBSubcategory: FmsCmbo


INF: Btrieve File Owner Names, Passwords, and Security

Article ID: Q115917

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Btrieve files have owner names embedded in them. These owner names can be

used as passwords, but many applications that use Btrieve use other

passwords to control user access.

Owner names are frequently set to read-only access. As a result, you can

get the error message "Drive or network error" when you attempt to update

the database file. If the owner name allows read-only access, Microsoft

Access does not prompt you for a password until you attempt to update the

file.

The DDFPassword line in the [Btrieve ISAM] section of the MSACC20.INI file

can be used to set the owner name of .DDF files, but cannot be used to set

the owner names of other Btrieve files. The owner names of other Btrieve

files can be set programmatically when they are attached to Microsoft

Access.

Only the user who created the Btrieve files and originally set the owner

name can provide the owner name to you. It may be necessary for you to

contact the original file creator to obtain the owner name, or have the

files' creator provide files that do not have owner names embedded in them.

MORE INFORMATION

================

Btrieve database files contain only data. They do not contain other

database information (unlike Microsoft Access database files, which do

contain other information or objects). Each Btrieve file contains only one

table. You must use a separate application to access the data contained in

a Btrieve database file, and this application must also provide all

security control. When attached to a Microsoft Access database, each

Btrieve file is considered a separate table.

Applications that use Btrieve files can either use a password to control

entry to the application (possibly including multiple levels of user

privilege), or use file owner names.

File owner names are both embedded in the database file and hard-coded in

the application using that file. Since an application may draw information

from numerous Btrieve files, and each file can have a unique owner name,

the owner name for each file is generally hard-coded in the application.

When the application opens a Btrieve database file, the Btrieve database

engine compares the database file's embedded owner name with the owner name

sent by the application to determine user privileges.

There is no connection between an application's password and the embedded

file owner name. You may have an application password that allows you full

file-access privileges. This does not mean that you can directly access the

files without the application, since the owner name hard-coded in the

application is different than your application password.

Owner names assigned to Btrieve files can have one of four security

options:

1. Require an owner name for any access--no data encryption.

2. Permit read-only access without an owner name--no data

   encryption.

3. Require an owner name for any access--with data encryption.

4. Permit read-only access without an owner name--with data

   encryption.

If a read-only option is set on the Btrieve database file (with or without

an owner name), Microsoft Access can open the file and display its

contents. However, if you attempt to update the file, you will receive the

error message "Drive or network error."

Microsoft Access Prompts for Password

-------------------------------------

When you are using any of the installable ISAMs (such as Btrieve, Paradox,

or dBASE), if you attempt to open an attached table that is password

protected, Microsoft Access will prompt you for a password after the open

attempt fails.

In Btrieve, if you set the owner name option to read-only access, the open

does not fail and Microsoft Access does not prompt you for a password. No

error or warning occurs until you attempt to update the file.

How to Specify an Owner Name

----------------------------

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

You can specify an owner name for the .DDF files using the DDFPassword line

in the [Btrieve ISAM] section of the MSACC20.INI file. However, this is of

little benefit since it only sets the password for the .DDF files, not for

the Btrieve database file.

You can use Access Basic to attach the Btrieve database file and specify

the owner name so that full read-write privileges are available. Once you

attach the table, it is not necessary to specify the owner name again.

The following sample Access Basic code demonstrates how to attach a Btrieve

file called MYFILE and specify the file owner name as a Microsoft Access

password:

   Sub TablePwd ()

      Dim MyDB As Database, MyTD As TableDef

      Set MyDB = DBEngine.Workspaces(0).Databases(0)

      Set MyTD = MyDB.CreateTableDef("MYFILE")

      MyTD.connect = "btrieve;PWD=OwnrNm;Database=C:\MYDIR\FILE.DDF"

      MyTD.sourcetablename = "MYFILE"

      MyDB.tabledefs.Append MyTD

   End Sub

Note that this example uses the FILE.DDF file located in the C:\MYDIR

directory to search for a Btrieve table named MYFILE, and then attempts to

attach the file to the current database using the password "OwnrNm."

The products discussed here are manufactured by vendors independent of

Microsoft; we make no warranty, implied or otherwise, regarding these

products' performance or reliability.

Additional reference words: 2.00 Attaching ODBC errmsg

KBCategory:

KBSubcategory: IsmBtrv


INF: Calculated Fields Must Be Shown to Perform Calculations

Article ID: Q95911

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If you have a calculated field named Field1 in a query, and you have

another field that is performing a calculation based on Field1, then

Field1 must be checked to Show in the query grid.

MORE INFORMATION

================

The following example assumes that you have a table that contains a

field named Field1.

1. Create the following query:

      Query: QueryTest

      --------------------------------

      Field Name: Field1: (1+2)

         Show: False

      Field Name: Field2: (Field1 + 5)

         Show: True

2. Run the query.

You will receive a parameter prompt for Field1. Field1 must be included in

the query's dynaset in order for the calculation in Field2 to be performed

correctly.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 6, "Designing

Select Queries," pages 148-149

Additional reference words: 1.00 1.10 2.00 Queries expression

KBCategory:

KBSubcategory: QryOthr


INF: Calling RegQueryValue() to get an OLE Object Class Name

Article ID: Q99322

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The RegQueryValue() function, found in the Microsoft Windows SHELL.DLL

file, uses an OLE ClassKey (such as PBRUSH or MSGRAPH) to obtain

the information about that class from the REG.DAT file.

This article describes the way the RegQueryValue() function obtains the

Object Class Name from the OLE Registration Database REG.DAT file.

Although only the procedure to obtain the Object Class Name is described

here, other information, including the current location of the OLE

server and the types of <Primary VERBS> available to the object, is

also available.

MORE INFORMATION

================

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

   Declare Function RegQueryValue Lib "shell" (ByVal hkey&,_

      ByVal SubKeyStr$, ByVal QueryStr$, Buffsize&) As Long

   Function GetObjectName$ (TheClassKey$)

      Dim ClassName$

      ClassName$ = Space$(255)

      X& = CLng(Len(ClassName$))

      cb = RegQueryValue(1, TheClassKey$, ClassName$, X&)

      GetObjectName$ = ClassName$

   End Function

The sample function above declares a string to pass as a parameter for a

return value in the RegQueryValue() function. RegQueryValue() has the

following four parameters:

   HKEY:        The handle to a key that defines what type of

                information you want to retrieve

   lpszSubKey:  A string that contains the OLE ClassKey that you want

                to look up

   lpszValue:   A string in which to place the resulting value

   lpcb:        The maximum length of the resulting string

To use the sample function GetObjectName(), create a control on a form with

the following properties:

   ControlName: <ObjName>

   ControlSource: =GetObjectName ("PBRUSH")

Any appropriate OLE ClassKey in the REG.DAT OLE database can be passed

to the function.

REFERENCES

==========

For more information on finding the ClassKey of an embedded object, query

on article Q99319 here in the Microsoft Knowledge Base.

Microsoft Windows "Programmer's Reference," version 3.1, Volume 2,

page 282

Additional reference words: 1.00 1.10 2.00 classname class key checkpage

KBCategory:

KBSubcategory: IntpOle


INF: Case Sensitivity in Queries Differs with Attached Tables

Article ID: Q100921

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you query on an attached table, the criteria are case sensitive.

However, when you query on a native Microsoft Access table, the criteria

are not case sensitive.

MORE INFORMATION

================

There are several ways to prevent case sensitivity in criteria when you

query on attached tables:

 - Import the attached table, and then base your query on the imported

   table. Criteria values will not be case sensitive.

 - Include a native Microsoft Access table joined to the attached table in

   the query. Criteria values will not be case sensitive.

 - Use the UCase() function in your query to ensure that the field in the

   query dynaset is returned in uppercase, and specify the criteria in

   uppercase. The following sample query demonstrates how to use the

   UCase() function in a query:

     Query: Query1

     --------------------------------

     FieldName: UCase(CITY)

        Show: True

        First Criteria Line: Like "S*"  (Note that the "S" is uppercase)

 - Another option is to be aware that you are using an attached table and

   make sure that the values you use for your criteria match the case of

   the values in the attached table.

Steps to Reproduce Behavior

---------------------------

1. Create a new Microsoft Access database and then attach the sample

   dBASE file NEWCUST.DBF. (This sample dBASE file is supplied with

   Microsoft Access.)

2. Create a new query based on the attached NEWCUST table. This query

   will be called QueryTest.

3. Drag all the NEWCUST table fields to the query grid.

4. Make the following change to the CITY column:

      Query: QueryTest

      ---------------------------------

      FieldName: CITY

         Show: True

         First Criteria Line: Like "s*"

   Note that the "s" is lowercase.

5. Run the query. The result will be an empty set.

6. Import the same dBASE table. Select the Database window, and

   then choose Import from the File menu. In the Data Source box,

   select dBASE III. Choose OK.

7. Recreate the query using steps 1-4. Make sure to base the query on

   the imported table.

8. Run the query. The results return all the records with Seattle as

   the city.

REFERENCES

==========

For more information about criteria in queries, search for "Criteria:

queries" using the Microsoft Access Help menu.

For more information about the UCase() function, search for "UCase, UCase$

Function" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 isam paradox btrieve fox pro

KBCategory:

KBSubcategory: QryOthr


INF: Changes in Security in Version 2.0

Article ID: Q112121

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes the changes in the Microsoft Access security model

from version 1.x to version 2.0.

MORE INFORMATION

================

The security model is essentially unchanged from version 1.x to version

2.0. The following internal items are changed in version 2.0 security:

 - The SID column of the MSysACEs table is no longer directly readable

   through the Microsoft Access user interface. This prevents users

   from directly reading the user SIDs and using them to breach

   security. To view and update permissions, you must use Access Basic.

 - In Microsoft Access version 1.x, users had permission to open any

   database that was not protected by the file system. In Microsoft

   Access version 2.0, there are two new database-level permissions to

   control this: Open/Run and Open Exclusive. You can use the Open/Run

   permission to lock unauthorized users out of your database entirely.

   You can use the Open Exclusive permission to prevent users from

   inadvertently locking each other out of multiuser applications by

   opening the database exclusively.

   As in Microsoft Access 1.x, once a user has opened a database there is

   no way, using the user interface, to prevent that user from creating new

   objects in the database. However, you can use Access Basic code to

   prevent users from creating new tables or queries in a database by

   revoking permissions on the Tables Container object.

 - The Microsoft Access 2.0 Setup program uses only the user and company

   names as seeds for the Admins group's SID. The version 1.x Setup program

   uses the user and company names, as well as the serial number from the

   installation disks.

 - Query permissions can cross database boundaries. This means you can use

   owner's permissions security with attached tables, as well as with local

   tables. The Run With Owner's Permissions query property in version 1.x

   has been replaced in version 2.0 by a query property called

   RunPermissions that can be set to User's or Owner's.

 - There was a known and documented hole in Microsoft Access version 1.x

   security whereby an unauthorized user could read a SID from a database

   and paste it over a SID in the MSysAccounts table in the SystemDB,

   thereby masquerading as a different user. The following changes were

   made to version 2.0 security to correct this problem:

    - System tables in version 2.0 are not updatable.

    - The SID columns in the MSysACEs and MSysObjects tables are

      unreadable in version 2.0.

    - The file encryption algorithm is enhanced. SIDs are readable by

      members of the Admins group only, and are not writable at all in

      version 2.0.

   Microsoft Access version 2.0 can run version 1.x databases, but they are

   still vulnerable to the version 1.x security hole. This is so that sites

   can run a mixed environment, with some users running Microsoft Access

   version 2.0 and others running Microsoft Access version 1.x. Microsoft

   Access version 2.0 cannot make changes to security in a version 1.x

   database unless the database is converted to version 2.0 format.

   Administrators of version 1.x sites that are upgrading to version 2.0

   should be aware that in order to prevent unauthorized users from

   exploiting the version 1.x security hole to break into a secure version

   2.0 system, it is necessary to re-create user and group accounts with

   the new longer PIDs, and to reassign permissions. If this is not done,

   it is possible for an unauthorized user to read a user's SID from an old

   version 1.x copy of the database and paste it over their own account's

   SID using Microsoft Access version 1.x and a version 1.x SystemDB. If

   the users' SIDs are re-created using Microsoft Access version 2.0, there

   is no way for an unauthorized user to ever read a user's SID.

   If you are not concerned about the possibility of an unauthorized user

   exploiting the 1.x security hole to break into a secure version 2.0

   system (perhaps because you are using security only to protect well-

   meaning users from inadvertently destroying data or applications, rather

   than protecting yourself from unauthorized intrusion), then you do not

   need to re-create your user and group accounts. Version 2.0 security

   will work properly with the old SIDs. Although the security in Microsoft

   Access version 2.0 is enhanced to protect your databases from unwanted

   intrusion, Microsoft recommends that you convert your databases to use

   version 2.0 security.

   When you are using the Microsoft Access 2.0 Upgrade disks to upgrade an

   existing version 1.0 or 1.1 installation to version 2.0, a new SystemDB

   is created. The old SystemDB is not changed in any way. If you want to

   use your old SystemDB and your old SIDs, use the Workgroup Administrator

   to join your old workgroup.

 - In Microsoft Access version 1.x, the Guests group is given read

   permissions on all objects by default. In Microsoft Access 2.0, the

   Guests group has no default permissions on newly created objects.

Additional reference words: 2.00 Security

KBCategory:

KBSubcategory: ScrtOthr


INF: Changing Area Codes Based on a Telephone Number Prefix

Article ID: Q96010

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Some states are adding new telephone area codes based on a phone

number's prefix. This article describes how to change a phone number's

area code in a table based on the prefix. This is accomplished by

creating a table with the prefix you want to find and the new area

code. An Access Basic function then reads this table into an array and

searches the phone number table and changes the area code in the phone

number table.

IMPORTANT: Before running this function, back up your database and make a

copy of your table.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

1. Create a table that will contain the phone number prefix to search

   and the new area code:

      Table: Area Codes To Change

      ---------------------------

      Field Name: Prefix

         Datatype: Text

      Field Name: Area Codes

         Datatype: Text

2. Enter in the phone number prefixes and area codes in the table Area

   Codes To Change. For example:

      Prefix      Area Codes

      ----------------------

      635            207

      634            208

3. Open a module or create a new one, and enter the following code:

   NOTE: In the following sample code, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this code in Access Basic.

   '*************************************************************

   'Declarations section of the module.

   '*************************************************************

   Option Explicit

   '=============================================================

   ' Create the following ChgAreaCode() function in the Module

   ' The following function will initialize:

   ' - A variable for the database object.

   ' - Variables for the table objects and several other objects.

   ' - Sets the database object to the opened database.

   ' - Opens table "Area Codes To Change" and tPhName.

   ' - The action of this function is to locate the phone number

   '     entries with certain prefixes and then change the

   '     corresponding area code. This function operates on numbers

   '     with the following format "(206) 635-7050". The table name

   '     and field name containing the phone number must be passed

   '     as arguments.

   '=============================================================

   Function ChgAreaCode (tPhName, fldPhone)

      Dim PhoneDB As Database

      Dim tPhone As Table, tPrefix As Table

      Dim PCount%

      Dim i%

      Dim tPrefixName$

      Dim Prefix$

      Dim SpacePos%

      Dim HyphenPos%

      Dim PrefixLen%

      Dim PrefixToFind$

      Dim AreaCode$

      Dim Lastfour$

      tPrefixName$ = "Area Codes To Change"

      If tPhName = "" Or fldPhone = "" Then Exit Function

      Set PhoneDB = CurrentDB()

      Set tPrefix = PhoneDB.OpenTable(tPrefixName$, 1)

      tPrefix.MoveLast

      PCount% = tPrefix.RecordCount

      tPrefix.MoveFirst

      ReDim PrefixArray$((PCount% - 1), 1)

      For i% = 0 To PCount% - 1 Step 1

         PrefixArray$(i%, 0) = tPrefix.Prefix

         PrefixArray$(i%, 1) = tPrefix.[Area Codes]

         tPrefix.MoveNext

      Next i%

      tPrefix.MoveFirst

      tPrefix.Close

      Set tPhone = PhoneDB.OpenTable(tPhName, 1)

      Do Until tPhone.EOF

         SpacePos% = InStr(1, tPhone(fldPhone), " ")

         HyphenPos% = InStr(SpacePos% + 1, tPhone(fldPhone), "-")

         PrefixLen% = (HyphenPos% - SpacePos%) - 1

         PrefixToFind$ = Mid(tPhone(fldPhone), SpacePos% + _

                            1, PrefixLen%)

         For i% = 0 To PCount% - 1 Step 1

            If PrefixArray$(i%, 0) = PrefixToFind$ Then

               AreaCode$ = PrefixArray$(i%, 1)

               Prefix$ = Mid$(tPhone(fldPhone), 7, 3)

               Lastfour$ = Right$(tPhone(fldPhone), 4)

               tPhone.Edit

               tPhone(fldPhone) = "(" & AreaCode & ") "_

                                     & Prefix & "-" & Lastfour

               tPhone.Update

            End If

         Next i%

         tPhone.MoveNext

      Loop

      tPhone.Close

      PhoneDB.Close

   End Function

When using this function, you pass (tPhName), the name of the table

containing the number to change, as a string. Then you pass (fldPhone),

the field name that contains the number to change, as a string.

Example

-------

This function can be called from the Immediate window for one time

execution as follows:

   ?ChgAreaCode("Contacts", "Business Phone")

Where "Contacts" is a table name and "Business Phone" is a field containing

the phone number.

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: PgmObj


INF: Click Right Mouse Button for Object Frame, OLE Properties

Article ID: Q114681

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

To view the property sheet for an object in a form or report in Design view

in Microsoft Access, you can click the right mouse button with the mouse

pointer in the object and then choose Properties. However, when you do this

with an OLE object, such as the Calendar custom control, instead of getting

a list of properties for the Calendar control, you get a list of properties

for the object frame.

This is correct behavior, since to Microsoft Access, the control is an

object frame only. Essentially, the object frame is a place holder in the

form for the OLE control. The OLE control connected to the object frame has

its own properties, events, and methods that are separate and distinct from

those of the object frame.

To see the properties, events, and methods for the OLE object, click the

right mouse button with the mouse pointer in the OLE object and then choose

the name of the OLE object.

MORE INFORMATION

================

The following example uses the Calendar OLE custom control included with

the Microsoft Access Developer's Toolkit version 2.0 to demonstrate the

differences between object frame properties and OLE object properties:

1. Start Microsoft Access and open any database.

2. Create a new, unbound form and then place an unbound object frame

   control on the form.

3. In the Insert Object dialog box, select the Insert Control option

   button.

4. In the Control Type box, select Calendar Control, and then choose OK.

5. If the property sheet is not already open, open it by choosing the

   Properties button on the toolbar. Note the "Object Frame: Embedded0"

   title for the property sheet. The property sheet contains the properties

   for the object frame itself, not for the Calendar control contained in

   the object frame.

6. With the mouse pointer in the Calendar control, click the right mouse

   button.

7. Choose Calendar Control Object, then choose Properties. A dialog box

   showing the Calendar control properties will be displayed.

REFERENCES

==========

For more information about embedded OLE objects, search for "unbound object

frame" then "Embedding an OLE Object in an Unbound Object Frame" using the

Microsoft Access Help menu.

Additional reference words: 2.00 ADT

KBCategory:

KBSubcategory: IntpOle


INF: Compound Indexes Must Restrict First Indexed Field

Article ID: Q98793

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Before an index can be used, queries with restrictions on multiple-field

(compound) indexes must restrict at least the first field of the index. You

can, however, also use adjacent fields in the index (up to 10 fields). If

the restriction is placed on a field other than the first field, the query

optimizer scans the table rather than using the index. This is not always

desirable, since table scans are slower than index searches for most

queries.

MORE INFORMATION

================

By default, when a compound index is created in Microsoft Access, no

individual indexes are assigned to the fields included in the compound

index. This behavior is by design.

For the query optimizer to use an index, you must use a comparison of

either the first field in the compound index or the first field and any

number of adjacent fields (up to 10) that make up the compound index. You

must query the indexed fields in the order they appear in the Indexes

window, beginning with the first indexed field and continuing with adjacent

fields.

NOTE: This principle also applies to using criteria with the Find

method in Access Basic.

For example, consider a table (T1) containing three fields: key_part1,

key_part2, and key_part3. If there is a composite index created on these

three fields and all fields are the primary key, then:

   SELECT * FROM T1 WHERE key_part2 = <value>

does not use the index because the first field, key_part1, is not used.

   SELECT * FROM T1 WHERE key_part1 = <value> AND key_part3 = <value>

also does not use the index, because, although key_part1 is referred to,

key_part1 and key_part3 are not adjacent fields.

However, each of the following three SQL statements do use the index

because they each include the first field, or the first field and one or

more adjacent fields of the composite index:

   a. SELECT * FROM T1 WHERE key_part1 = <value>

   b. SELECT * FROM T1 WHERE key_part1 = <value> AND key_part2 =

      <value>

   c. SELECT * FROM T1 WHERE key_part1 = <value> AND key_part2 =

      <value> AND key_part2 = <value>

The above fields are not prohibited from having indexes on them; individual

indexes can be built for each field, allowing comparisons on those fields

with index searches. Be aware, however, that indexes can take up as much

(or more) space than the data.

REFERENCES

==========

For more information on creating indexes, search for "indexes: creating"

then "Creating an Index" using the Microsoft Access Help menu.

For more information about optimizing queries with Rushmore technology,

search for "Rushmore technology" then "Optimizing Queries with Rushmore

Technology" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 index query performance multi

KBCategory:

KBSubcategory: TblPriky


INF: Concatenating Fields in a Text box to Remove Blank Lines

Article ID: Q95917

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to concatenate multiple fields for use in a

form or report. This is especially useful in a mailing label report

when some fields are null or empty. Null fields can cause blank lines

to be printed on a report. Additionally, from a form, you may want to

be able to copy and paste an entire name and address into another

application like Microsoft Word for Windows.

Using the IIF() and the IsNull() functions, you can determine if a

field is blank. If a field is blank, it returns an "empty" value.

Chr(13) and Chr(10) are used to add a return and a line feed to the

text box.

MORE INFORMATION

================

The following steps can be used to create a concatenated field

eliminating blank lines. In this example, the Employees Table from

the sample database NWIND.MDB is used.

1. Create a new form or a report. Create your report based on the

   table or query where the information resides.

2. Add a text box control to the form/report.

   NOTE: In the following example, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this expression.

   Object: Text Box

   ----------------

   ControlName:  Full Address

   ControlSource:

      =IIf (IsNull([FIRST NAME]),"",[FIRST NAME] & " ") &_

       IIf (IsNull([LAST NAME]),"",[LAST NAME]&Chr(13)&Chr(10)) &_

       IIf (IsNull([ADDRESS]),"",[ADDRESS] & Chr(13) & Chr(10)) &_

       IIf (IsNull([CITY]),"",[CITY] & ", ") &_

       IIf (IsNull([REGION]) ,"",[REGION] & " ") &_

       IIf (IsNull([POSTAL CODE]),"",[POSTAL CODE])

   Can Grow:   Yes

   Can Shrink: Yes

When the form or report is printed, there will be no blank lines.

For more information, search for "IIF," then "IsNull," then "Chr,"

then "Concatenation" using the Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsOthr


INF: Connecting to SYBASE SQL Server from an ODBC Application

Article ID: Q101073

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

 - Microsoft Visual Basic version 3.0 for Windows

 - Microsoft FoxPro version 2.5 for Windows

---------------------------------------------------------------------

SUMMARY

=======

You can connect to a SYBASE SQL Server computer from an ODBC application

(such as Microsoft Access, Microsoft Visual Basic, or Microsoft FoxPro for

Windows) using the ODBC SQL Server driver. This article describes how to

set up the ODBC data sources.

If you are already connected to SYBASE SQL Server from Microsoft

Windows DB-Library applications, no other components are necessary.

MORE INFORMATION

================

The key to both Microsoft SQL Server and SYBASE SQL Server

connectivity is a module called the Net-Library. This module consists

of two interfaces: one with the network and one with the application.

The network interface is customized to support a particular network;

however, the application interface remains the same.

Since ODBC, DB-Library, APT-SQL, APT-Library, and so forth communicate

with the Net-Library, these utilities can be written independent of

the network. The ODBC SQL Server driver, in particular, can be used to

connect either to a Microsoft SQL Server computer or to a SYBASE SQL

Server computer (on a UNIX or VMS system), as long as there is a

Net-Library for whatever network you are using.

The following paragraphs discuss how to connect to a SYBASE SQL Server

from an ODBC application. The remainder of the article assumes that

you are connected to a SQL Server called "Mysqlsvr." This server

should be set up as an ODBC data source, using the ODBC Control Panel

utility, as follows:

1. Open ODBC Control Panel and choose Add.

2. Select SQL Server from the list of installed drivers and choose OK.

3. In the ODBC SQL Server Setup dialog box, type a data source name

   and a description (optional).

   Note that a single server can function as multiple ODBC data

   sources, since each database in the server can be a data source.

   The data source name need not be the same as the server name.

4. Enter the true name of the server, then enter the network address.

   Since a SYBASE SQL Server on UNIX uses sockets and not

   named pipes, the network address must contains the IP address and

   the port identification number. This string is in the form

   "ip_address,port" (for example, "11.1.14.40,3180").

   For a SYBASE SQL Server on a VAX system, this string should be in

   the form "<node address>,<process_id>", where <node address> is the

   DECnet node address of the server and <process_id> is the process

   identification number to use for the connection (for example,

   "1.997,141").

   The Network Library field should contain the name of the

   Net-Library you need to use. This is dependent on what network you

   are using. For example, if you are using the FTP Software product

   PCTCP, the Net-Library name is "wdbftptc".

5. Choose Options to specify a database name or a language name.

6. Choose OK to go back to the first screen.

7. Run the INSTCAT.SQL script file.

   NOTE: This is a file containing SQL statements that will create

   certain stored procedures needed to process ODBC calls. Without

   these procedures, Microsoft Access cannot attach a SQL Server

   table and Visual Basic is not able to function correctly.

   At the UNIX command line or the MS-DOS prompt, type the following:

      isql -S<servername> -Usa -P<sa-password> -i<path>\instcat.sql

Finally, note that if the above procedure is followed correctly, the

following changes appear in the ODBC.INI and WIN.INI files. The [Data

Sources] section of ODBC.INI will contain the following entry:

   <data-source-name>=SQL Server

where <data-source-name> is the name of the data source that you

added. There will be a new section called [data-source-name]

containing the location of the SQL Server driver and a description of

the data source. The [SQLSERVER] section of the WIN.INI will contain

the following entry:

   data-source-name=<net-library-name>,<network address>

The following products are manufactured by vendors independent of

Microsoft: DECnet, VMS, and MicroVAX by Digital Equipment Corporation;

FTP Software by FTP Software, Inc.; DB-Library, Net-Library, and

SYBASE SQL Server by Sybase, Inc.; and UNIX by UNIX System

Laboratories. We make no warranty, implied or otherwise, regarding

these products' performance or reliability.

Additional reference words: 1.10 2.00 third-party

KBCategory:

KBSubcategory: ObcOthr


INF: Conversion of Oracle Data Types to Microsoft Access

Article ID: Q104977

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Column, or field, data types are different for each database management

system. This means that when you are accessing table structures from other

database management systems, a conversion, or data type mapping, must

occur. This article describes the data type mapping between Oracle and

Microsoft Access data types.

MORE INFORMATION

================

The following table demonstrates data type mapping between Oracle and

Microsoft Access data types:

Oracle data type      Maps to Microsoft Access data type

--------------------------------------------------------

Char(n)               Text(n)

VarChar(n)            Text(n)

Long                  Memo

Date                  Date/Time

Long Raw              Ole Object

Float                 Double

RowID                 Text(18)

Smallint              Text(255)

Note that the Smallint data type is the same as an Oracle data type of

Number(38,0).

In Oracle, the creator of the table can define the precision (the total

number of digits) and scale (the number of digits to the right of the

decimal point) for columns with Number data types. If a Number data type is

specified without a precision or scale, the column defaults to a data type

of Number(9,2). The scale limit is 38, and a scale without a precision is

allowed. Values with different precisions and scales are mapped as below:

Oracle number            Microsoft Access data type

---------------------------------------------------

Scale = 0 and

     precision <= 4      Integer

     precision <= 9      Long Integer

     precision <= 15     Double

Scale > 0 and  <= 4

     precision <= 15     Double

Scale > 4 and/or

     precision > 15      Text

If an Oracle data type is defined with a precision and scale that does not

map to any data type in Microsoft Access, it will be mapped to a text data

type. For example, an Oracle Smallint data type, which is actually a

Number(38,0) data type, will map into Microsoft Access as a text data type

since Microsoft Access does not have a number value of 38 precision.

Additional reference words: 1.00 1.10 2.00 ADK

KBCategory:

KBSubcategory: TblDatyp


INF: Converting Graphs from Microsoft Graph Version 3.0 to 5.0

Article ID: Q112127

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you convert a Microsoft Access database from version 1.x to 2.0, your

graphs are not updated automatically from Microsoft Graph version 3.0 to

5.0. This article describes how to convert the graphs in a Microsoft Access

2.0 database to Microsoft Graph version 5.0.

MORE INFORMATION

================

The following steps describe how to convert your graphs from Microsoft

Graph version 3.0 to 5.0:

1. In Program Manager, double-click the Graph AutoConvert icon in your

   Microsoft Access 2.0 program group.

2. In the AutoConversion dialog box, select the On option button and

   then choose OK.

3. Convert your Microsoft Access version 1.x database to version 2.0.

   For more information about converting databases from version 1.x to

   2.0, search for "converting databases to version 2.0" using the

   Microsoft Access 2.0 Help menu.

4. Open the converted database in Microsoft Access 2.0.

5. Open in Design view a form or report that contains a graph.

6. Double-click the graph object to start Microsoft Graph 5.0.

7. From the File menu, choose Exit & Return To Form: <Form Name>, or

   choose Exit & Return To Report: <Report Name>.

8. Close the form or report. When you are prompted to save your changes,

   choose Yes.

Your graph is now converted to Microsoft Graph version 5.0.

REFERENCES

==========

For more information about Microsoft Graph, search for "graph" using the

Microsoft Access Help menu.

Additional reference words: 2.00 Microsoft Graph 2.0 5.0 convert chart

KBCategory:

KBSubcategory: IntpGrph


INF: Converting Julian Dates with Access Basic

Article ID: Q92816

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Most government agencies and contractors require the use of Julian

dates. (A Julian date starts with a two-digit year, then counts the

number of days from January 1, as printed on many desktop calendars.)

Microsoft Access does not have any built-in functions for using or

converting Julian dates to standard dates. However, you can write a

function in Access Basic to do this. Below is an Access Basic function

which converts a Julian date to a standard serial date in Microsoft

Access. Note that the following sample code assumes the year is in the

20th century. The code must be changed to process dates after the year

2000.

MORE INFORMATION

================

The following sample function, ConvertJulian(), can be used to convert

Julian dates to standard dates:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Option Explicit

   Function ConvertJulian (JulianDate as Long)

      ConvertJulian = DateSerial(1900 + Int(JulianDate / 1000),_

                       1, JulianDate Mod 1000)

   End Function

Examples of How to Use the ConvertJulian() Function

---------------------------------------------------

Example 1:

1. Create a new unbound form and add two unbound text boxes (called

   field0 and field2) to the form.

2. In the ControlSource property of field2 type:

      =ConvertJulian([field0])

3. Switch to Form view. Enter "90001" (without quotation marks) in the

   first text box. The Julian date in the first text box will be converted

   and displayed as a standard date in the second text box.

Example 2:

1. Create a new table called Table1 with one field. Name the field

   Julian, with a data type of Number. Save the table.

2. View the table in Datasheet view. Add the following values to the

   table:

      90001

      90010

      92100

3. Create a new query based on Table1 and drag the Julian field onto

   the query grid.

4. In the Field row of another column on the query grid, enter the

   following:

      Normal: ConvertJulian([Julian])

5. Run the query. Note that the Julian dates are converted to standard

   dates.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Copying Query that Cannot Be Opened in Design View

Article ID: Q109955

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If a query's SQL statement is too long, you cannot open the query in Design

view and you receive the error message:

   Expression is too long.

This article describes a sample Access Basic function you can use to

retrieve a copy of the query's SQL statement to use as a basis for re-

creating the query.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

The following example demonstrates how to create and use the sample

Access Basic function Print_SQL():

 1. Open the database that contains the query you want to retrieve.

 2. Enter the following code in a new or existing module:

       Function Print_SQL(QueryName As String)

          Dim db As Database, q As QueryDef

          Set db = CurrentDB()

          Set q = db.OpenQueryDef(QueryName)

          Debug.Print q.sql

       End Function

 3. Compile the function.

 4. To test the function, type the following in the module's Immediate

    window, and then press ENTER. Make sure to substitute the name of

    your query for <QueryName>:

       ? Print_SQL("<QueryName>")

    The SQL-command version of the query will be printed in the Immediate

    window.

 5. If you want to use the query being displayed in the Immediate window

    as the basis for a new query, select the entire SQL command in the

    Immediate window, then choose Copy from the Edit menu.

 6. Create a new, unbound query.

 7. From the View menu, choose SQL.

 8. If there is any text in the SQL window, delete it.

 9. From the Edit menu, choose Paste.

10. The SQL command will appear in the SQL window. Make any necessary

   changes to the SQL command to shorten it, then choose OK. Your query

   will appear in the query grid.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.1, Chapter 8,

"Manipulating Data," page 132

Additional reference words: 1.00 1.10 2.00 recreate query sql

KBCategory:

KBSubcategory: QryOthr


INF: Correct Syntax for TransferDatabase to dBASE and Paradox

Article ID: Q97519

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you attempt to export a Microsoft Access table to dBASE or Paradox,

you may encounter errors. This article explains the correct argument syntax

for exporting the Categories table from the sample database NWIND.MDB to

dBASE III using the TransferDatabase macro action. The equivalent Access

Basic syntax is also explained.

MORE INFORMATION

================

NOTE: Both of the following examples export the Categories table to

a dBASE file in the C:\DBASE directory. You need to enter a valid

directory in your macro or you may receive the following error

message when you run the macro or function:

   isn't a valid path

Example 1 - Using the TransferDatabase Macro Action

---------------------------------------------------

Create a macro named Export1. This macro will export the Categories

table to a dBASE file.

   Macro Name     Action

   -------------------------------

   Export1        TransferDatabase

   Export1 Actions

   ------------------------------

   TransferDatabase

      Transfer Type:   Export

      Database Type:   dBASE III

      Database Name:   C:\dbase

      Object Type:     Table

      Source:          Categories

      Destination:     Test1.dbf

      Structure Only:  No

NOTE: To use the TransferDatabase macro action to export to a

Paradox table, you must choose "Paradox" for the Database Type

argument and enter the Destination argument as "Test1.db".

Example 2 - Using an Access Basic Function

------------------------------------------

Create a new module and enter the following function:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Function ExportdBASE ()

      DoCmd TransferDatabase a_export, "dBASE III", "c:\dbase", _

               a_table, "Categories", "Test1.dbf"

   End Function

Additional reference words: 1.00 1.10 2.00 docerr errmsg

KBCategory:

KBSubcategory: DcmOthr


INF: Could not Find SYSTEM.MDA or UTILITY.MDA File

Article ID: Q90105

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When Microsoft Access is started, one or both of the following error

messages may be displayed:

   Couldn't find file 'SYSTEM.MDA' (version 1.x)

   Couldn't find file '<path>\SYSTEM.MDA' (version 2.0)

   Couldn't find file 'UTILITY.MDA' (version 1.x)

   Couldn't find file '<path>\UTILITY.MDA' (version 2.0)

These errors occur if the SystemDB and UtilityDB settings in the [Options]

section of the MSACCESS.INI file in version 1.x, or the MSACC20.INI file in

version 2.0, point to a directory that does not contain the SYSTEM.MDA or

UTILITY.MDA file. These errors also occur if the directory points to a

share to which there is no connection.

If the directory does not exist, the following error message is

displayed:

   Invalid Path '<pathname>' (version 1.0)

   '<pathname>' isn't a valid path (versions 1.1 and 2.0)

MORE INFORMATION

================

A good way to manage the MSACCESS.INI or MSACC20.INI file is to keep backup

copies that pertain to particular setups. Have one set up for starting in a

workgroup on a network and have another that allows for starting on a local

machine. To change setups, copy the appropriate backup .INI file over the

MSACCESS.INI or MSACC20.INI file.

Additional reference words: 1.00 1.10 2.00 errmsg checkpage

KBCategory:

KBSubcategory: StpOthr


INF: Count() Ignores Null Values

Article ID: Q92747

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

----------------------------------------------------------------------

SUMMARY

=======

NULL values are ignored when using a query to perform a count.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create Table1 with two text columns as follows:

      Column1    Column2

      -------    -------

       foos

       ball

       foosball   junk

       null

       notnull    junk

2. Open a new query based on Table1.

3. From the View menu, choose SQL. Enter the following SQL query:

      SELECT Column2, COUNT(Column2)

      FROM Table1

      GROUP BY Column2;

4. Run the query. The result of the query is:

      Column2    Count(Column2)

      -------    --------------

                       0

       junk            2

Workaround

----------

To count NULL values, count on a primary key column, a column that

contains unique values, a counter column, or a dummy column where all

records equal 1.

The new SQL statement would read:

   SELECT Column2

   COUNT(PrimaryKey)

   FROM Table1

   GROUP BY Column2;

REFERENCES

==========

Online Help, search on "Count" and select the topic "Calculating

Totals in a Query" and "Count Function" for more information.

Additional reference words: 1.00 1.10 2.00 queries count

KBCategory:

KBSubcategory: QryOthr


INF: Create and Drop Tables and Relationships Using SQL DDL

Article ID: Q116145

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 includes a Data Definition Language (DDL)

that you can use to create and drop tables and relationships. These same

operations can also be performed with Access Basic using data access

objects (DAO). This article describes some of the operations that are

available in DDL. Note that all the examples in this article assume that

the statements will be added to a Microsoft Access query and will be run by

choosing Run from the Query menu.

MORE INFORMATION

================

To use data definition statements, create a new query. Then, choose SQL

Specific then Data Definition from the Query menu. Enter your data

definition statement in the Data Definition Query window, then run the

query by choosing Run from the Query menu.

To create a table with a PrimaryKey field with a Counter data type, and a

field called MyText with a Text data type with a length of 10, enter the

following statement in the Data Definition Query window and then run the

query.

NOTE: In the following sample queries, an underscore (_) at the end of a

line is used as a line-continuation character. Remove the underscore from

the end of the line when re-creating these queries.

   CREATE TABLE Table1 (Id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY, _

   MyText TEXT (10))

The Foreign Key side of a relationship does not require a PrimaryKey and

can be created by running the following query. This query creates a table

with one field with a Long data type, and one field with a Text data type

with the default size of 255:

   CREATE TABLE Table2 (Id LONG, MyText TEXT)

After creating both tables, running the following query will create a one-

to-many relationship between Table1 and Table2, with Table1 as the primary

side of the relationship:

   ALTER TABLE Table2 ADD CONSTRAINT Relation1 FOREIGN KEY ([Id]) _

   REFERENCES Table1 ([Id])

To delete the relationship between the tables, run the following query:

   ALTER TABLE Table2 DROP CONSTRAINT Relation1

To delete Table1, run the following query:

   DROP TABLE Table1

To delete Table2, run the following query:

   DROP TABLE Table2

You can also run DDL statements using the RunSQL action. To run a DDL

statement with Access Basic, use a procedure similar to the following

example:

   Sub ExecuteSQLDDL (SQLString As String)

      Dim db As Database, qd As QueryDef

      Set db = DBEngine.Workspaces(0).Databases(0)

      Set qd = db.CreateQueryDef("")

      qd.SQL = SQLString

      qd.Execute

      db.Close

   End Sub

To call this Sub procedure, use the following syntax:

   ExecuteSQLDDL "DROP TABLE Table1"

REFERENCES

==========

For more information about DDL queries, search for these topics using the

Microsoft Access Help menu: "CREATE TABLE (SQL)," "ALTER TABLE (SQL),"

"CONSTRAINT (SQL)," "CREATE INDEX (SQL)," and "DROP (SQL)"

Microsoft Access "User's Guide," version 2.0, Chapter 9, "Importing,

Exporting, and Attaching," page 169, Chapter 10, "Query Basics," page 199,

and Chapter 12, "Advanced Queries," pages 285 and 288

Additional reference words: 2.00

KBCategory:

KBSubcategory: QrySqldd


INF: CreateControl() and CreateReportControl() Functions

Article ID: Q93095

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses the Microsoft Access functions CreateControl()

and CreateReportControl(). If you intend to write your own FormWizards

or ReportWizards, you can use these functions to create controls on a

form or report that are available in Design view.

This article is for those who are already familiar with Access Basic and

with designing forms and reports.

MORE INFORMATION

================

You can use the CreateControl() and CreateReportControl() functions to

create new controls for a form or report opened in Design view. These

functions require two arguments: the name of the form or report as a string

value and a numeric code that represents the control type.

Here are the control types and their associated numeric codes:

   Integer   Control Type

   --------------------------------------

   100       label

   101       rectangle

   102       line

   103       (not used)

   104       command button

   105       option button

   106       check box

   107       option group

   108       bound object frame

   109       text box

   110       list box

   111       text box with drop-down grid

   112       subform/subreport

   113       graph

   114       unbound object frame

   118       page break

CreateControl() and CreateReportControl() both return a control object

value. Therefore, you need first to define a control variable, and

then set the control variable equal to the function name.

For example, the following procedure creates a form and then adds a button

to the form:

   Dim MyForm As Form, MyControl As Control

   Set MyForm = CreateForm()

   Set MyControl = CreateControl(MyForm.FormName, 104)

When the procedure is finished, you can modify the properties of the new

control by using the control variable you defined. For example, you can

change the control's Width and Caption properties with these statements:

   MyControl.Width = 2000

   MyControl.Caption = "&Sum All Records"

For controls that are frequently associated with a field in a table or

query, you can modify the ControlSource property to bind the control to

the field.

By default, some controls are created with their Height and Width

properties set to zero to make them invisible. Also by default, controls

appear in the upper-left corner of the form. You can adjust the size and

position of a control immediately after you create it by changing the

control's properties. For example, the following code creates, sizes,

moves, and then binds a text box to a field by changing the properties:

   Set MyControl = CreateControl(MyForm.FormName, 109)

   MyControl.Width = 1500

   MyControl.Height = 200

   MyControl.Top = 440

   MyControl.Left = 200

   MyControl.ControlSource = "[Category ID]"

In addition to the form name and the code for the type of control, you can

also specify the form or report Section where you want Microsoft Access to

place the control.

The following is the CreateControl() syntax. The CreateReportControl()

syntax is identical.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Function CreateControl (FormName As String,_

                           ControlType As Integer_

                           [,SectionNumber As Integer])

SectionNumber is the Section property setting number that identifies a

particular section as follows:

   Detail section ................................ 0

   Form or report header section ................. 1

   Form or report footer section ................. 2

   Form or report page header section ............ 3

   Form or report page footer section ............ 4

   Group-level 1 header section (reports only) ... 5

   Group-level 1 footer section (reports only) ... 6

   Group-level 2 header section (reports only) ... 7

   Group-level 2 footer section (reports only) ... 8

If a report has additional group-level sections, the header/footer pairs

are numbered consecutively beginning with 9.

REFERENCES

==========

For more information on Microsoft Access libraries, query on the following

words here in the Microsoft Knowledge Base:

   libraries and debugging and creating

For more information on other AccessWizard functions, query on the

following words here in the Microsoft Knowledge Base:

   CreateControl and CreateReportControl and CreateForm and

   CreateReport and "Section Property" and DeleteControl and

   DeleteReportControl and CreateGroupLevel

For more information on the CreateForm(), CreateReport(), CreateControl(),

and CreateReportControl() functions, search for each function name and then

view its topic using the Microsoft Access version 2.0 Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Creating a Crosstab Query with Multiple Value Fields

Article ID: Q109939

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In a Microsoft Access crosstab query, you can specify only one field

or calculation as the value. Often it is desirable to show more than

one value in the query.

For example, the following shows two columns of information per

company, a count of the number of orders, and the order totals for each

year:

Company Name  1989 Orders  1989 Total  1990 Orders  1990 Total

--------------------------------------------------------------

ABC Company   12           $855.00     15           $1010.25

XYZ Company   1017         $22045.57   1050         $25345.29

This type of query is sometimes called a Multiple Value Field query.

MORE INFORMATION

================

In order to create a Multiple Value Fields crosstab query, you must

create two separate crosstab queries with fixed column headings for each

value you want to calculate. These two queries can then be joined

together using a Select query to display the desired results.

The following example uses the sample database NWIND.MDB to create a query

that displays results similar to the example above, showing the

number of sales, and total, for each year for each company.

Step One: Create the "Order Total" Crosstab Query

-------------------------------------------------

1. Open the sample database NWIND.MDB and create the following Crosstab

   query based on the Orders, Order Details, and the Customers tables.

   Query: Order Total

   ------------------

   Type: Crosstab Query

   Join: Customers.[Customer ID] <-> Orders.[Customer ID]

   Join: Orders.[Order ID] <-> Order Details.[Order ID]

   Field:  Company Name

      Table Name: Customers

      Total: Group By

      Crosstab: Row Heading

   Field: Expr1: Year([Order Date]) & " " & "Order Total"

      Table Name:

      Total: Group By

      Crosstab: Column Heading

   Field: Expr2: Sum(CCur([Unit Price]*[Quantity]*(1.-[Discount])))

      Table Name:

      Total: Expression

      Crosstab: Value

2. Choose Query Properties from the View menu, select the Fixed Column

   Headings check box and type the following entries in the Fixed Column

   Headings box:

   "1989 Order Total";"1990 Order Total";"1991 Order Total";"1992 Order

   Total"

   NOTE: In Microsoft Access version 2.0, the Fixed Column Headings

   property is called Property Headings.

Step Two: Create the "Order Count" Crosstab Query

-------------------------------------------------

1. Create the following Crosstab query based on the Orders and the

   Customers tables:

   Query: Order Count

   ------------------

   Type: Crosstab Query

   Join: Customers.[Customer ID] <-> Orders.[Customer ID]

   Field: Company Name

      Table Name: Customers

      Total:      Group By

      Crosstab:   Row Heading

   Field:  Year([Order Date]) & " " & "Order Count"

      Table Name:

      Total:      Group By

      Crosstab:   Column Heading

   Field:  Order ID

      Table Name: Orders

      Total:      Count

      Crosstab:   Value

2. Choose Query Properties from the View menu, select the Fixed Column

   Headings check box and type the following entries in the Fixed Column

   Headings box:

   "1989 Order Count";"1990 Order Count";"1991 Order Count";"1992 Order

   Count"

Step Three: Create the "Multiple Values" Query

----------------------------------------------

1. Create the following Select query based on the Order Totals and

   Order Count Crosstab Queries:

   Query: Multiple Values

   ----------------------

   Join: Order Total.[Company Name] <-> Order Count.[Company Name]

   Field:  Company Name

      Table Name: Order Count

      Show: Yes

   Field: 1989 Order Count

      Table Name: Order Count

      Show: Yes

   Field: 1989 Order Total

      Table Name: Order Total

      Show: Yes

   Field: 1990 Order Count

      Table Name: Order Count

      Show: Yes

   Field: 1990 Order Total

      Table Name: Order Total

      Show: Yes

Running the Multiple Values query will result in a table that looks

like the following:

Company Name  1989 Order Count 1989 Order Total 1990 Order Count ...

--------------------------------------------------------------------

Always Open   1                $855.38          4

Andre's       0                0                3

Anthony's     4                $3,364.71        6

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 6, "Designing

Select Queries," pages 150-155

Microsoft Access "User's Guide," version 1.1, Chapter 6, "Designing

Select Queries," pages 154-159

Additional reference words: 1.00 1.10 2.00 crosstab query select

KBCategory:

KBSubcategory: QryCross


INF: Creating Fixed-Scale Graphs in Reports and Forms

Article ID: Q109737

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Graph versions 3.0 and 5.0

---------------------------------------------------------------------

SUMMARY

=======

When you graph records with Microsoft Graph in Microsoft Access, Microsoft

Graph automatically adjusts the value axis scale for each record. This

article describes how to create a graph with a fixed scale for all records

manually.

MORE INFORMATION

================

By default, Microsoft Graph adjusts the value axis scale for each record

in the graph. If you want a fixed-value axis scale for all records, you

must modify settings in the Microsoft Graph Format Scale dialog box. The

following settings can be adjusted in the Format Scale Dialog box:

 - Auto: Indicates that Microsoft Graph will automatically adjust chart

   scale values. Clear the Auto check boxes to set fixed scale values.

 - Minimum: The minimum value of the value axis scale. This value

   is typically set to zero, but can be set to other values.

 - Maximum: The maximum value of the value axis scale. This value should

   be greater than or equal to the largest value in the records you are

   charting.

 - Major Unit: The primary unit of measure on the value axis. This value

   represents the increment value for tick marks on the scale.

 - Minor Unit: The secondary unit of measure on the value axis. This

   setting applies to tick marks falling between the major units. This

   value must be greater than zero and less than or equal to the major

   unit value. This setting is typically set to the value of the major

   unit.

 - Category (X) Axis Crosses At: This value determines where on the value

   axis the category axis will fall. Typically, this value is set to

   zero.

 - Values In Reversed Order: This setting inverts the chart and displays

   the lowest value on the scale at the top of the chart, and the highest

   value at the bottom of the chart.

The following example demonstrates how to create a graph, and how to

adjust the scale settings for a fixed-scale value axis:

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Orders table, and then

   save the query as Percentage Test Query1:

      Query:  Percentage Test Query1

      ------------------------------------------------------

      Type: Select Query

      Join: None

      Field: Order ID

         Criteria: None

      Field: Order Amount

         Criteria: > 0

      Field: Freight

         Criteria: > 0

      Field:  PercentValue: [Freight] / [Order Amount] * 100

         Criteria: <= 1.0

3. Create the following new report based on the Percentage Test Query1

   query, and then save the report as Fixed Scale Graph Report:

      Report: Fixed Scale Graph Report

      ------------------------------------------------

      Text box:

         ControlSource: Order Id

      Text Box:

         ControlSource: PercentValue

      Graph:

         Data Source: Percentage Query1

         Totals: Sum (default)

         Type: Horizontal Bar (top row, 2nd from left)

         Data to graph: PercentValue

         Link to Report: Yes

         Link Fields: Order Id

4. Preview the report. Note that each graph has a different horizontal

   scale.

5. View the report in Design view. Double-click the graph object to

   start Microsoft Graph.

6. Double-click the bottom horizontal scale in the graph, then click the

   Scale tab in the Format Axis dialog box. Modify the settings in the

   Format Axis dialog box to match the following, and then choose OK:

      Auto: clear all Auto check boxes

      Minimum: 0

      Maximum: 1

      Major Unit: 0.1

      Minor Unit: 0.1

7. From the File menu, choose Exit And Return To Microsoft Access.

   Choose Yes when you are prompted to update the graph.

8. Preview the report. Note that the value scales are consistent for

   all the records.

REFERENCES

==========

Microsoft Graph "User's Guide," version 3.0, Chapter 3, "Formatting

the Axis Scale," pages 87-92

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpGrph


INF: Creating Floating Pop-Up Menus

Article ID: Q95444

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create "floating" pop-up menus using a

combination of Microsoft Windows application programming interface (API)

calls and Access Basic code.

MORE INFORMATION

================

To create a floating pop-up menu, perform the following eight steps.

1. Create a new form called "Pop-up Menu Form."

2. Add a List Box control called "Menu" to the form. Make the control

   large enough to display each of the strings it contains without

   displaying a scroll bar. Give the control the following properties:

      List Box Properties

      ----------------------------------------------

      ControlName:   Menu

      RowSourceType: Value List

      RowSource:     String1;String2;String3;String4

      AfterUpdate:   =ItemSelected([Menu])

      Left:          0 in

      Top:           0 in

      FontName:      System

      FontSize:      8

      FontWeight:    Bold

   NOTE: Specify the menu strings in the RowSource property. Separate

   succeeding string values with a semicolon (;) character.

3. Change the properties of the "Pop-up Menu Form" as indicated below.

      Form Properties

      ------------------------------------------------

      ScrollBars:      Neither

      Popup:           Yes

      RecordSelectors: No

      Width:           <Width of the list box control>

      Section Properties

      -------------------------------------------------

      Height:          <Height of the list box control>

4. Save the form and close it.

5. Create a new module and place the following code into the

   Declarations section for the module.

      'NOTE: Some of the following Windows API functions may be

      'defined in an existing Microsoft Access library. If so, the new

      'declarations would cause a duplication procedure name error. If

      'this error occurs, remove the offending declare statement from

      'your code or convert the declaration to a comment.

      'NOTE: In the following sample code, an underscore (_) is used

      'as a line continuation character. Remove the underscore when

      're-creating this code in Access Basic.

      Option Explicit

      Type POINTAPI

         x As Integer

         y As Integer

      End Type

      Global Const GWL_STYLE = (-16)

      Global Const WS_DLGFRAME = &H400000

      Declare Sub GetCursorPos Lib "User" (lpPoint As POINTAPI)

      Declare Function GetWindowLong& Lib "User" (ByVal hWnd%,_

                          ByVal nIndex%)

      Declare Function SetWindowLong& Lib "User" (ByVal hWnd%,_

                          ByVal nIndex%, ByVal dwNewLong&)

6. Add the following functions to the module.

      Function ShowPopup ()

         Dim coord As POINTAPI

         Dim attr&

         GetCursorPos coord

         DoCmd OpenForm "Pop-up Menu Form"

         attr& = GetWindowLong(Forms![Pop-up Menu Form].hWnd, GWL_STYLE)

         attr& = SetWindowLong(Forms![Pop-up Menu Form].hWnd, GWL_STYLE, _

                    attr& And Not WS_DLGFRAME)

         DoCmd MoveSize (coord.x * 14), (coord.y * 14), , 1100

      End Function

      Function ItemSelected (WhichItem As String)

         DoCmd Close

         MsgBox "The selected item was " & Trim(WhichItem)

      End Function

7. Choose the form in which you want the pop-up menu to appear. Open

   the form in Design view.

8. Select the event property that you want to use to activate the

   pop-up menu and specify the following function call:

      =ShowPopup()

When you open your form and cause the event assigned in Step 8 above,

the pop-up menu appears at the current mouse position. The menu remains

on the screen until you select an item from the pop-up menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: Creating Mailing Labels for Dot-Matrix Printers

Article ID: Q103433

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Creating labels that print on dot-matrix or tractor-feed printers

usually requires you to adjust the page size. Before you create a

mailing label report for these printers, you must first set the

default printer and paper size in Microsoft Windows Control Panel.

MORE INFORMATION

================

Setting Default Printer/Paper Size in Control Panel

---------------------------------------------------

To set the default printer and paper size, do the following:

1. In the Printers dialog box in Control Panel, select a dot-matrix

   printer, then choose the Set As Default Printer button. (If you do

   not already have a dot matrix printer driver installed, you must

   first install one.)

2. Choose the Setup button to display the dialog box for that printer.

3. In the Paper Size box, select User-Defined Size.

4. In the User-Defined Size dialog box, select the unit of measurement

   and then type the width and the length of the mailing label page.

   To determine the width, measure from the left edge of the leftmost

   label to the right edge of the rightmost label. To determine the

   length, measure from the top of the first label to the top of the

   second label.

   For example, if you use two-up labels that measure 3 inches by 5

   inches (with .25 inches between), set Unit to 0.01 inches, Width to

   625, and Length to 525.

5. Choose OK twice, then choose Close.

   Once you set the printer and paper size, you can create a mailing

   label report for a dot-matrix printer using the Mailing Label

   ReportWizard, or using tools provided in the Design view of the

   report.

Creating a Mailing Label Report Not Using ReportWizard

------------------------------------------------------

1. Open your report in Design view and remove the page header and

   footer. (You need only the Detail section for this report.)

2. Adjust the size of the Detail section as follows:

   a. Make the width the same as the width of one label.

   b. Make the height the same as the height of one label.

3. Add controls to the Detail section, making sure that the controls

   do not overlap. To create margins for the labels, place the text

   boxes at least 0.2 inches from all edges of the Detail section.

4. From the File menu, choose Print Setup and verify or set the

   following values in the Print Setup dialog box:

   a. In the Paper group, set Size to User-Defined Size and Source to

      Tractor.

   b. Set all margins to 0.0 inches.

   c. In the Item Size group, make sure the Same as Detail check box is

      selected. (Choose the More button to display the Item Size group.)

   d. If there is more than one label across the page, you must also set

      the following items:

      1) In the Items Across box, enter the number of labels across.

      2) In the Row Spacing box, enter the amount of space between the

         bottom of one label and the top of the next.

      3) In the Column Spacing box, enter the amount of space between

         the right edge of one label and the left edge of the next.

   NOTE: When a dot-matrix printer is the default in Control Panel and

   you have Paper Size set to User-Defined Size, Microsoft Access uses

   only that paper size. If you want to create or print a label or

   report on a page of a different size, remember to change the

   user-defined page size in Control Panel before you create or print

   your label or report.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptLabel


INF: Creating Reports to Mail Merge Microsoft Access Data

Article ID: Q98798

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To use a mail merge with Microsoft Access data, you can export or copy your

data to a word processor, or in Microsoft Access 2.0, you can choose the

Merge It button on the toolbar. However, you can also create a Microsoft

Access report to generate simple mail-merge documents. This article

demonstrates how to generate a mail-merge document.

MORE INFORMATION

================

The following is an example of a business letter that you can create:

NOTE: All values shown in angle brackets (<>) are found in the

underlying table.

KB Advertising Agency

<February 5th, 1993>

<John Doe>

<123 E. Main Street>

<Middle Town, OH 44044>

Dear <Mr. Doe>,

We are pleased to announce our new line of office furniture. As a

<valued> customer, you are entitled to a <10>% discount off our

catalog prices.

Call us today toll-free at (800) 555-1212 and receive a free

full-color catalog detailing all our top-of-the-line office products.

Sincerely,

J. Grant

Manager, Office Products

How to Create the Sample Document

---------------------------------

1. Create the following new table:

      Table: Customer

      ---------------------

      FieldName: Salutation

      DataType: Text

      FieldName: First Name

      DataType: Text

      FieldName: Last Name

      DataType: Text

      FieldName: Address

      DataType: Text

      FieldName: City

      DataType: Text

      FieldName: State

      DataType: Text

      FieldName: ZIP

      DataType: Text

      FieldName: Customer Type

      DataType: Text

      FieldName: Discount Pct

      DataType: Number

2. Enter the following records in the new table:

   Salu-   First  Last                                      Cust     Disc

   tation  Name   Name   Address   City       State  ZIP    Type     Pct

   ----------------------------------------------------------------------

   Mr.     John   Doe    123 Main  Middleton  OH     44044  Valued   10

   Mrs.    Sally  White  52A Elm   Florence   KY     45123  Special  5

   Dr.     Fred   Weiss  Box 456   Camden     SC     29332  Super    25

3. Create the following new report based on the Customer table:

   NOTE: Do not use a Microsoft Access ReportWizard to create this report.

   a. From the Layout menu in Microsoft Access 1.x, or the Format menu in

      Microsoft Access 2.0, turn off Report Hdr/Ftr and Page Hdr/Ftr (so

      that no check mark appears next to either command).

   b. Add all the table controls to the report's detail section.

   c. Delete the default text box labels.

   d. Set the following properties:

         Report: Merge Letter

         ----------------------

         RecordSource: Customer

         Section: Detail

         ---------------------------

         ForceNewPage: After Section

         CanGrow: Yes

         Control: Label

         ------------------------------

         ControlName: Company Label

         Caption: KB Advertising Agency

         Control: Text Box

         ------------------------

         ControlName: Todays Date

         ControlSource: =Date()

         Format: Long Date

         Control: Text Box

         ------------------------------------------------

         ControlName: Name Line

         ControlSource: =[First Name] & " " & [Last Name]

         Control: Text Box

         -------------------------

         ControlName: Address Line

         ControlSource: =[Address]

         Control: Text Box

         -----------------------------------------------------

         ControlName: CSZ Line

         ControlSource: =[City] & ", " & [State] & " " & [ZIP]

         Control: Text Box

         ----------------------------------------------------------------

         ControlName: Salutation Line

         ControlSource: ="Dear " & [Salutation] & " " & [Last Name] & ","

         Control: Text Box

         ------------------------------------------------------------------

         ControlName: Para 1

         ControlSource: ="We are pleased to announce our new line of office

                          furniture. As a " & [Customer Type] & "customer,

                          you are entitled to a" & [Discount Pct] & "%

                          discount off our catalog prices."

         CanGrow: Yes

         Control: Label

         ----------------------------------------------------------------

         ControlName: Rest of Letter

         Caption: Call us today toll-free at (800) 555-1212 and receive a

                  free full-color catalog detailing all our

                  top-of-the-line office products.

4. Add the following label controls:

      Sincerely,

      J. Grant

      Manager, Office Products

5. Size and position the controls, then set the font styles and sizes.

   NOTE: Press CTRL+ENTER to force new lines and paragraphs in

   controls.

6. Save the report. Print or preview the report to see the results of

   the merge.

Summary and General Notes

--------------------------

 - Fixed paragraphs should be entered in label controls.

 - Variable paragraphs should be entered in text box controls.

 - Margins are determined by the width of the control. The text will

   wrap within the width of the control, not the width of the letter.

 - The ControlName of a text box must be different from its field name

   in the table. If they are the same, the ControlName prints as a

   "#Error?" message.

Limitations

-----------

 - You cannot change the formatting of individual words. You can change

   only the formatting of the control.

 - You are limited to 255 characters in the ControlSource property of a

   text box. For long paragraphs, create one or more invisible text

   boxes to contain the text, then concatenate them in a visible text box.

Additional reference words: 1.00 1.10 2.00 mailmerge page header

KBCategory:

KBSubcategory: RptOthr


INF: Creating Virtual Indexes with SQL Data-Definition Queries

Article ID: Q112131

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

If your server supports the creation of SQL views, you can achieve a

compromise between pass-through and Microsoft Access queries by creating a

view on the server and then attaching it. The Microsoft Jet database engine

treats an attached view exactly like an attached table (with no indexes).

The processing defined in a view is always performed by the server, no

matter what the Jet database engine decides to execute locally.

MORE INFORMATION

================

If your server supports updating through views, you need to create an index

specification on the attachment to tell Microsoft Access which fields

uniquely specify a record returned by the view. This lets the Jet database

engine create an updatable dynaset on the view, and on Microsoft Access

queries and forms that use it.

For example, you could run the Microsoft Access data-definition query

   CREATE UNIQUE INDEX index1 ON SeptemberOrders (OrderID)

on an attached view named SeptemberOrders that returns a subset of the

remote Orders table and has a unique field named OrderID.

This query does not create anything on the server, nor does it take any

extra space in your Microsoft Access database. It simply tells the Jet

database engine that the OrderID field is the primary key for the attached

view. Note that this is not a "real" index in that it does not improve

query performance. It is only used to serve as a reference for the Jet

database engine.

REFERENCES

==========

For more information about data-definition queries, search for "Data

Definition" then "Data Definition Command" using the Microsoft Access Help

menu.

Additional reference words: 2.00 Attaching

KBCategory:

KBSubcategory: QryOthr


INF: Criteria Parameters Require Concatenated References

Article ID: Q95978

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access has both a SQL interpreter and an Access Basic

interpreter. Because some Access Basic commands and functions require

SQL syntax as a parameter, it may become confusing how the two work

together.

For example, if you need to look up a description in a table called

Categories where [Category ID] is equal to whatever value is currently

in Forms!Form1!Field1, you cannot use:

NOTE: In the following sample code, an underscore _ is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

   DLookUp("Description", "Categories",_

         "[Category ID] = Forms!Form1!Field1")

Instead, you must concatenate the value of Forms!Form1!Field1 into the

criteria parameter as shown below:

   DLookUp("Description", "Categories",_

      "[Category ID] = '" & Forms!Form1!Field1 & "'")

This means that if the value of Forms!Form1!Field1 is "BEVR," the

criteria parameter in the expression above would evaluate to:

   [Category ID] = 'BEVR'

MORE INFORMATION

================

When you make a function call such as:

   DLookUp("Description", "Categories", "[Category ID] = 'BEVR'")

Access Basic internally creates a SQL statement with the parameters

you supply. In this case, the resulting SQL statement is:

   SELECT Description FROM Categories WHERE [Category ID] = 'BEVR'

Access Basic sends this statement to the Access SQL engine, which

returns the result of the SELECT statement back to Access Basic, and,

in turn, back to your DLookUp() expression.

Note that that a DLookUp() coded as follows

   DLookUp("Description", "Categories",_

      "[Category ID] = Forms!Form1!Field1")

would result in a WHERE clause that looks like:

   [Category ID] = Forms!Form1!Field1

The SQL parser is designed to accept SQL syntax, and the

Forms!Form1!Field1 reference is Access Basic syntax, so the form

reference cannot be expected to work. Instead, the resulting evaluated

criteria parameter must be done in such a way as to accommodate the

syntax rules of the SQL parser.

Note that this also applies to other Access Basic methods and

functions that require a criteria parameter. For example, Find methods

use a criteria parameter as shown below:

   Dim D As Database, S As Snapshot

   Set D = CurrentDB()

   Set S = D.CreateSnapshot("Categories")

   myvar = "BEVR"

   S.FindFirst "[Category ID] = '" & myvar & "'"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Currency is Significant to Four Digits

Article ID: Q92680

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When using the currency data type within Access Basic, be aware that

numbers are significant to four digits to the right of the decimal

point.

MORE INFORMATION

================

The reason for this is that most financial information, such as

mortgage rates and stocks, require four digit precision.

Currency variables are stored as 64-bit numbers (8 bytes) in a

two's complement integer format and scaled by 10,000 to give a

fixed-point number with 15 digits to the left of the decimal point

and 4 digits to the right. This representation provides a range of

-922,337,203,685,477.5808 to 922,337,203,685,477.5807. The Currency

data type is extremely useful for calculations involving money and for

fixed-point calculations in which accuracy is particularly important.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Custom Domain Functions Similar to DFirst() and DLast()

Article ID: Q103403

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

By design, the DFirst() and DLast() functions always return the first and

last record that you entered in the underlying table, not the first and

last record listed in the sorted query. This article provides examples of

how to write custom domain functions that can be used in a way similar to

DFirst() and DLast().

The DStart() and DEnd() custom domain examples in this article return

the first and last records listed in a sorted query. Also included in

this article is the DFix() function, which can be used to overcome a

limitation of concatenating variables into criteria strings.

Information about the limitations of custom domain functions and how

to use DFix() appears at the end of the article.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications with the programming tools

provided with Microsoft Access.

MORE INFORMATION

================

Create a new module within Microsoft Access and add the following

functions with the appropriate declaration section. Each command

should be entered on one line.

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

'-------------------------------------

' GLOBAL DECLARATION

'-------------------------------------

Option Compare Database

Option Explicit

'--------------------------------------

' Use DStart()instead of DFirst() to return

' the first sorted record in a domain.

'--------------------------------------

Function DStart (FieldName As String, DomainName As String, _

                 Criteria As String)

   Dim MyDB As Database, Myset As Dynaset

   ' ERROR OUT IF THERE IS NO FIELDNAME SENT.

   If Len(FieldName) = 0 Then

      MsgBox "You Must Specify a Field name", , "DStart"

      End

   End If

   ' ERROR OUT IF THERE IS NO DOMAIN SENT.

   If Len(DomainName) = 0 Then

      MsgBox "You Must Specify a Domain name", , "DStart"

      Exit Function

   End If

   Set MyDB = CurrentDB()

   Set Myset = MyDB.CreateDynaset(DomainName)

   '

   If Len(Criteria) > 0 Then

      Myset.Filter = Criteria

      Set Myset = Myset.CreateDynaset()

   End If

   ' IF THERE ARE NO RECORDS, RETURN THE NULL, ELSE RETURN THE VALUE

   ' OF THE FIRST RECORD.

   If Myset.EOF Then

      DStart = Null

   Else

      Myset.MoveFirst

      DStart = Myset(FieldName)

   End If

   Myset.Close

   MyDB.Close

End Function

'-------------------------------------------

'Use DEnd()instead of DLast() to return

'  the last sorted record in a domain.

'--------------------------------------

Function DEnd (FieldName As String, DomainName As String, _

               Criteria As String)

   Dim MyDB As Database, Myset As Dynaset

   ' ERROR OUT IF THERE IS NO FIELDNAME SENT.

   If Len(FieldName) = 0 Then

      MsgBox "You Must Specify a Field name", , "DEnd"

      Exit Function

   End If

   ' ERROR OUT IF THERE IS NO DOMAINNAME SENT.

   If Len(DomainName) = 0 Then

      MsgBox "You Must Specify a Domain name", , "DEnd"

      Exit Function

   End If

   Set MyDB = CurrentDB()

   Set Myset = MyDB.CreateDynaset(DomainName)

   If Len(Criteria) > 0 Then

      Myset.Filter = Criteria

      Set Myset = Myset.CreateDynaset()

   End If

   If Myset.EOF Then

      DEnd = Null

   Else

      Myset.MoveLast

      DEnd = Myset(FieldName)

   End If

   Myset.Close

   MyDB.Close

End Function

Function DFix (ByVal T, DQuote As Integer)

   '------------------------------------------------------------------

   ' Fixes string arguments that are passed

   '   to Criteria in domain functions

   '

   ' DQuote should be TRUE or -1 if Double Quotes (") delimit Criteria

   ' DQuote should be FALSE or 0 if Single Quotes (') delimit Criteria

   '

   ' For example, this gives an error

   '   (note the quote (') in the data)

   '   X="Mike's Diner"

   '   A=DStart("ID","Clients","Name='" & X & "'")

   '

   ' Use either:

   '   X=DFix("Mike's Diner",False)

   ' Or:

   '   A=DStart("ID","Clients","Name='" & DFix(X,False) & "'")

   '------------------------------------------------------------------

   Dim P As Integer, OldP As Integer, Q As String * 1

   If VarType(T) = 8 Then

      If DQuote = 0 Then

         Q = "'"

      Else

         Q = """"

      End If

      P = InStr(T, Q)

      Do While P > 0

         OldP = P + 2

         T = Left$(T, P) & Q & Mid$(T, P + 1)

         P = InStr(OldP, T, Q)

      Loop

   End If

   DFix = T

End Function

General Limitations to Custom Domain Functions

----------------------------------------------

 - You cannot use Forms!FormName!ControlName or Form.ID in quotation

   marks. For example, instead of

      DStart("ID","LOG","Name=Form.Name")

   use:

      DStart("ID","LOG","Name = '" & DFix(Name,False) & "'")

   The DFix() function is another custom function.

 - You must always specify a criteria, even if it is "" or Null.

 - Do not place field names or domain names in square brackets ([]),

   that is, use "First Name" instead of "[First Name]".

NOTE: DFix() can be used anywhere you concatenate criteria strings,

such as the FindFirst method or when building custom SQL criteria.

REFERENCES

==========

For information about other custom domain functions, query on the

following words here in the Microsoft Knowledge Base:

   custom and domain and function

Additional reference words: 1.00 1.10 2.00 ab dfirst dlast modules

KBCategory:

KBSubcategory: PgmOthr


INF: DAO2016.DLL Not Available from External Applications

Article ID: Q115899

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

You cannot call the DAO2016.DLL file from an application written in C to

use DAO code to control Microsoft Access tables.

The only application that can call the DAO2016.DLL file is Microsoft Access

version 2.0. Trying to call this dynamic-link library (DLL) from any other

program will not work and is not supported by Microsoft.

MORE INFORMATION

================

DAO2016.DLL (the filename refers to Data Access Objects, version 2.0, 16

bit) is the DLL that Microsoft Access uses from Access Basic to modify

database objects in the Microsoft Jet database engine.

If you try to use OLE functions from C/C++ to use this DLL, you will

receive the error message "VBAJET.DLL not found." This is a misleading

error message in that the file VBAJET.DLL does not exist as part of the

Microsoft Access installation at all. A more appropriate error message

would be "Feature not available."

Using tools such as OLE2VIEW.EXE from Microsoft Visual C++, it is possible

to look at some of the objects and methods that are exposed in the

DAO2016.DLL file. This is analogous to looking at the entry points to a

DLL, except that the information is in a form that is more useful and

easier to decode.

While these methods are listed, there is no documented way to call them,

and they are not registered in the Microsoft Windows Registration database

as OLE Methods that are available for OLE Automation.

Neither Microsoft Access nor the Microsoft Jet database engine are OLE

Servers. They cannot be controlled using OLE Automation techniques.

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: IntpOlea


INF: Data Source Dialog Box Does Not List ODBC Data Sources

Article ID: Q105512

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

When you are attempting to attach or import a table that is accessible

through ODBC (such as a SQL Server, Sybase SQL Server, or Oracle table),

the Data Source dialog box does not list the table as a choice.

In order to make working with ODBC data sources as transparent as possible,

there is no explicit choice for each source in the Data Source dialog box.

To select an ODBC data source, select SQL Database in the Data Source

dialog box. Another dialog box will appear displaying a list of servers

with available ODBC data sources.

REFERENCES

==========

For more information on data sources, search for "data source" using the

Help menu.

Additional reference words: 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: Data Type of Value Overrides Data Type of Variable

Article ID: Q98796

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access internally converts values with implicit data type

definitions before assigning those values to variables. This may result

in unexpected rounding of numbers, or in the following error message:

   Invalid Number

MORE INFORMATION

================

You can implicitly define the data type of a value by appending a

type-declaration character at the end of the value. For example,

x=1234& implicitly defines 1234 as a Long data type (four-byte

integer).

Steps to Reproduce Behavior

---------------------------

1. Open a new module.

2. Add the following line underneath the Option Declare Database line:

      Dim v as Currency

3. Press ENTER.

4. From the View menu, choose Immediate Window.

5. In the Immediate window, type the following:

      v=123456789123.3456789#

6. Press ENTER, then type the following line

      debug.print v

   and press ENTER again.

   The value of the variable <v> is now 123456789123.3457. The number

   sign (#) implicitly defined the value as a double-precision value.

   Microsoft Access internally converted the value to that data type

   before assigning it to the currency variable.

7. Repeat steps 5-6, replacing # with other type-declaration

   characters (such as the ampersand (&), exclamation point (!), or at

   sign (@) symbol).

   The at sign defines the currency data type, which is limited to

   four decimal places. When you try to define a number with more than

   four decimal places as currency, an "invalid number" error message

   is displayed.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 25-26

Microsoft Access "Introduction to Programming," version 1.0, pages 49-51

Additional reference words: 1.00 1.10 2.00 ui misc

KBCategory:

KBSubcategory: PgmOthr


INF: Database Normalization Basics

Article ID: Q100139

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains database normalization terminology for

beginners. A basic understanding of this terminology is helpful when

discussing the design of a relational database.

MORE INFORMATION

================

Description of Normalization

----------------------------

Normalization is the process of organizing data in a database. This

includes creating tables and establishing relationships between those

tables, according to rules designed both to protect the data and to

make the database more flexible by eliminating two factors: redundancy and

inconsistent dependency.

Redundant data wastes disk space and creates maintenance problems. If

data that exists in more than one place must be changed, the data must

be changed in exactly the same way in all locations. A customer

address change is much easier to implement if that data is stored only

in the Customers table and nowhere else in the database.

What is an "inconsistent dependency"? While it is intuitive for a user

to look in the Customers table for the address of a particular

customer, it may not make sense to look there for the salary of the

employee who calls on that customer. The employee's salary is related

to, or dependent on, the employee and thus should be moved to the

Employees table. Inconsistent dependencies can make data difficult to

access; the path to find the data may be missing or broken.

There are a few rules for database normalization. Each rule is called

a "normal form." If the first rule is observed, the database is said

to be in "first normal form." If the first three rules are observed,

the database is considered to be in "third normal form." Although

other levels of normalization are possible, third normal form is

considered the highest level necessary for most applications.

As with many formal rules and specifications, real world scenarios do

not always allow for perfect compliance. In general, normalization

requires additional tables and some customers find this cumbersome. If

you decide to violate one of the first three rules of normalization,

make sure that your application anticipates any problems that could

occur, such as redundant data and inconsistent dependencies.

NOTE: The following descriptions include examples.

First Normal Form

-----------------

 - Eliminate repeating groups in individual tables.

 - Create a separate table for each set of related data.

 - Identify each set of related data with a primary key.

Do not use multiple fields in a single table to store similar data.

For example, to track an inventory item that may come from two

possible sources, an inventory record may contain fields for Vendor

Code 1 and Vendor Code 2.

But what happens when you add a third vendor? Adding a field is not

the answer; it requires program and table modifications and does not

smoothly accommodate a dynamic number of vendors. Instead, place all

vendor information in a separate table called Vendors, then link

inventory to vendors with an item number key, or vendors to inventory

with a vendor code key.

Second Normal Form

------------------

 - Create separate tables for sets of values that apply to multiple

   records.

 - Relate these tables with a foreign key.

Records should not depend on anything other than a table's primary key

(a compound key, if necessary). For example, consider a customer's

address in an accounting system. The address is needed by the

Customers table, but also by the Orders, Shipping, Invoices, Accounts

Receivable, and Collections tables. Instead of storing the customer's

address as a separate entry in each of these tables, store it in one

place, either in the Customers table or in a separate Addresses table.

Third Normal Form

-----------------

 - Eliminate fields that do not depend on the key.

Values in a record that are not part of that record's key do not

belong in the table. In general, any time the contents of a group of

fields may apply to more than a single record in the table, consider

placing those fields in a separate table.

For example, in an Employee Recruitment table, a candidate's

university name and address may be included. But you need a complete

list of universities for group mailings. If university information is

stored in the Candidates table, there is no way to list universities

with no current candidates. Create a separate Universities table and

link it to the Candidates table with a university code key.

EXCEPTION: Adhering to the third normal form, while theoretically

desirable, is not always practical. If you have a Customers table

and you want to eliminate all possible interfield dependencies, you

must create separate tables for cities, ZIP codes, sales

representatives, customer classes, and any other factor that may

be duplicated in multiple records. In theory, normalization is

worth pursing; however, many small tables may degrade performance

or exceed open file and memory capacities.

It may be more feasible to apply third normal form only to data that

changes frequently. If some dependent fields remain, design your

application to require the user to verify all related fields when any

one is changed.

Other Normalization Forms

-------------------------

Fourth normal form, also called Boyce Codd Normal Form (BCNF), and

fifth normal form do exist, but are rarely considered in practical

design. Disregarding these rules may result in less than perfect

database design, but should not affect functionality.

***********************************

*  Examples of Normalized Tables  *

***********************************

Normalization Examples:

Unnormalized table:

    Student#   Advisor   Adv-Room  Class1   Class2   Class3

    -------------------------------------------------------

    1022       Jones      412      101-07   211-02   214-01

1. First Normal Form:  NO REPEATING GROUPS

   Tables should have only two dimensions. Since one student has

   several classes, these classes should be listed in a separate

   table. Fields Class1, Class2, & Class3 in the above record are

   indications of design trouble.

   Spreadsheets often use the third dimension, but tables should not.

   Another way to look at this problem: with a one-to-many

   relationship, do not put the one side and the many side in the same

   table. Instead, create another table in first normal form by

   eliminating the repeating group (Class#), as shown below:

     Student#   Advisor   Adv-Room    Class#

     ---------------------------------------

     1022      Jones      412       101-07

     1022      Jones      412       143-01

     1022      Jones      412       159-02

     4123      Smith      216       201-01

     4123      Smith      216       211-02

     4123      Smith      216       214-01

2. Second Normal Form:  ELIMINATE REDUNDANT DATA

   Note the multiple Class# values for each Student# value in the

   above table. Class# is not functionally dependent on Student#

   (primary key), so this relationship is not in second normal form.

   The following two tables demonstrate second normal form:

    Students:   Student#    Advisor   Adv-Room

                ------------------------------

                1022        Jones       412

                4123        Smith       216

    Registration:   Student#    Class#

                    ------------------

                    1022        101-07

                    1022        143-01

                    1022        159-02

                    4123        201-01

                    4123        211-02

                    4123        214-01

3. Third Normal Form: ELIMINATE DATA NOT DEPENDENT ON KEY

   In the last example, Adv-Room (the advisor's office number) is

   functionally dependent on the Advisor attribute. The solution is to

   move that attribute from the Students table to the Faculty table,

   as shown below:

    Students:   Student#    Advisor

                -------------------

                1022        Jones

                4123        Smith

    Faculty:    Name    Room    Dept

                --------------------

                Jones   412     42

                Smith   216     42

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 18-19

"FoxPro 2 A Developer's Guide," Hamilton M. Ahlo Jr. et al., pages

220-225, M & T Books, 1991

"Using Access for Windows," Roger Jennings, pages 799-800, Que

Corporation, 1993

Additional reference words: 1.00 1.10 2.00 BCNF relational model normal

KBCategory:

KBSubcategory: TblOthr


INF: dBASE SET DELETED Characteristic in Microsoft Access

Article ID: Q95388

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you delete a record in a dBASE or Microsoft FoxPro database, the

record is actually only marked for deletion. It is not permanently

removed until the database is packed in dBASE or FoxPro.

This characteristic can produce confusing effects when you open a

table in Datasheet view.

MORE INFORMATION

================

In dBASE or FoxPro, records that are marked for deletion still appear

in any output form, such as a table in Datasheet view or a report in

Print Preview, unless you SET DELETED to ON. Because of this,

Microsoft Access displays such records in an attached dBASE or FoxPro

table, even if the records are marked for deletion.

To reproduce this characteristic in Microsoft Access, use the

following steps:

1. Attach the dBASE table called NEWCUST.DBF. This table should be

   present in your Access program directory if you installed the

   sample databases with Microsoft Access.

2. Open the NEWCUST table in Datasheet view. Note that there are 13

   records in this table.

3. Select the last record in the table by clicking on the record

   selector on the leftmost side of the datasheet.

4. Press the DEL key. Note that the record disappears from the

   datasheet, leaving 12 records in this table.

5. Close the Datasheet window and reopen it. Note that all 13 records

   reappear.

It may seem that Microsoft Access deleted the record, then undeleted

it when you reopened the table. In reality, Microsoft Access marked

the record for deletion, but because the marked record still existed

in the table, Microsoft Access continued to display it in datasheet.

To prevent this problem from occurring, Microsoft Access provides

functionality identical to the dBASE and FoxPro SET DELETED command. To

take advantage of this functionality, be sure that you set Deleted to On

if you do not want records that have been marked for deletion to show. Use

the following procedure to do this:

1. Open MSACCESS.INI in Windows Notepad.

2. Find the section called [dBASE ISAM].

3. Change the setting...

   Deleted=Off

   -to-

   Deleted=On

4. Save the MSACCESS.INI file and restart Microsoft Access.

   When you view the dBASE data, records marked for deletion will no

   longer appear. To permanently remove records marked for deletion,

   you must open the dBASE table in dBASE format and run the PACK

   command.

dBASE is manufactured by Borland International, Inc., a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmXbase


INF: DDE Link Cannot Find Data; Opens 2nd Copy of Server App

Article ID: Q90881

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Using Microsoft Access and Dynamic Data Exchange (DDE) to access

information from an open DDE server application, such as Microsoft

Excel, where the data does not exist causes the following error

message to be displayed:

   Remote data not accessible. Start application Excel?

If you choose the Yes button in the message dialog box, a second copy

of Microsoft Excel is started with the name of the non-existent

spreadsheet in its title bar.

MORE INFORMATION

================

This behavior is correct unless you already have a spreadsheet with

the name given in the DDE link open in Microsoft Excel. If the DDE

link cannot find the spreadsheet, a second copy of Microsoft Excel

will be launched using the filename given in the DDE statement.

However, the DDE standard is not to have running applications open

documents.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 9,

"Dynamic Data Exchange"

Additional reference words: 1.00 1.10 2.00 errmsg checkpage

KBCategory:

KBSubcategory: IntpDde


INF: Debugging & Troubleshooting Tips for Attached SQL Tables

Article ID: Q102437

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

Listed below are some techniques that can be used to determine

indirect causes of error messages when using attached SQL tables:

1. Use Microsoft Windows File Manager to search for multiple,

   corrupted, or outdated copies of the following files:

      ODBC.DLL - dated 10-16-92 or later, with 44736 bytes

      DBNMP3.DLL - dated 9-15-92 or later, with 8241 bytes

      SQLSRVR.DLL - dated 10-16-92 or later, with 135792 bytes

      NETAPI.DLL - depends on the network being used

      COMMDLG.DLL - dated 10-25-92 or later, with 89248 bytes

      NOTE: The sizes and dates referenced are correct if the files

      were installed by Microsoft Access version 1.0.

2. Make sure that all the files listed in step 1 are in the

   appropriate locations. All files except NETAPI.DLL are usually

   installed in the Windows SYSTEM subdirectory. NETAPI.DLL is a

   network-specific driver; it is usually located in the network's

   program directory, which should appear in the path.

3. Use another application, such as the three listed below, on the

   same computer and try to attach the same data source:

    - Q+E (comes with Microsoft Excel)

    - SQL Server Administration Facility (SAF)

    - PowerBuilder

   If you cannot access the data source from another application, you

   may have a problem with the network, not with Microsoft Access or

   the Microsoft Open Database Connectivity (ODBC) driver.

4. Try to attach another data source, such as another SQL Server

   table, from a different database server. If you can attach the

   other data source, the original server may be unavailable, or you

   may need to reconfigure the entry for that server using the ODBC

   Administration utility.

5. Try to attach the same data source from a different computer. If

   you still cannot gain access to the SQL Server computer, you may

   have a network-wide problem, or perhaps the server is down or not

   communicating.

6. Try increasing the ODBC time-out settings in the [ODBC] section of

   your MSACCESS.INI file.

7. Rename the current ODBC.DLL, DBNMP3.DLL, and SQLSRVR.DLL files,

   restart the server, and reinstall ODBC.

   For more information on this procedure, see the Microsoft Access

   "User's Guide," version 1.0, Appendix D, "Setting Up Microsoft

   Access on a Network," pages 660-662.

PowerBuilder is manufactured by Powersoft Corporation, a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 tshoot

KBCategory:

KBSubcategory: PgmOthr


INF: Defragment and Compact Database to Improve Performance

Article ID: Q92681

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Compacting your database and defragmenting your hard drive will

improve the performance of Microsoft Access.

MORE INFORMATION

================

Since the data on your hard disk becomes fragmented over time, you

should run a disk defragmentation utility (or "defragmenter")

periodically. Within the file, portions of the database may also

become fragmented due to Microsoft Access. Because of this, you should

also run Compact from within Microsoft Access.

A disk defragmenter will place the database file in contiguous

clusters on your hard disk, making file access quicker in general. If

you do not defragment your hard disk, the time it takes for MS-DOS to

retrieve your file may increase since it must go to several physical

locations on the disk to retrieve the entire file.

The Compact option under the File menu will also aid in increasing the

performance of Microsoft Access. Compact makes a copy of the database,

rearranging how the database file is stored on disk if it is

fragmented.

File storage can become fragmented when you make many changes to a

database. The compacted database file is usually smaller. You can use

the same name as the original for the compacted database file, or you

can use a different name to create a separate file. If you use the

same name and the database is compacted successfully, Microsoft Access

automatically replaces the original file with the compacted version.

Limitations of Compact

----------------------

 - The compact operation succeeds only if you have enough storage space

   on your disk for both the original and compacted versions of the

   database.

 - You cannot compact a database when it is open. In a multiuser

   environment, the compact operation fails if another user has the

   database open.

Fragment or Compact First?

--------------------------

If you compact after running a defragmenter, you would theoretically

leave open disk space immediately after the .MDB file on the disk,

thereby allowing MS-DOS to place any additional information in the

next physical clusters (this would be very fast). However, if you

defragment after running Compact, your .MDB might be placed on the

first part of the disk followed by the rest of your files, with no

open disk space until the end (the inside tracks) of the disk. This

would result in somewhat slower disk access.

Additional reference words: 1.00 1.10 2.00 compaction

KBCategory:

KBSubcategory: GnlCmp


INF: DeleteControl, DeleteReportControl, and CreateGroupLevel

Article ID: Q93094

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses two Microsoft Access undocumented commands,

DeleteControl and DeleteReportControl, and an undocumented function,

CreateGroupLevel(). If you intend to write your own FormWizard or

ReportWizard, you can use the commands to delete controls on a form or

report that is available in Design view, and you can use the function to

create groups on a report that is available in Design view.

MORE INFORMATION

================

You can use DeleteControl and DeleteReportControl commands to delete a

control that exists on a form or report in Design view. Both commands

require a string value that represents the name of the form or report and

a string value that represents the name of the control.

DeleteControl and DeleteReportControl are commands, not functions. They do

not return a value.

The example below creates a form, then creates a button on the form,

displays a message, and deletes the button on the form:

   Dim MyForm As Form, MyControl As Control

   Set MyForm = CreateForm()

   Set MyControl = CreateControl(MyForm.FormName, 104)

   MsgBox "About to Delete " & MyControl.ControlName

   DeleteControl MyForm.FormName, MyControl.ControlName

When you delete a control using DeleteControl or DeleteReportControl,

there is no visual feedback that the control is gone if the form or report

is not minimized. The control still appears as if it were not deleted

even though you can not click it to give it focus. To make the deleted

control disappear, you must repaint the form design window by minimizing it

and then restoring it.

If you have a report available in Design view, you can create groups for it

in a procedure by using the CreateGroupLevel() function. Here is the syntax

for CreateGroupLevel():

   Function CreateGroupLevel(ReportName$,Expression$,

                             HasHeader$, HasFooter$)

ReportName is a string expression representing the report name.

Expression is a string expression representing the name of the field or

calculated field that you want to group by.

HasHeader and HasFooter indicate whether the group includes a group

header or group footer, respectively.

On execution, CreateGroupLevel() adds a group at the innermost level. For

example, if one group already exists, CreateGroupLevel() creates a second

group within the first group. CreateGroupLevel() returns a number

indicating which level it created, beginning with zero. In the example just

mentioned, CreateGroupLevel() returns one because it is the second group,

and the first group was Group zero.

REFERENCES

==========

For more information on Microsoft Access libraries, query on the following

words here in the Microsoft Knowledge Base:

   libraries and debugging and creating

For more information on other AccessWizard functions, query on the

following words here in the Microsoft Knowledge Base:

   CreateControl and CreateReportControl and CreateForm and

   CreateReport and "Section Property" and DeleteControl and

   DeleteReportControl and CreateGroupLevel

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Deleting Duplicate Records from Two Tables

Article ID: Q98664

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to delete duplicate records from two tables

and retain the most current information (records). In addition, the

article shows how to merge the results of these two tables.

MORE INFORMATION

================

This article walks you through creating two tables, TEST-1 and TEST-2,

with duplicate records. After adding additional nonduplicate records

to both these tables, you will delete the duplicate records from the

TEST-2 table. Finally, you will update the TEST-1 table to include

nonduplicate information from the TEST-2 table.

Steps to Reproduce Behavior

---------------------------

 1. Open the sample database NWIND.MDB.

 2. In the Database window, select the Shippers table.

 3. From the Edit menu, choose Copy.

 4. From the Edit menu, choose Paste.

 5. In the Paste Table As dialog box, type "TEST-1" (without quotation

    marks) in the Table Name field. Choose OK.

 6. Repeat steps 4 and 5, this time pasting the table as TEST-2.

 7. Open the TEST-1 table and add the following two additional company

    names:

       ABC Shipping

       XYZ Express

    Close the TEST-1 table.

 8. Open the TEST-2 table and add the following two new company names:

       Jiffy Ship

       Hurry Package

    Close the TEST-2 table.

 9. Create a new query based on the TEST-1 and TEST-2 tables.

10. In Microsoft Access version 1.x, join the tables on the Company Name

    field. In Microsoft Access version 2.0, remove the join between the

    Shipper ID fields, then join the tables on the Company Name field.

11. From the Query menu, choose Delete. For this example, the TEST-1 table

    will be considered the most current information; therefore, duplicate

    information will be deleted from the TEST-2 table.

12. From the TEST-1 table, drag Shipper ID and Company Name to the

    QBE grid. Note that the word "Where" appears on the Delete line

    in the QBE grid.

13. Drag the * from the TEST-2 table to the QBE grid. Note that the word

    "From" appears on the Delete line in the QBE grid.

14. From the Query menu, choose Run.

15. You will receive a message stating that three rows will be deleted.

    Choose OK.

16. Open the TEST-2 table. The only two records that remain are the

    nonduplicate records that you added in step 8 above. All the duplicate

    records have been deleted.

The remaining steps append the remaining nonduplicate records from the

TEST-2 table to the TEST-1 table.

17. Open the TEST-2 table.

18. From the Edit menu, choose Select All Records.

19. From the Edit menu, choose Copy.

20. Close the TEST-2 table and then open the TEST-1 table.

21. From the Edit menu, choose Paste Append. You will receive a message

    stating that two rows have been pasted into this table. Choose OK

    to complete the Paste Append.

Your most current information, without duplicates, is now in one table

(TEST-1).

Additional reference words: 1.00 1.10 2.00 queries unique union SQL

relational

KBCategory:

KBSubcategory: TblModfy


INF: Deleting Objects in Access Basic

Article ID: Q116148

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can delete objects programmatically using either the Delete method or

the DeleteObject action. The DeleteObject action can also be used in

macros.

MORE INFORMATION

================

The Delete method applies to the QueryDefs and TableDefs data access

collections, and can be used to delete queries and tables. The Delete

method does not apply to the Containers collection, and cannot be used to

delete objects such as forms or reports.

You can use the DeleteObject action to delete objects that you cannot

delete using the Delete method. Note that Microsoft Access does not request

user confirmation when you delete objects using either the Delete method or

the DeleteObject action.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Part 2, "The ABCs of

Access Basic"

For more information about the Delete method, search for "Delete" then

"Delete Method (Data Access)" using the Microsoft Access Help menu.

For more information about the DeleteObject action, search for

"DeleteObject" then "DeleteObject Action" using the Microsoft Access Help

menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Description of Btrieve

Article ID: Q114505

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Btrieve is not a full, stand-alone database application like Microsoft

Access or Microsoft FoxPro. This article describes how Btrieve works with

Microsoft Access and with Novell NetWare and non-NetWare networks.

MORE INFORMATION

================

Btrieve is not a full, stand-alone database program like Microsoft Access

or Microsoft FoxPro. Btrieve is a dynamic-link library (DLL), similar in

nature to a terminate-and-stay-resident (TSR) program in MS-DOS, that

provides the ability to read from and write to database files on a hard

disk. It is a record-managing engine only and does not have a user

interface.

You can attach Btrieve databases in Microsoft Access, or import data from

or export data to Btrieve databases. To use Btrieve without Microsoft

Access, you must first write a program (commonly known as a front end) to

access the Btrieve functions. These function calls specify the operation

you want the Btrieve engine to perform, and also send any necessary data.

Since Btrieve handles all data as complete and separate records, it does

not consider the actual contents of the records. To Btrieve, it is just

writing information to the hard disk. The only exception to this behavior

is when Btrieve deals with the portion of the record that has been

identified as an index. In this case, Btrieve uses this portion of the

record to create a binary tree index, which is sorted according to the

method applicable for the type of data it contains.

Non-NetWare Usage of Btrieve

----------------------------

In MS-DOS, Btrieve is accessed as a TSR whose functions are called by

interrupts made by the front end. The function performs the requested

operation on the specified file and then returns control to the front end.

In Microsoft Windows, Btrieve is accessed as a DLL named WBTRCALL.DLL.

This DLL contains the same functionality as mentioned above, except that

the parameters are passed directly.

NetWare Usage of Btrieve

------------------------

Btrieve is integrated into Novell NetWare networks and is used internally

by NetWare to create a full client/server environment. This is accomplished

by loading Btrieve on a server as a NetWare Loadable Module (NLM), and then

making function calls to the NLM over the network. Doing this requires a

combination of a TSR and a DLL.

The TSR is BREQUEST.EXE on the client (workstation). BREQUEST.EXE is a

network communication package that must be loaded before starting Windows,

and is activated by WBTRCALL.DLL. This version of WBTRCALL.DLL differs from

the one used in non-NetWare environments, even though they have the same

name. This DLL's only function is to activate the TSR, which in turn sends

the parameters across the network to the server. Where multiple servers are

used, Novell provides routers to connect them together so that only one

copy of Btrieve must be loaded on the main server.

Btrieve is manufactured by Novell Inc., a vendor independent of Microsoft;

we make no warranty, implied or otherwise, regarding this product's

performance or reliability.

Additional reference words: 1.00 1.10 2.00 Attaching

KBCategory:

KBSubcategory: IsmBtrv


INF: Description of Btrieve Section of WIN.INI File

Article ID: Q94827

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access uses the Btrieve section of the WIN.INI file when it

uses Btrieve files. After you install Microsoft Access, the WIN.INI file

contains the following default settings in the [btrieve] section:

   [btrieve]

   options=/m:64 /p:4096 /b:16 /f:20 /l:40 /n:12 /t:C:\ACCESS\BTRIEVE.TRN

MORE INFORMATION

================

Although these are the recommended option settings, you can change

these options in your WIN.INI file using the following table as a

guide. If the option you want to set is not on the line, add the

option and desired setting at the end of the line.

Option   Description                 Required Value

----------------------------------------------------------------------

/m       Memory Size                 At least 38

/p       Page Size                   4096

/b       Pre-Image Buffer Size       16

/f       Open Files                  At least 4

/l       Multiple Locks              At least double the setting for

                                     the Open Files option (/f)

/n       Files in a Transaction      At least 4

/t       Transaction Filename        Valid path to a .TRN file;

                                     in a multiuser environment, the

                                     network path to the .TRN file is

                                     shared by all users

/u       Compression Buffer Size     If your Btrieve data files are

                                     compressed, at least the length

                                     (in kilobytes) of the longest

                                     record in your data files

/i       Pre-image File Drive

/c       Index Compaction

/a       Activate Logging

/s       Discard Unneeded Segments

REFERENCES

==========

For more information on these options, see Novell's Btrieve for Windows

"Installation and Operation" manual.

In Microsoft Access version 2.0, see the Readme Help file (ACREADME.HLP).

Additional reference words: 1.00 1.10 2.00 arguments

KBCategory:

KBSubcategory: IsmBtrv


INF: Description of Btrieve/Xtrieve .DDF files

Article ID: Q113877

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Btrieve database files (which usually have .DAT extensions) consist of a

header page, multiple index pages, and multiple data pages. With the

exception of index fields located in the header page, none of these items

include any information about the data types or the locations of the fields

in the Btrieve database file. Also, while the header page contains

information about the number and types of indexes, it does not contain any

information about the non-index parts of the record. Since Microsoft Access

and Microsoft Visual Basic require specific information about each field,

they must use .DDF files, which contain the databases' data dictionary

information, to obtain this information.

MORE INFORMATION

================

There are seven available .DDF files: FILE.DDF, FIELD.DDF, INDEX.DDF,

ATTRIB.DDF, VIEW.DDF, USER.DDF, and RIGHTS.DDF. Microsoft Access version

2.0 requires only FILE.DDF and FIELD.DDF. Microsoft Access can maintain the

INDEX.DDF file for interoperability with Xtrieve, but the default is not to

maintain it.

When you are using .DDF files with Microsoft Access, bear the following in

mind:

 - Each file must use one of the seven names listed above, without

   any variation. For example, substituting FILE1.DDF for FILE.DDF will

   not work.

 - All the files must be in the same directory.

If either of these criteria are not met, Microsoft Access will not be able

to use the files and errors may occur.

Each Btrieve database file (.DAT file) contains only one table. Therefore,

a Btrieve application may have several .DAT files

File Definitions

----------------

FILE.DDF:

The FILE.DDF file contains the following elements:

 - The file ID number.

 - The table name.

 - The path to the file (including filename).

 - The file-type identifier.

A sample FILE.DDF might look like:

   Xf$ID  Xf$Name     Xf$Loc                 Xf$Flags

   --------------------------------------------------

   1      x$File      C:\MYDIR\FILE.DDF      16

   2      x$Field     C:\MYDIR\FIELD.DDF     16

   3      x$Index     C:\MYDIR\INDEX.DDF     16

   4      TestFile    TEST.DAT                0

   5      Datafile    Q:\PUBLIC\DATA.DAT      0

   6      MyData      MOREDATA\MYDATA.BTV     0

The sample FILE.DDF file above indicates that the FILE.DDF, FIELD.DDF, and

INDEX.DDF files (file numbers 1, 2, and 3) are in the directory C:\MYDIR.

The entry in the Xf$Flags column (16) indicates that these files are system

files that are used to locate other system files.

NOTE: Xtrieve uses the paths listed in the FILE.DDF file to search for

these system files. Microsoft Access, however, only looks for these files

in the same directory where the FILE.DDF file was found.

File numbers 4, 5, and 6 contain information on three Btrieve database

files that can be used by Microsoft Access as attached tables. The entry in

the Xf$Flags column (0) indicates that these are user-defined files.

File number 4, TestFile, does not have a path specified. Therefore,

Microsoft Access will search for this file in the directory in which it

found the FILE.DDF file.

File number 5, DataFile, has a drive and path specified. Microsoft Access

will search the specified drive and path for the file.

File number 6, MyData, has a path but no drive specified. Microsoft Access

will search for this file in the MOREDATA subdirectory of the directory in

which it found the FILE.DDF file.

The specifications for the FILE.DDF file are:

   FieldName     Description     DataType    Position   Length

   -----------------------------------------------------------

   Xf$ID         File ID         Integer        1          2

   Xf$Name       File Name       String         2         20

   Xf$Loc        File Location   String        23         64

   Xf$Flags      File Flags*     Integer       87          1

*If bit 4 equals 1, the file is a dictionary (.DDF) file. If bit 4 equals

0, the file is a user-defined file.

The "Xf$" prefixes are part of the Novell definition for these files.

Position is the offset from the beginning of the column, and Length is the

length of the field.

FIELD.DDF:

The FIELD.DDF file contains:

 - The ID number.

 - The file ID number (this is cross-referenced to FILE.DDF).

 - The field name (the column name in Microsoft Access).

 - The data type.

 - The offset.

 - The size.

 - The number of decimal places.

 - A case-sensitive flag.

A sample FIELD.DDF file might look like:

  Xe$Id Xe$File Xe$Name Xe$DataType Xe$Offset Xe$Size Xe$Dec Xe$Flags

  -------------------------------------------------------------------

    1     1      Xf$Id        1          0        2       0     0

    2     1      Xf$Name      0          2       20       0     0

    3     1      Xf$Loc       0         22       64       0     0

    4     1      Xf$Flags     1         86        1       0     0

    5     2      Xe$Id        1          0        2       0     0

    6     2      Xe$File      1          2        2       0     0

    7     2      Xe$Name      0          4       20       0     0

    8     2      Xe$DataType  1         24        1       0     0

    9     2      Xe$Offset    1         25        2       0     0

   10     2      Xe$Size      1         27        2       0     0

   11     2      Xe$Dec       1         29        1       0     0

   12     2      Xe$Flags     1         30        2       0     0

   13     3      Xi$File      1          0        2       0     0

   14     3      Xi$Field     1          2        2       0     0

   15     3      Xi$Number    1          4        2       0     0

   16     3      Xi$Part      1          6        2       0     0

   17     3      Xi$Flags     1          8        2       0     0

   18     4      nCounter     1          0        4       0     1

   19     4      stUnique     0          4       15       0     1

   20     4      stDup        0         19       15       0     1

   21     4      rNumb        2         34        4       0     0

   22     5      nCustNumb    1          0        4       0     0

   23     5      stName       0          4       15       0     1

   24     5      stAddress    0         19       20       0     1

   25     5      stCity       0         39       20       0     1

   26     6      nCustNumb    1          1        4       0     0

   27     6      rBalanceDue  1          1        8       0

This file contains actual field definitions. The first 17 rows contain the

description of each field in FILE.DDF, FIELD.DDF (self-describing), and

INDEX.DDF. The definitions are related to the FILE.DDF file by the Xe$File

field, which correlates to the Xf$ID field in FILE.DDF. Thus, the first 4

records are for file number 1, which in FILE.DDF is FILE.DDF, the next 8

records are for file number 2, which in FILE.DDF is FIELD.DDF, and 5

records are for file number 3, INDEX.DDF.

Note that the records do not have to be in this order, or have to contain

these file numbers, although they usually do. Some .DDF builders will put

them in order, others do not. However, the records in FIELD.DDF must be in

the same order as the fields within the file they describe. For example,

the first record in FIELD.DDF for file number 1 must describe the first

field in file number 1, and so on.

In this example, file number 4, TEST.DAT in FILE.DDF, has 4 fields:

   1. nCounter: a Long (4-byte) Integer with an offset of 0.

   2. stUnique: a 15-byte String with an offset of 4.

   3. stDup: a 15-byte String with an offset of 19.

   4. rNumb: a 4-byte Real with an offset of 34.

Note that file number 6 (MyData) contains an 8-byte integer named

rBalanceDue. This is a Visual Basic Currency data type and is passed

directly through to Microsoft Access unchanged.

If any of the fields were of the Btrieve Numeric type, the Xe$Dec field

would contain the number of decimal points.

The specifications for FIELD.DDF are:

   FieldName     Description     DataType   Position   Length

   ----------------------------------------------------------

   Xe$ID          Field Id        Integer      1          2

   Xe$File        File Id from    Integer      3          2

                  FILE.DDF

   Xe$Name        FieldName       String       5         20

   Xe$DataType    Btrieve         Integer     25          1

                  DataType

   Xe$Offset      Offset          Integer     26          2

   Xe$Size        Field size      Integer     28          2

   Xe$Dec         Decimal places  Integer     30          1

   Xe$Flags       Bit0=Case flag  Integer     31          2

                  for strings

The "Xe$" prefix is part of the Novell definition for these files.

Btrieve and Xtrieve are manufactured by Novell Inc., a vendor independent

of Microsoft; we make no warranty, implied or otherwise, regarding these

products' performance or reliability.

Additional reference words: 1.00 1.10 2.00 Importing Exporting Attaching

KBCategory:

KBSubcategory: IsmBtrv


INF: Description of the Visual Basic Compatibility Layer

Article ID: Q114834

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Visual Basic version 3.0 has the ability to communicate with

Microsoft Access databases. However, the modules supplied with Visual Basic

version 3.0 can communicate only with Microsoft Access version 1.x-created

databases.

For Visual Basic to communicate with Microsoft Access version 2.0-created

databases, a group of files referred to as the Visual Basic Compatibility

Layer (VBCL) is required. Some of these files are new, while others replace

or modify existing files.

You can obtain the VBCL from 5 sources:

 - The Microsoft Access Developer's Toolkit (ADT) version 2.0

 - The Microsoft Office Developer's Kit (ODK) version 1.0

 - Download the VBCL by downloading COMLYR.EXE, a self-extracting file,

   from the Microsoft Software Library (MSL) on the following services:

    - CompuServe

         GO MSL

         Search for COMLYR.EXE

         Display results and download

    - Microsoft Download Service (MSDL)

         Dial (206) 936-6735 to connect to MSDL

         Download COMLYR.EXE

    - Internet (anonymous FTP)

         ftp ftp.microsoft.com

         Change to the \softlib\mslfiles directory

         Get COMLYR.EXE

MORE INFORMATION

================

The Microsoft Access Developer's Toolkit version 2.0 supplies the VBCL and

the Microsoft Jet database engine version 2.0, along with numerous other

database development tools. At this writing, the ADT retails for $495.

The Microsoft Office Developer's Kit version 1.0 contains the VBCL, along

with other tools to aid in the development of Microsoft Office

applications, but does not include version 2.0 of the Microsoft Jet

database engine. Version 1.1 of the Microsoft Jet database engine is

included. At this writing, the ODK retails for $19.95.

For current pricing and availability information on these or any other

Microsoft products, call the Microsoft Sales Information Center at (800)

426-9400. If you are outside the United States, contact the Microsoft

subsidiary for your area. To locate your subsidiary, call Microsoft

International Customer Support at (206) 936-8661.

VBCL Files

----------

NOTE: The file locations listed below assume default installation

directories.

Files Replaced or Modified by the VBCL:

File          Description                            Location

----------------------------------------------------------------------

VBDB300.DLL   VB to Jet DB engine 1.1 Interface DLL  C:\WINDOWS\SYSTEM

PDCTJET.DLL   Run-time DLL for Crystal Reports       C:\WINDOWS\SYSTEM

PDIRJET.DLL   Run-time DLL for Crystal Reports       C:\WINDOWS\SYSTEM

PDBJET.DLL    Run-time DLL for Crystal Reports       C:\WINDOWS\SYSTEM

CRW.EXE       Crystal Report Designer application    C:\VB\REPORT

VB.INI        Visual Basic initialization file       C:\WINDOWS

SETUPWIZ.INI  Setup Wizard initialization file       C:\WINDOWS

Files Needed to Upgrade Visual Basic Version 3.0:

File          Description                            Location

----------------------------------------------------------------------

MSAJT200.DLL  Version 2.0 Jet database engine        C:\WINDOWS\SYSTEM

MSAJT112.DLL  Jet DB engine 2.0/VBCL                 C:\WINDOWS\SYSTEM

VBDB300.DLL   VB to Jet DB engine Support DLL        C:\WINDOWS\SYSTEM

BTRV200.DLL   Btrieve ISAM driver library            C:\WINDOWS\SYSTEM

PDX200.DLL    Paradox ISAM driver library            C:\WINDOWS\SYSTEM

XBS200.DLL    Microsoft FoxPro ISAM driver library   C:\WINDOWS\SYSTEM

CRWACC20.EXE  Program that modifies Crystal Reports  C:\VB

              files to work with Microsoft Access

              version 2.0 databases

ACC2COMP.TXT  Readme file for VBCL                   C:\VB

Additional reference words: 2.00 interoperability mapping

KBCategory:

KBSubcategory: IntpOthr


INF: Description of Vendor Independent Mail (VIM)

Article ID: Q112133

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how the Microsoft Access Setup program installs

support for electronic mail (email) applications, and how you can modify

your Windows settings to support one of two different electronic mail

interface protocols: messaging application programming interface (MAPI) or

vendor independent messaging (VIM), which is used by the Lotus cc:Mail

electronic mail application.

MORE INFORMATION

================

All of the Microsoft Office for Windows applications (Microsoft Access,

Microsoft Word, Microsoft Excel, Microsoft Mail, and Microsoft PowerPoint)

support the MAPI protocol by default. To support VIM electronic mail

systems, the applications use a MAPI-to-VIM translation dynamic-link

library (DLL) called MAPIVIM.DLL. The following diagrams demonstrate the

route Microsoft Access uses when you send electronic mail using either the

Send command from the File menu or the SendObject macro action:

   Sending to Microsoft Mail             Sending to Lotus cc:Mail

   --------------------------            --------------------------

   Send command or SendObject            Send command or SendObject

   macro action                          macro action

       |                                     |

   MAPI.DLL                              MAPIVIM.DLL

       |                                     |

   Microsoft Mail                        VIM.DLL or SMI.DLL

                                             |

                                         cc:Mail

How Microsoft Access Installs Electronic Mail Support

-----------------------------------------------------

1. The Microsoft Access Setup program searches the Windows WIN.INI file for

   the following setting, which indicates that a VIM-compliant email

   application (such as cc:Mail) is installed on your computer:

      [Mail]

      MAPIDLL=<WINDOWS>\SYSTEM\MAPIVIM.DLL

   where <WINDOWS> is the location of your Windows program directory (for

   example, C:\WINDOWS). If Setup finds this setting, it copies the

   MAPIVIM.DLL file to your <WINDOWS>\SYSTEM directory and updates the

   MAPIDLL setting in your WIN.INI file to reflect the location of the new

   MAPIVIM.DLL file.

   If the MAPIDLL setting points to a different .DLL file, Microsoft Office

   applications use the MAPI functions in the specified .DLL instead of

   MAPI.DLL.

2. If Setup does not find the above MAPIDLL setting, it searches the

   WIN.INI file for the following setting, which indicates that a MAPI-

   compliant email application (such as Microsoft Mail) is installed on

   your computer:

      [Mail]

      MAPI=1

   NOTE: If Setup installs MAPI support, it deletes any existing MAPIDLL

   entry from your WIN.INI file.

3. If Setup detects both MAPI and VIM on your system, it prompts you

   to select which messaging system to support.

4. If Setup finds either of the above settings, it adds the email commands

   to the Microsoft Access menus (for example, Setup adds the Send command

   to the File menu).

NOTE: the cc:Mail program directory must be part of your PATH statement. If

it is not, the email commands will not be added to your Microsoft Access

menus.

How to Switch from One Mail System To Another

---------------------------------------------

When you access email from Microsoft Access, Microsoft Access searches

first for the MAPIDLL setting. If found, Microsoft Access supports VIM-

compliant email systems. If not found, Microsoft Access then searches for

the MAPI=1 setting and, if found, supports MAPI-compliant email systems.

If you work on a network that uses both MAPI- and VIM-compliant email

applications, you may want Microsoft Access to be able to switch back and

forth between the two applications. To do this, add both of the above

settings to the [Mail] section of your WIN.INI file. When you want to use a

MAPI-compliant email application, comment the MAPIDLL line to deactivate it

(to comment a line in the WIN.INI file, type a semicolon [;] at the

beginning of the line).

The following sample WIN.INI entries demonstrate this procedure:

To use a MAPI-compliant email program (such as Microsoft Mail), comment the

MAPIDLL line:

   [Mail]

   ;MAPIDLL=<WINDOWS>\SYSTEM\MAPIVIM.DLL

   MAPI=1

To use a VIM-compliant email program (such as cc:Mail), remove the

semicolon (;) from the MAPIDLL line to reactivate it:

   [Mail]

   MAPIDLL=<WINDOWS>\SYSTEM\MAPIVIM.DLL

   MAPI=1

If you want to use VIM-compliant email systems but Microsoft Access did not

install the MAPIVIM.DLL file because there was no MAPIDLL line in the

WIN.INI file, you can install the MAPIVIM.DLL file manually. To do this,

copy the DECOMP.EXE file from disk 1 of your original Microsoft Access

installation disks to your Windows directory. Insert disk 5 (for 3.5-inch

disks) or disk 4 (for 5.25-inch disks) in drive A, and then type the

following command at a DOS prompt:

   c:\windows\decomp.exe a:\mapivim.dl_ c:\windows\system\mapivim.dll

This command will install the MAPIVIMM.DLL file in your WINDOWS\SYSTEM

directory.

REFERENCES

==========

For more information about using cc:Mail with Microsoft Access, query on

the following words here in the Microsoft Knowledge Base:

   cc:mail and mapivim.dll and lotus

cc:Mail is manufactured by Lotus Development Corporation, a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IntpOthr


INF: Determining How Many Instances of Application Are Active

Article ID: Q96591

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use Windows API calls in Access Basic to determine how many

instances of an application are running. You can use this to prevent re-

entrance of an application that is already running, to determine how many

instances of an application are active, or to start a loop in which you

remain until the application quits.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

This article outlines three uses of two Windows APIs in Access Basic.

Open a new module or a previously created module and enter the

following code:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   '------------------------------------------

   'Global Declarations Section Of The Module.

   '------------------------------------------

   Option Explicit

   Declare Function GetModuleHandle% Lib "Kernel" (ByVal lpModuleName$)

   Declare Function GetModuleUsage% Lib "Kernel" (ByVal hModule%)

1. Prevent re-entrance:

   '------------------------------------------------------------------

   ' The following function will test for re-entrance and return

   ' True if there is already an instance of the application active,

   ' or it returns False. This function requires an argument that is

   ' the name of the application.

   '------------------------------------------------------------------

      Function TestForReentrance% (ApplicationName$)

         If ApplicationName$ = "" Then Exit Function

         If GetModuleUsage(GetModuleHandle(ApplicationName$)) Then _

                           TestForReentrance = True

      End Function

Example of Using this Code

--------------------------

You can use this function to keep from starting an application that

is already running

   Function RunMyApp$ (szAppToRun$)

      Dim x%

      If Not TestForReentrance(szAppToRun) Then

         x = Shell(szAppToRun)

         Exit Function

      End If

      RunMyApp = "AppToRun is presently active."

   End Function

and a call to this in the Immediate window such as:

   ?RunMyApp$("Clock.exe")

2. Count the number of instances:

   '------------------------------------------------------------------

   ' The following function will return the number of instances of an

   ' application that are currently active.

   '------------------------------------------------------------------

   Function CountInstance% (szAppName$)

       CountInstance = GetModuleUsage(GetModuleHandle(szAppName))

   End Function

3. Remain idle until an application quits:

   '------------------------------------------------------------------

   ' The following function will attempt to start an MS-DOS application

   ' and remain in a loop until that application quits.

   '------------------------------------------------------------------

   Sub RunDosAppUntil (szAppToRun$)

      Dim hMod%

      hMod% = Shell(szAppToRun, 1)

         If (hMod% > 32) Then

            While (GetModuleUsage(hMod%))

               DoEvents

            Wend

         Else

           MsgBox "Unable to start the Application"

        End If

   End Sub

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: Differences Between Native and Attached Tables

Article ID: Q92644

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

Attached tables (such as Microsoft Access, Paradox, Btrieve, FoxPro, or

dBase tables) are different from native Microsoft Access tables in four

ways:

1. In the Database window, the icons for attached tables contain black

   arrows.

2. If you try to open an attached table in Design view, you receive the

   following message:

      Table 'xxxxx' is an attached table. Some properties can't be

      modified. Open it anyway?

3. When you delete an attached table, its contents are not deleted. Only

   the table entry is deleted. However, the message you receive is the same

   as for a native table whose contents are actually deleted.

4. You cannot define relationships between attached tables and

   native Microsoft Access tables, or between attached

   non-Microsoft Access tables and native Microsoft Access

   tables.

   You can create relationships between an attached Microsoft

   Access table and a native Microsoft Access table.

MORE INFORMATION

================

Paradox and dBASE IV are manufactured by Borland International Inc., a

vendor independent of Microsoft; we make no warranty, implied or otherwise,

regarding these products' performance or reliability.

REFERENCES

==========

For more information about creating relationships between tables, search

for "relationships between tables" using the Microsoft Access Help menu.

For more information about attaching external tables, search for "attaching

tables" or "attaching external tables" using the Microsoft Access Help

menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


INF: Displaying List or Combo Boxes with More Than One Field

Article ID: Q90876

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses information needed to display more than one

field in a list box or combo box.

MORE INFORMATION

================

If you enter an SQL command in the RowSource property for the control,

Microsoft Access can display more than one field in a list box or

combo list box. For example, if you want to combine two fields into

one list box, the syntax for the SQL command could be as follows:

   Select [FieldName1] & [FieldName2] from [TableName];

If you are using a bound column in the list, the bound column would

now apply to the placeholder in the SQL statement. In the above

example, a bound column setting of 2 would equate to FieldName2.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 9

Additional reference words: 1.00 1.10 2.00 listbox combobox row source

KBCategory:

KBSubcategory: FmsCmbo


INF: Displaying Start, Finish, and Elapsed Times on a Form

Article ID: Q97523

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to create command buttons to enter start

and finish times on a form, and how to show elapsed time.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

The following seven steps use macros and Access Basic code to display

start and finish times on a form:

1. Create a new module called Module 1. Create the appropriate

   declaration section and add the following function.

   NOTE: In the following sample code, an underscore (_) is used

   as a line continuation character. Remove the underscore when

   re-creating this code in Access Basic.

   '-----------------------------------------

   ' GLOBAL DECLARATION

   '-----------------------------------------

   Option Compare Database

   Option Explicit

   '=======================================================

   ' The following function calculates elapsed time.

   ' This function displays the total time elapsed in the

   ' following format:

   '    <hours>:<minutes>:<seconds>

   ' For example:

   '    48:57:04

   '=======================================================

   Function TimePassed (Startup, Done)

      TimePassed = Format(Int(Abs(Startup - Done) * 24), "###:") + _

                      Format(Abs(Startup - Done), "nn:ss")

   End Function

2. Create a macro to set the elapsed time, as follows.

      Macro Name               Action

      ----------------------------------

      Set Elapsed Time         Set Value

      Set Elapsed Time Actions

      -----------------------------------------------------

      Set Value

         Item: [Elapsed Time]

         Expression: TimePassed([Start Time],[Finish Time])

3. Create a macro to set the start and finish time, as follows.

     Macro Name     Condition                             Action

     --------------------------------------------------------------

     SetTime  IsNull(Forms![Time Form]![Start Time])      Set Value

              Not IsNull(Forms![Time Form]![Start Time])  Set Value

      SetTime Actions

      ----------------------

      Set Value

        Item: [Start Time]

         Expression: Now()

      Set Value

         Item: [Finish Time]

         Expression: Now()

4. Create a new blank, unbound form (do not select a table or query).

5. Add three text box controls to the form and assign them the

   following properties:

      Object: Text Box

      -----------------------

      ControlName: Start Time

         Enabled: No

         Locked: Yes

      Object: Text Box

      ------------------------

      ControlName: Finish Time

         Enabled: No

         Locked: Yes

      Object: Text Box

      -------------------------

      ControlName: Elapsed Time

         Enabled: No

         Locked: Yes

6. Add three command button controls to the form, and assign them the

   following properties:

      Object: Command Button

      ----------------------

      ControlName: Begin

         Caption: Start

         OnPush: SetTime

      Object: Command Button

      ----------------------

      ControlName: Complete

         Caption: Finish

         OnPush: SetTime

      Object: Command Button

      ---------------------------

      ControlName: Time Elapsed

         Caption: Time Elapsed

         OnPush: Set Elapsed Time

   Save the form as Time Form.

7. Choose Form view to test the example as follows:

   a. Choose the Start button. The current date and time display in

      both the start time and finish time boxes.

   b. Choose the Start button again. While the start time should not

      change, the finish time will update to the current data and

      time.

   c. Choose the Finish button to set or reset the finish time.

   d. Choose the Time Elapsed button to display the elapsed time in

      days, hours, and minutes.

For additional information on calculating times, query on the following

words here in the Microsoft Knowledge Base:

   calculating and elapsed and time

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 3,

"Access Basic Essentials"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ExrOthr


INF: DLookup() Usage, Examples, and Troubleshooting Tips

Article ID: Q108098

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use the DLookup() function, and includes

examples and tips on usage.

The following topics are addressed in this article:

 - The DLookup() function syntax and usage

 - DLookup() function examples:

    - A function with no criteria

    - Specifying numeric criteria

    - Specifying numeric criteria that comes from a field on a form

    - Specifying textual criteria

    - Specifying textual criteria that comes from a field on a form

    - Specifying date criteria

    - Specifying multiple fields in the criteria

 - Tips for troubleshooting and debugging DLookup() expressions

Note that many difficulties in using the DLookup() function result from

failing to set up and supply the criteria expression correctly. The

criteria expression is common to many other aggregate functions, such as

DSum(), DFirst(), DLast(), DMin(), DMax(), and DCount(). Therefore, the

following material can be useful in helping to understand those domain

aggregate functions as well as the DLookup() function.

MORE INFORMATION

================

The DLookup() Function Syntax and Usage

---------------------------------------

The DLookup() function can be used in an expression or in an Access Basic

function to return a field value in a domain, or specified set of records.

The syntax of the DLookup() function is:

   DLookup(Expression, Domain [, Criteria] )

The function has three arguments: the expression, the domain, and the

criteria. (Note that the criteria argument is optional.)

The expression argument is used to identify the field that contains the

data in the domain that you want returned, or it can perform calculations

using the data in that field.

The domain argument is the name of the record set that identifies the

domain. It can be a table or a query name.

The criteria argument is an optional string expression that is used to

restrict the range of the data that the DLookup() function is performed on.

Note that the criteria argument is identical to the WHERE clause in an SQL

expression (except that you do not use the keyword WHERE).

The DLookup() function returns one value from a single field even if more

than one record satisfies the criteria. If no record satisfies the

criteria, or if the domain contains no records, DLookup() will return null.

DLookup() Function Examples

---------------------------

The following examples demonstrate how to use DLookup() to find or return

values from a table or query. These examples refer to the sample database

NWIND.MDB and can be entered in the ControlSource property of a text box on

a form or report.

NOTE: In the following sample code, an underscore (_) at the end of a line

is used as a line-continuation character. Remove the underscore from the

end of the line when re-creating this code in Access Basic.

A Function with No Criteria:

This example demonstrates how to use DLookup() in its simplest form,

without any criteria specified. This example, which refers to the Orders

form, returns the value contained in the Last Name field of the first

record in the Employees table:

   =DLookUp("[Last Name]", "Employees")

NOTE: Field names in expressions need to be enclosed in brackets ([]). The

table or query name in the domain does not need to be enclosed in brackets.

Specifying Numeric Criteria:

To find the last name of the employee with ID number 7, specify a criteria

to limit the range of records used:

   =DLookUp("[Last Name]", "Employees", "[Employee ID] = 7")

Specifying Numeric Criteria That Comes from a Field on a Form:

If you do not want to specify a particular value in the expression (as in

the example above), use a parameter in the criteria instead. The following

examples demonstrate how to specify criteria from another field on the

current form:

   =DLookUp("[Last Name]", "Employees", _

         "[Employee ID] = Form![Employee ID]")

   =DLookUp("[Last Name]", "Employees", _

         "[Employee ID] = " & [Employee ID])

   =DLookUp("[Last Name]", "Employees", _

         "[Employee ID] = " & Forms!Orders![Employee ID])

The three examples above will all have the same results.

In the first example, Form![Employee.ID] appears inside the criteria's

quotation marks. "Form" tells Microsoft Access that the field reference

"Employee ID" comes from the current form. If you omit it, Microsoft Access

will compare Employee ID to itself in the Employees table, and will return

the last name from the first record in the Employees table (the same result

as if you did not specify any criteria). This is because the first record

in the Employees table has a 1 in the Employee ID field, so the argument

   "[Employee ID] = [Employee ID]"

computes to

   "1 = 1"

and would thus be the first record that matched the criteria.

The criteria for the second two examples are made by concatenating two

string expressions with an ampersand (&). In the third example, the

criteria ends with a form field reference.

When criteria are being evaluated, the individual pieces of the criteria

are first evaluated and then appended or concatenated, and then the whole

value is computed.

If the current value in the Employee ID field on the Orders form is 7, the

original criteria expression

   "[Employee ID] = " & [Employee ID]

would compute to

   "[Employee ID] = " & 7

which, when concatenated, computes to:

   "[Employee ID] = 7"

If you do not specify the full form reference (which the second example

above does not), Microsoft Access will assume that you are referring to the

current form.

The following example is a derivative of the third example above:

   =DLookUp("[Last Name]", "Employees", _

         "[Employee ID] = Forms!Orders![Employee ID]")

In this example, the full form reference is enclosed inside the criteria's

quotation marks. In this case, Microsoft Access will correctly look up the

value when the form first opens, but only until the Employee ID field is

changed by modifications to a record or the addition of a record. Microsoft

Access will not automatically recompute the new employee last name value

after such a change. You can manually recompute the expression by placing

the insertion point on the control, and then pressing F9.

If you want the field to automatically update when the criteria changes,

make the criteria a variable by using the method of concatenating the

expression's parts as described earlier. Note that when you move to a new

record, the DLookup() text boxes that update automatically will have

"#Error" in them until you enter something in the Employee ID text box.

Specifying Textual Criteria:

All the examples above demonstrate how to use the DLookup() function with

numeric criteria. If the criteria fields are textual, enclose the text in

single quotation marks, as in the following example:

   =DLookUp("[Last Name]", "Employees", "[Employee ID] = '7'")

Note that you can use double quotation marks instead of single quotation

marks, although single quotation marks are preferred. Use two double

quotation marks to replace one single quotation mark. The following example

uses double quotation marks, and is equivalent to the example above:

   =DLookUp("[Last Name]", "Employees", "[Employee ID] = ""7""")

Specifying Textual Criteria That Comes from a Field on a Form:

The following example demonstrates how to find the description for a

category on the Products form. The Category ID field is a textual key field

for the criteria, so the DLookup() statement is

   =DLookUp("[Description]","Categories", _

         "[Category ID] = '" & [Category ID] & "'")

or, equivalently:

   =DLookUp("[Description]","Categories", _

         "[Category ID] = '" & Forms!Products![Category ID] & "'")

In the second example, the criteria is made up by concatenating three

string expression pieces. The first is "[Category ID] = '", the second is

the value contained in the actual Category ID field, and the third is the

closing single quotation mark enclosed in double quotation marks.

When this criteria is being evaluated, the individual pieces are first

evaluated, their results appended or concatenated, and then the whole value

is computed.

If the current value selected in the Category combo box on the Products

form is Beverages, the bound column for the combo box will return BEVR as

the Category ID. The original criteria expression

   "[Category ID] = '" & [Category ID] & "'"

will compute to

   "[Category ID] = '" & "BEVR" & "'"

which, when concatenated, computes to:

   "[Category ID] = 'BEVR'"

Specifying Date Criteria:

If the criteria fields are date or time values, enclose the date or time

value in number signs (#). To find an employee whose birthday is on a given

date, use the following sample criteria:

   =DLookUp("[Last Name]", "Employees", "[Birth Date] = #11-15-67#")

Specifying Multiple Fields in the Criteria:

The criteria expression can be any valid SQL WHERE clause (without the

keyword WHERE). This implies that more than one field can be used to

specify criteria for a DLookup() function.

To find the Product ID for one of the products supplied by supplier

"Formaggi Fortini", with a Supplier ID of 14 (numeric), and a Category ID

of DAIR (textual), use the following sample DLookup() statement:

   =DLookUp("[Product ID]", "Products", _

         "[Category ID] = 'DAIR' And [Supplier ID] = 14")

This statement will return Product ID 31, which is the first Product ID

that matches the criteria. Product ID 23 also matches the criteria.

The example above uses hard-coded, or specific, Category ID and Supplier ID

values. To use variables instead of specifics for the criteria, you could

use Access Basic to concatenate multiple string expressions. The following

Access Basic example demonstrates this method:

   ' Declare the variables

   Dim CatID As String

   Dim SuppID As Number

   Dim Result

   ' Assign values to the variables to be used in the criteria

   CatID = "DAIR"

   SuppID = 14

   Result = DLookup("[Product ID]", "Products", _

      "[Category ID] = '" & CatID & "' And [Supplier ID] = " & SuppID)

If the DLookup() function is unsuccessful, the variable Result will contain

null.

Note that the criteria is made up of four pieces that are evaluated

individually. The results are appended, and then evaluated as a whole. The

original criteria expression

   "[Category ID] = '" & CatID & "' And [Supplier ID] = " & SuppID

computes to

   "[Category ID] = '" & "DAIR" & "' And [Supplier ID] = " & 14

which, when concatenated, computes to:

   "[Category ID] = 'DAIR' And [Supplier ID] = 14"

The next example can be used to find an employee whose birthday falls on

today's date:

   =DLookUp("[Last Name]", "Employees", _

      "Month([Birth Date]) = " & Month(Date) & " And Day([Birth Date]) _

      = " & Day(Date))

If today's date is 12/2/93, the original criteria expression

   "Month([Birth Date]) = " & Month(Date) & " And Day([Birth Date]) = " _

   & Day(Date)

computes to

   "Month([Birth Date]) = " & 12 & " And Day([Birth Date]) = " & 2

which, when concatenated, computes to:

   "Month([Birth Date]) = 12 And Day([Birth Date]) = 2"

Tips for Troubleshooting and Debugging DLookup() Expressions

------------------------------------------------------------

To troubleshoot expressions, break down the expression into smaller

components and test the components individually in the Immediate window to

ensure they work correctly. If the smaller components work correctly, they

can be put back together, piece by piece, until the final expression works

correctly.

The Immediate window is a tool that you can use to help debug Access Basic

modules. The window can be used to test and evaluate expressions

independently of the form or macro the expression is to be used in. You can

set up expressions in the Immediate window, run them, and see the results

immediately.

The following example demonstrates a strategy you can use to break down a

DLookup() expression into smaller components that you can test in the

Immediate window. Assume you are having difficulty with the following

statement:

   =DLookUp("[Product ID]", "Products", _

      "[Category ID] = '" & Forms!MyForm![Category ID] _

      & "' And [Supplier ID] = " & Forms!MyForm![Supplier ID])

Note that the criteria includes multiple fields in the lookup criteria, one

of which is numeric and one if which is textual.

To troubleshoot this expression, try the following:

1. Open or create a module. From the View menu, choose Immediate Window.

2. Try the function without any criteria. Type the following in the

   Immediate window and then press ENTER:

      ? DLookUp("[Product ID]", "Products")

   Microsoft Access will perform the calculation and display the result on

   the next line in the Immediate window.

3. Make sure the form references correctly reference data. Type each of the

   following in the Immediate window, and then press ENTER:

      ? Forms!MyForm![Category ID]

      -and-

      ? Forms!MyForm![Supplier ID]

4. Try to get the criteria fields to work independently by hard coding

   values into the expression. Type each of the following in the Immediate

   window, and then press ENTER:

      ? DLookUp("[Product ID]", "Products", "[Category ID] = 'DAIR'")

      -and-

      ? DLookUp("[Product ID]", "Products", "[Supplier ID] = 14)

5. Try to get the criteria fields to work independently with a parameter in

   the query. Type each of the following in the Immediate window, and then

   press ENTER:

      ? DLookUp("[Product ID]", "Products", _

         "[Category ID] = '" & Forms!MyForm![Category ID] & "'")

      -and-

      ? DLookUp("[Product ID]", "Products", _

         "[Supplier ID] = " & Forms!MyForm![Supplier ID])

REFERENCES

==========

Microsoft Access "User's Guide," version 1.1, page 651

Microsoft Access "Language Reference," version 1.1, pages 144-146

Microsoft Access "Introduction to Programming," version 1.1, pages 37-42

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ExrOthr


INF: DoCmd Statement in Transaction Not Affected by Rollback

Article ID: Q89587

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access, the DoCmd statement is not affected by a Rollback

statement if the DoCmd statement appears in a transaction.

MORE INFORMATION

================

Transaction processing in Microsoft Access is valid only on virtual

table (VT) objects, such as dynasets. The DoCmd statement starts

another JET session to process its arguments.

Since JET manages transaction processing, a new session of JET

contains its own transaction management. The two are mutually

exclusive; transactions in one are not managed or affected by

transactions in the other.

The simplest workaround for this problem is the QueryDef.Execute

method, which uses a dynaset.

NOTE: The QueryDef.Execute method works only when a QueryDef action is

based on an action query (update, insert, delete) that does not return

a recordset.

Additional reference words: 1.00 1.10 2.00 commit record set

KBCategory:

KBSubcategory: McrActn


INF: DoEvents, SendKeys May Not Be Supported in UDFs

Article ID: Q89592

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Under certain circumstances, DoEvents and SendKeys are not supported

when called by user-defined functions (UDFs) in Access Basic.

MORE INFORMATION

================

DoEvents and SendKeys are not supported in UDFs in the following

situations:

 - When calculating a field in a query

 - When calculating a control on a form or report

 - From an Access Basic Fill function for a list box, combo box, or

   OLE object

The DoEvents statement will not allow messages to be processed in

these circumstances; instead, it will immediately return. Thus, any

keys sent through SendKeys statements or functions will not be

processed until all the computations listed above have been completed

and responses have been returned to the user.

Additional reference words: 1.00 1.10 2.00 UDF

KBCategory:

KBSubcategory: PgmErr


INF: Eliminating White Space in Reports with CanShrink and AB

Article ID: Q95390

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Before printing a form or report, you can save space by conditionally

reducing the sizes of the controls on the form or report. For example,

you might want to reduce the size of text boxes that contain varied-length

text or reduce the size of text boxes bound to fields that could be empty.

Note the following information before you try to reduce the size of

controls in reports:

 - Overlapping controls will not shrink, even when the CanShrink property

   is set to Yes.

 - Controls shrink line by line (vertically). This means, for example, that

   if there are a group of controls placed on the left side of the page and

   a large control (for example, an OLE picture) on the right side of the

   page, the controls on the left side of the page will not shrink, unless

   the picture is blank and hidden.

 - Space between controls is not affected by the CanShrink or CanGrow

   properties.

 - Controls located in the Page Header or Page Footer will not shrink

   or grow.

MORE INFORMATION

================

A control containing null information automatically shrinks to nothing and

disappears when its CanShrink property is set to Yes, but the space

between the controls is not affected by the CanShrink property.

For example, say you have 11 controls in a column of a report, and there is

.1 inch of space between each control. Even if all 11 controls contain null

information and all 11 have their CanShrink property set to Yes, the space

between the controls adds up to 1 inch. When you print the report, even

though the 11 controls do not print, the first control that does contain

text will print 1 inch lower than you might expect because of all the

accumulated space.

A good way to manage the size of your controls is to have as few as

possible. This will minimize the white space between the controls.

The following example demonstrates how to print mailing labels by using

an Access Basic function to minimize the number of controls and give you

nice, even spacing. Say you want to create mailing labels containing a

name, business name, address, city, state, and zip code. You could use

several different fields, but it would be better to use a single text box,

as in the following step-by-step example:

1. Create a single text box control with the CanGrow property set to Yes,

   and the Height property set to the height of one line of data then set

   its ControlSource property to this expression:

   =AddressBlock([Name],[Business Name],[Address],[City],[State],[ZipCode])

2. Create a new Access Basic module, and type the following code into it:

      Option Explicit

      Function AddressBlock$ (AName, Addr1, Addr2, City, State, Zip)

         Dim A1$, A2$, A3$, A4$, CR$

         CR$ = Chr(13) & Chr(10)  'Carriage return and line feed.

         A1$ = IIf(ISB(AName),"",AName & CR$)

         A2$ = IIf(ISB(Addr1),"",Addr1 & CR$)

         A3$ = IIf(ISB(Addr2),"",Addr2 & CR$)

         A4$ = City & ", " & State & " " & Zip

         AddressBlock = A1$ & A2$ & A3$ & A4$   'Concatenate the strings.

      End Function

      Function ISB (V) As Integer

         If IsNull(V) or V = "" Then ISB = True Else ISB = False

      End Function

Now you can print your report and the report will automatically run the

function and keep wasted space to a minimum.

Additional reference words: 1.00 1.10 2.00 shrinking functions

KBCategory:

KBSubcategory: RptLayou


INF: Enforcing Transactions on Attached SQL Server Tables

Article ID: Q95607

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access will automatically support transaction processing on

attached SQL Server tables using queries. However, explicit

transactions in Access Basic require the use of dynasets on attached

tables and further require a specific order in the creation of the

dynasets and the implementation of transaction processing.

MORE INFORMATION

================

Microsoft Access will enforce transaction processing on an attached

SQL Server table through the use of a dynaset created on that table.

To get more information on how to create a dynaset on an attached SQL

Server table, search for "CreateDynaset" using the Help menu. The key

to making transaction processing work for attached SQL Server tables

is to create and close the dynaset on the attached SQL Server table

outside the transaction. Below are pseudo-code examples of the

incorrect and correct methods of coding this process:

   ***INCORRECT***

   Dim MyDyna As Dynaset

   BeginTrans

      MyDyna = CreateDynaset("Table1")

      <misc.code such as Inserts/Updates/Deletes.>

      MyDyna.Close

   CommitTrans/Rollback

   ***CORRECT***

   Dim MyDyna As Dynaset

   MyDyna = CreateDynaset("Table1")

   BeginTrans

      <misc.code such as Inserts/Updates/Deletes.>

   CommitTrans/Rollback

   MyDyna.close

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: Error Message Using AutoKeys Macro

Article ID: Q106183

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If an invalid key combination is entered in an AutoKeys macro, the

following error message will occur:

   The key combination '<your key combination>' in 'AUTOKEYS' isn't

   valid and will be ignored.

MORE INFORMATION

================

Even though you entered a valid syntax for the key combination in the

AutoKeys macro, it still may not work. Only specific key combinations can

be used in AutoKeys macros. The following table lists valid key

combinations:

   SendKeys syntax example    Key combination

   ------------------------------------------------------

   ^A or ^4                   CTRL+any letter or number

   {F1}                       Any function key

   ^{F1}                      CTRL+any function key

   +{F1}                      SHIFT+any function key

   {INSERT}                   INS key

   ^{INSERT}                  CTRL+INS key

   +{INSERT}                  SHIFT+INS key

   {DELETE} or {DEL}          DEL key

   ^{DELETE} or ^{DEL}        CTRL+DEL key

   +{DELETE} or +{DEL}        SHIFT+DEL key

Macro actions can be assigned to key combinations using a special key-

assignment macro, which is normally called AutoKeys. To specify a different

name for this macro, type the macro name you want in the Key Assignment

Macro box, which is available by choosing Options from the View menu and

then selecting Keyboard.

When you open the database, Microsoft Access looks for a macro with the

name you entered. If the macro contains a key combination that is not in

the list above, you will receive the error message stated above.

Steps to Reproduce Behavior

---------------------------

1. Create a new macro.

2. Type "+Z" (without the quotation marks) in the macro name column.

3. Enter the set of actions you want this key combination to run. For

   example, try the MsgBox action.

4. Save the macro with the name AutoKeys. This is the default key

   assignment macro.

You will receive the error message:

   The key combination '+Z' in 'AUTOKEYS' isn't valid and will be

   ignored

REFERENCES

==========

For more information on AutoKeys, search for "Autokeys" using the Help

menu.

Additional reference words: 1.00 1.10 2.00 Auto Keys ADK

KBCategory:

KBSubcategory: McrName


INF: Error Message with Blank or Incorrect Data Type

Article ID: Q90103

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When designing a new table, a valid data-type name from the data type

combo box must be associated with each field, otherwise, you get the

error message:

   The text you enter must match an entry in the list.

This is by design, and is due to the field validation that is performed

when you exit the field.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open a new table.

2. Select any data type for the first row from the Data Type

   combo box.

3. Remove the data type selected using either the DEL or the BACKSPACE

   key.

4. Try to move to the next row. You get the error message:

      The text you enter must match an entry in the list.

The only way to move to another row is to do one of the following:

 - Fill in the Data Type field by selecting (or typing in) a data type from

   the Data Type combo box.

 - Cancel the entry by pressing the ESC key (which fills in the Data

   Type field with a default entry of Text).

 - Choose Delete Row from the Edit menu.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, page 27

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: TblFldp


INF: Error Messages May Be Caused by International Setting

Article ID: Q94825

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

An attempt to enter an expression that requires a list separator

in the QBE grid field or criteria cells, or as the ControlSource

for a text box in a form or report, fails and Microsoft Access

generates the following message:

   Syntax error

An attempt to enter an expression that requires a list separator

in an action argument for a macro action fails and Microsoft

Access generates the following message:

   Can't parse expression: '<Expression that was entered>'

CAUSE

=====

These errors can be caused by an incorrect setting for the "slist"

parameter in the [intl] section of your WIN.INI file. This setting

specifies the character used to separate items in a list. In United

States English, the most common list separator is a comma (,).

RESOLUTION

==========

There are three methods to address this situation, as follows:

 - Use the Microsoft Windows Control Panel to modify the list

   separator in your WIN.INI file. Choose International from the

   Settings menu. Specify the correct separator in the List

   Separator field.

 - Use a text editor to modify the list separator in your WIN.INI

   file.

 - Modify the expression to use the list character specified in

   your WIN.INI file.

MORE INFORMATION

================

When this error occurs, the WIN.INI file might appear as follows:

   [intl]

   slist=;

The default United States English settings are as follows:

   [intl]

   slist=,

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: ExrOthr


INF: Error Messages When Concatenating Variables or Controls

Article ID: Q96576

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are concatenating variables or controls in a function or

CreateDynaset method, you may receive one of the following error

messages:

   Type Mismatch

   -or-

   1 parameter expected only 0 supplied

These error messages can result if either of the following is true:

 - You are including a variable or control name in the function syntax

   and Microsoft Access is unable to recognize the data type.

 - You are using incorrect syntax to concatenate the variables.

This article presents examples in which these errors occur and explains how

to correct them.

MORE INFORMATION

================

"Type Mismatch" Error Message

-----------------------------

You receive the "Type Mismatch" error message when you concatenate a

variable or control that has a string data type in a method or function as

a numeric data type. For example, the following function produces the "Type

Mismatch" error message:

   Function MyFunction (DataToFind As String)

      Dim MyDB As Database, MySet As Dynaset

      Set MyDB = CurrentDB()

      Set MySet = MyDB.CreateDynaset("Employees")

      MySet.FindFirst "Title = " & DataToFind

The correct syntax for the last line of code above is as follows:

   MySet.FindFirst "Title = '" & DataToFind & "'"

Keep the following requirements in mind:

 - When the criteria for an Access Basic function or method is a string

   data type, single quotation marks around the string variable are

   required.

 - Numeric data types do not require delimiters, as in the following

   example:

      MySet.FindFirst "Title = " & NumericDataToFind & "

 - Dates require the number sign (#).

"1 Parameters Were Expected, But Only 0 Were Supplied" Error Message

--------------------------------------------------------------------

You may receive this error message when you use the CreateDynaset

method in Access Basic on an existing query. If the query is a

parameter query, you need to explicitly declare the parameter and its

data type and set the parameter value for that query in the function.

The following sample code will generate the error message:

   Function TestQP ()

      Dim MyDB As Database, MySet As Dynaset

      Set MyDB = CurrentDB()

      Set MySet = MyDB.CreateDynaset("Query1")

      Debug.Print MySet![First Name]; Tab(10); MySet![Last Name]

   End Function

When you refer to a parameter query, the correct syntax is as follows:

   Function TestQP ()

      Dim MyDB As Database, MySet As QueryDef, MyDyna As Dynaset

      Set MyDB = CurrentDB()

      Set MySet = MyDB.OpenQueryDef("Query1")

      MySet![Enter a Name] = "Dav*"

      Set MyDyna = MySet.CreateDynaset()

      Debug.Print MyDyna![First Name]; Tab(10); MyDyna![Last Name]

      MyDyna.Close

      MySet.Close

   End Function

The same error message also appears when you concatenate a variable in

the SQL SELECT statement of a CreateDynaset method. The correct syntax

is as follows:

NOTE: In the following example, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this

example.

   Set MySet = MyDB.CreateDynaset("SELECT * FROM Employees WHERE _

                    [Employee ID] = " & Forms!Form1!Field0 & ";")

This SELECT statement points to a control on a form for the WHERE

clause.

Additional reference words: 1.00 1.10 2.00 parameters errmsg

KBCategory:

KBSubcategory: PgmObj


INF: Error Msg "Operation Not Supported on Paradox Table..."

Article ID: Q90140

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you create a Microsoft Access report based on a nonkeyed Paradox

table, or when you attempt to run a Microsoft Access query with the

table added twice, you will receive the following error message:

   Operation not supported on Paradox table with no primary key.

MORE INFORMATION

================

In Microsoft Access, if you attach a Paradox version 3.0 or 3.5 table, it

is best to have a key field defined in the table. Paradox creates an index

(.PX) file that should always be in the same directory as the table (.DB)

file. Important information is stored in the .PX file. Attaching nonkeyed

Paradox tables limits the report and query capabilities of Microsoft

Access.

Query Limitation

----------------

You can create a nonupdatable query based on a nonkeyed Paradox table.

However, you can add the table to the query only one time. If you add

the table twice, you will receive the error stated above when you run

the query.

Report Limitation

-----------------

You cannot use or design a Microsoft Access report based on a query

to which a nonkeyed Paradox table has been added twice.

When you create a new report and select the query to base the report

on, the error above will appear. Choose the OK button to close the

error dialog box and view the report in Design mode. If you look at

the Field List for the report, you will not see any fields listed.

The above limitations occur because attached nonkeyed Paradox tables

can only be opened once in Microsoft Access. Use of the table in both of

these scenarios requires the table to be opened more than one time in

order to perform the specific Microsoft Access task.

Paradox is manufactured by Borland International, Inc., a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

REFERENCES

==========

For more information on using Paradox files, search for "Paradox files"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmPdox


INF: Error Msg: Cannot Hide the Control that Has Focus

Article ID: Q88168

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If you change the Visible property of a control to False, and that

control has focus, you will receive the following error message:

   Can't hide the control that has focus

Although you cannot trap this error message within a macro, you can

call Access Basic code that can trap this error and return the results

to a macro.

MORE INFORMATION

================

Steps to Reproduce Behavior:

 1. Create a new form.

 2. Place a command button on the form.

 3. Set the following properties for the command button:

      ControlName: Controller

      Caption: Turn Off

      OnPush: Turn Off

 4. Save the form as "Turn Off Controller" and then close it.

 5. Repeat steps 1-3 for a second form, but use the following

    properties for the command button:

      ControlName: Subject

      Caption: Subject

 6. Save the form as Turn Off Subject and then close it.

 7. Create a new macro.

 8. From the View menu, choose Conditions to display the Condition

    field.

 9. Add the following actions to the macro:

    Condition        Action      Comment

    ----------------------------------------------------

    TurnOff()<>2165  MsgBox      Successfully turned off

          ...        StopMacro   Note the ellipsis (...)

                     MsgBox      Message here

    MsgBox Action

    --------------------------------

    Message: Successfully turned off

    StopMacro Action

    ----------------

    none to set

    MsgBox Action

    ---------------------

    Message: Message here

10. Save the macro as Turn Off and then close it.

11. Create a new module.

12. Add the following sample code to the module:

    '-----------------------------------------------------

    'Global Section

    '-----------------------------------------------------

    Options Explicit

    '-----------------------------------------------------

    'Functions

    '-----------------------------------------------------

    Function TurnOff ()

       'If a control has focus, then this will trap error 2509

       On Error GoTo errhandler

        Forms![Turn Off Subject]![Subject].Visible= False

       TurnOff = True

    Exit Function

    errhandler:

       If Err = 2165 Then

          TurnOff = 2165    'trap the "Has focus scenario"

       Else

          TurnOff = 0

       End If

    Exit Function

14. Save the module as Turn Off and then close it.

15. Open both the Turn Off and Turn Off Subject forms.

16. Choose the Turn Off command button.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: McrActn


INF: Error When Opening Table in Table Design View

Article ID: Q92671

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You may receive the following error message in Microsoft Access version 1.x

when you are attempting to open a table in Design view:

   Unable to recover from attempt to switch view. Window

   will be closed.

In Microsoft Access version 2.0, the message is:

   Can't switch to Datasheet view and can't return to Design view.

Microsoft Access then returns focus to the Database window.

MORE INFORMATION

================

This error message occurs only in rare situations. It is an informational

message only, not a program error.

Steps to Reproduce Behavior

---------------------------

1. Two users (User A and User B) both open the sample database NWIND.MDB

   non-exclusively.

2. Both users open the Categories table in Datasheet view.

3. Both users simultaneously switch to Design view. User A succeeds, but

   User B receives the following error message in Microsoft Access 1.x:

      Table is in use, cannot lock by user '<user B's logon name>'

      on machine <user B's machine name>'.

   In Microsoft Access 2.0, the message is:

      Can't open table 'Categories' for modification. Open it read only?

4. User B tries to reopen the table in Datasheet view, and receives

   the following error message:

      Couldn't lock table. Table 'Categories' is exclusively

      locked by user '<user A's logon name>' on machine '<user

      A's machine name>'.

5. User B is returned to the Database window with the following Microsoft

   1.x error message:

      Unable to recover from attempt to switch view. Window

      will be closed.

   The error message from Microsoft Access 2.0 is:

      Can't switch to Datasheet view and can't return to Design view.

6. Microsoft Access returns User B's focus to the Database window.

When in Datasheet view (step 3), both users have the table open non-

exclusively. When they try to switch to Design view, they are actually

closing the table and attempting to re-open it exclusively.

In the example above, User A succeeds and User B fails. When User B then

tries to reopen the table (non-exclusively) in Datasheet view, User A

already has the table open exclusively.

The error message in step 5 in an informational message designed to let

User B know that Microsoft Access is unable to open the table in either

Datasheet or Design view.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: TblsDbdsn


INF: Error() Function Does Not Return Detailed Information

Article ID: Q89591

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When errors are trapped in Access Basic, Error(Err) returns a minimal

message. To receive full extended error messages, use Error or Error$. For

example, Error(Err) or Error$(Err) might return "Table not found," whereas

Error or Error$ would return the message "Table MyTable not found."

MORE INFORMATION

================

The following is an example of a common format for error handling in

Access Basic using MsgBox to display the error text:

   MsgBox "Error #" & Err & ": " & Error(Err)

This line would say return an error message like "Error #15: File | Not

found" if Err had trapped a "file not found" error.

To get the extended error message use:

   MsgBox "Error #" & Err & ": " & Error

Note the use of Error and not Error(Err).

Error(Err) returns a generic error message for the given error number,

whereas Error returns a specific error message.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmErr


INF: Errors When RunSQL Action Argument Exceeds 256 Characters

Article ID: Q109355

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The RunSQL macro action argument can accept up to 256 characters. However,

you receive no error message that tells you when you have exceeded this

limit. Instead, the SQL string is truncated at 256 characters and Microsoft

Access attempts to parse the first 256 characters. This can cause a

variety of error messages, including:

 - Syntax error in WITH OWNERACCESS OPTION declaration.

 - Syntax error in query expression.

 - Missing semicolon (;) at end of SQL statement.

 - Syntax error in FROM clause.

The error message you receive depends on where the string was truncated.

MORE INFORMATION

================

Note that these errors occur when you manually enter a SQL string with more

than 256 characters. If you paste a string with more than 256 characters,

Microsoft Access will notify you that you have exceeded the limit with the

following error message:

   Text would be too long; change canceled.

Additional reference words: 1.00 1.10 2.00 Macros

KBCategory:

KBSubcategory: McrArg


INF: Explanation of Compliance Checking Program (CCP)

Article ID: Q112124

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft offers the cost-saving option for you to upgrade from previous

versions of its products, or to upgrade from a competitive product, for a

decreased price. To ensure that the purchase is a true upgrade or a

competitive upgrade, several Microsoft products run a program called the

Compliance Checking program (CCP) before running Setup.

MORE INFORMATION

================

CCP is used by Microsoft Access version 2.0, as well as by other Microsoft

products such as Microsoft Word for Windows and Microsoft Excel. CCP checks

for previously installed software on your system that meets upgrade or

competitive upgrade criteria before you can install the upgrade. (The

restriction criteria vary according to the package you purchase and the

country in which you purchase it. See the product's documentation for

details.)

CCP uses a list of acceptable Microsoft or competitors' products for the

compliance checking. If the CCP program finds one of these products

installed on your system, it allows Setup to continue. If CCP does not find

one of the accepted products in the product list, it asks you to list the

directory where an acceptable product is installed. This includes any

location on a hard disk, CD-ROM, network drive, or floppy disk.

For example, if you purchase and install a Microsoft Access 2.0 upgrade

package to upgrade from Microsoft Access version 1.1 to 2.0, CCP checks for

the presence of Microsoft Access 1.1 on your system before installation can

occur. If you purchase a competitive upgrade package to upgrade from

Borland Paradox version 4.5 for Windows to Microsoft Access 2.0, CCP checks

for the presence of Borland Paradox version 4.5 for Windows on your system

before installation can occur. The back of the upgrade package box

describes how compliance is handled, and lists acceptable competitive

products. On the box, the term "special software" refers to CCP. Otherwise,

the reseller is mentioned.

Different CCP Versions

----------------------

There are two different versions of CCP: Lenient and Strict. Lenient CCP is

used in all U.S. versions of Microsoft Access, while Strict CCP is used in

countries other than the United States.

If Lenient CCP does not find one of the acceptable products in the product

list, it is a restriction violation. However, only a warning is given and

installation does occur.

When Strict CCP perceives a violation, it halts installation with a

violation message stating that installation cannot continue.

Product List

------------

In the United States, an upgrade to Microsoft Access version 2.0 requires

only a previous installation of Microsoft Access version 1.x.

A competitive upgrade in the United States requires a previous installation

of any of the following products:

   Microsoft Access 1.x

   Microsoft Works for Windows 3.0, 2.0a, 2.0 (US, Z, F, G)

   Microsoft Works for MS-DOS 3.0, 2A, 2, 1.5, 1.05, 1.0 (US, Z, F, G)

   Microsoft FoxPro for MS-DOS 2.0, 2.5, 2.5a, 2.5b, 2.6

   Microsoft FoxPro for Windows 2.5, 2.5a, 2.5b, 2.6

   Microsoft Office 4.0-4.2

   Lotus Approach 1.0, 2.0, 2.1

   DataEase for MS-DOS 4.2, 4.5

   DataEase for Windows 1.0, 1.1

   FileMaker Pro for Windows 2.0, 2.1

   Borland dBASE III+ 1.1, IV 1.5, 2.0

   Borland Paradox for MS-DOS 3.5, 4.0, 4.5

   Borland Paradox for Windows 1.0, 4.5

   Symantec Q&A for MS-DOS 2.0, 3.0

   Symantec Q&A for Windows 4.0 (Checking for Q&A or QAWrite)

   Microrim R:Base 2.11, 3.0, 3.1, 4.0, 4.5, 4.5+

   Software Publishing Superbase4 for Windows 1.2,1.3

   Computer Associates Clipper 5.01

   PowerSoft Powerbuilder 3.0

Additional reference words: 2.00 Complying Magic Answer

KBCategory:

KBSubcategory: StpOthr


INF: Explanation of the KeepTogether Property for Sections

Article ID: Q95648

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Form and report sections have a KeepTogether property that you can set

to Yes or No. The KeepTogether property setting for sections determines

whether Microsoft Access prints the controls located in that section on a

single page or on more than one page.

The section's KeepTogether property affects the controls located in

that section, for a single record.

MORE INFORMATION

================

If the KeepTogether property is set to yes, Microsoft Access begins

printing the controls located in that section at the top of the next

page if it cannot print all of the controls on the current page. If it

is set to no, Microsoft Access prints as many controls as it can on

the current page and continues printing them on the next page.

If all the controls in a section require more than one page for a

single record, Microsoft Access continues printing on a second page

regardless of the KeepTogether setting.

For example, say the detail section of a report has its KeepTogether

property set to Yes and all the controls in that section will not fit on

the current printed page. In this case, Microsoft Access prints none

of the controls on the current page. Instead, it begins printing the

controls at the top of the next page. If it turns out the section

requires more than a single page, Microsoft Access ignores the

KeepTogether property value and continues printing the controls at the

top of the next page.

The KeepTogether property affects the controls in a form or report

section for a single record -- not groups of records. The KeepTogether

property will not keep all the grouped records together, and it will not

avoid the problem of abandoned group headers left on the bottom of a

printed page.

Several other articles can help you learn how to create a label that

will print at the top of each report page when a group of records span

more than one page. To find these articles, query on the following

words here in the Microsoft Knowledge Base:

   access and continued and new and page

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 313-314

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: RptProp


INF: Export Btrieve Table Without Existing Xtrieve FILE.DDF

Article ID: Q93688

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To export a Btrieve table by using the Microsoft Access user interface, you

must ensure that an Xtrieve dictionary file (FILE.DDF) exists. If the

FILE.DDF file does not exist, use the macro action Transfer Database to

export the table.

MORE INFORMATION

================

Multiple Btrieve tables can exist in Xtrieve databases, just as Microsoft

Access databases can have multiple tables. The FILE.DDF file describes the

structure of the Xtrieve database.

Example

-------

The following sample macro (TransBtrieve) transfers the Customers table

from the sample database NWIND.MDB to a Btrieve Table named Customers in an

Xtrieve database named C:\ACCESS\BTV00000.DAT. If C:\ACCESS is a valid

directory, the export occurs even if BTV00000.DAT does not exist.

Use the following as a guide to create the sample macro. Note that the

database name can be any complete file specification.

   Macro Name      Action

   --------------------------------

   TransBtrieve    TransferDatabase

   TransferDatabase Action

   -----------------------------------------

       Transfer Type: Export

       Database Type: Btrieve

       Database Name: C:\ACCESS\BTV00000.DAT

         Object Type: Table

              Source: Customers

         Destination: Customers

      Structure Only: No

In addition, for Microsoft Access verion 2.0, you must add

IndexDDF=Maintain to the [Btrieve ISAM] section of the MSACC20.INI file

in order for Microsoft Access to create the INDEX.DDF file.

Microsoft Access creates the following four files if they do not exist:

   FILE.DDF

   INDEX.DDF

   FIELD.DDF

   BTV00000.DAT

Transferring more than one table adds data to the existing files, but does

not create more files as long as the database name is not changed.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 4, "Importing,

Exporting, and Attaching," page 86

For more information on [Btrieve ISAM] settings, see "Using Microsoft

Access with Btrieve" then "Setting Btrieve Options" in the ACREADME.HLP

file in the ACCESS directory.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmBtrv


INF: Exporting Queries to ASCII

Article ID: Q94929

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to export the results of a query to an ASCII

text file using the TransferText macro action.

MORE INFORMATION

================

The TransferText macro action does not specify the use of query names

in the TableName argument of the action. The argument does not use a

combo box for table name choices, so the user is not limited to using

table names. By using the name of a query in the TableName argument

of a TransferText action, the results of a query can be exported to

text files. This feature is undocumented. For specific instructions on

using the TransferText macro action, search for TransferText using the

Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: McrActn


INF: Exporting WordPerfect Secondary Files to Microsoft Access

Article ID: Q99317

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to export data from a WordPerfect (WP) print

merge secondary file (or data file) to Microsoft Access.

MORE INFORMATION

================

A WordPerfect secondary file (or data file) contains records, typically

names and addresses, used in a print merge with a primary file (or form

file), such as a form letter or mailing label document. To use data from a

secondary file, the information must be saved in a comma or tab delimited

(separated), unformatted text file. WordPerfect secondary files are neither

comma nor tab delimited.

A typical comma delimited text file resembles the following:

   "Joe","Smith","123 Main Street","Seattle, WA 98033"

   "Martha","Jones","4523 Williams Ave","","Redmond, WA 98052"

The equivalent WordPerfect secondary file resembles the following:

   Joe{END FIELD}

   Smith{END FIELD}

   123 Main Street{END FIELD}

   Seattle, WA 98033{END FIELD}

   {END RECORD}

   <CRLF>

   Martha{END FIELD}

   Jones{END FIELD}

   4523 Williams Ave{END FIELD}

   {END FIELD}

   Redmond, WA 98052{END FIELD}

   {END RECORD}

   <CRLF>

where <CRLF> represents a hard page break. Note also that in Wordperfect

versions later than 5.1, {END FIELD} and {END RECORD} will be shown as

boldface without braces.

Problems: Secondary Files With Multiple-Line Field Entries

----------------------------------------------------------

WordPerfect allows you to merge multiple lines of data in a single

field. The following record has only two fields:

   Joe Smith{END FIELD}

   123 Main Street

   Suite 101

   Seattle, WA 98033{END FIELD}

   {END RECORD}

   <CRLF>

Delimited text files use carriage returns to mark the end of a record;

these cannot be included in the field information. Each line in the

secondary file must be made a unique field before it can be prepared

as a delimited file. When you add the {END FIELD} code to a record,

the new field is represented in every record in your file. Each record

must contain the same number of fields and each field should either

contain the same type of data or remain empty.

Using the {FIELD NAMES} Section in a Secondary File

---------------------------------------------------

Fields in a secondary file can be referenced from a primary file by

number. These fields are numbered from top to bottom, or by a name

that is assigned in the optional {FIELD NAMES} section, which appears

at the top of the secondary file. The {FIELD NAMES} section in WP 5.1 may

look like this

   {FIELD NAMES}

   Name~

   Address~

   ~{END RECORD}

or like this:

   {FIELD NAMES}Name~Address~~{END RECORD}

The {FIELD NAMES} section in WP versions later than 5.1 may look like this:

   FIELDNAMES(Name;Address)ENDRECORD

If referenced by number, the Name field is 1 and the Address field is

2. A hard page break falls between this section and the first record.

Preparing the Comma Delimited Secondary File

--------------------------------------------

WordPerfect for Windows:

WordPerfect for Windows can save secondary files directly in a comma

delimited format. However, if you have a {FIELD NAMES} section in the

file and want to preserve these names in Microsoft Access, you must

reformat the file so that each name is separated by a comma and not by

a tilde (~) character. Also, the fields should not appear on separate

lines, nor be followed by carriage returns. The following {FIELD

NAMES} section

   {FIELD NAMES}

   Name~

   Address~

   Phone~

   ~{END RECORD}

should be editing as follows:

   {FIELD NAMES}Name,Address,Phone{END RECORD}

Creating the Comma Delimited File:

1. From the File menu, choose Save As.

2. In the Save As box, type a unique file name, preferably with a .TXT

   extension.

3. In the Format box, select ASCII Delimited Text (DOS), then choose

   Save.

WordPerfect for MS-DOS:

WordPerfect for MS-DOS cannot save secondary files directly in a delimited

format. To create the comma delimited file, you need to create a primary

file (or form file) and merge the secondary information into it. The

primary document will contain fields already in comma delimited format.

Once the data is merged, remove the hard page breaks separating each

record. The resulting document can be saved as a text file that Microsoft

Access can import.

Creating the Primary File (or form file) in WP 5.1:

1. Press F7, choose No, then choose No again to create a new

   WordPerfect document.

2. Type an opening quotation mark. Press SHIFT+F9, then 1 (Field).

3. In the Enter Field box, type the name of the first field if a

   {FIELD NAMES} section appears in the secondary file, or type "1" if

   there is no {FIELD NAMES} section.

4. Press ENTER. Type a closing quotation mark, followed by a comma.

5. Repeat steps 2-4 for each field in the secondary file, changing

   only the field name or field position number as appropriate. Do not

   type a comma after the last field.

6. Press ENTER to place a hard carriage return at the end of the

   record.

7. Press F10, type a unique filename in the Document To Be Saved

   box, and press ENTER. The primary document in WP 5.1 will resemble the

   following:

      "{FIELD}name~","{FIELD}address~","{FIELD}phone~"

Creating the Primary File (or form file) in WP 6.0:

1. Press F7, choose No, then choose No again to create a new

   WordPerfect document.

2. Type an opening quotation mark. Press SHIFT+F9, then 1 (Form).

3. Choose 1 (Field). Type the name of the first field and choose OK; or

   choose List Field Names to select fields from an existing data file.

4. Type a closing quotation mark, followed by a comma.

5. Repeat steps 2-4 for each field in the secondary file, changing

   only the field name or field position number as appropriate. Do not

   type a comma after the last field.

6. Press ENTER to place a hard carriage return at the end of the

   record.

7. Press F10, type a unique filename in the Document To Be Saved

   box, and press ENTER.  The form document in WP 6.0 will resemble the

   following:

     "FIELD(name)","FIELD(address)"

   NOTE: It is acceptable for the lines to wrap on the screen.

Merging the Primary and Secondary Files:

1. Press F7, choose No, then choose No again to create a new

   WordPerfect document.

2. Press CTRL+F9, then 1 (Merge).

3. In the Primary File or Form File box, type the name of the primary file

   and press ENTER.

4. In the Secondary File or Data File box, type name of the secondary file

   and press ENTER.

5. For WP 6.0 only, choose Merge.

Removing the Residual Hard Page Breaks:

1. In WP 5.1, press ALT+F2, then N to disallow replacements.  In WP 6.0,

   press ALT+F2.

2. At the -> Srch prompt, press CTRL+ENTER to enter a [HPg] code.

3. Press ALT+F2 twice to pass the Replace With message.

Saving As an Unformatted Text File in WP 5.1:

1. Press CTRL+F5, then 1 (DOS Text), then 1 (Save).

2. Type a valid document name, preferably with a .TXT extension, and

   press ENTER.

Saving As an Unformatted Text File in WP 6.0:

1. Press F10, type a valid document name, preferably with a .TXT extension.

2. Press TAB, choose DOS Delimited Text, then press ENTER.

WordPerfect is manufactured by WordPerfect Corporation, a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

REFERENCES

==========

"WordPerfect for DOS Reference," version 5.1, pages 420-431

"WordPerfect for DOS Workbook," version 5.1, pages 237-246

"WordPerfect for Windows Reference," version 5.1, pages 300-308

"WordPerfect for Windows Workbook," version 5.1, pages 203-210

"WordPerfect for Windows Reference," version 5.2, pages 321-328

"WordPerfect for Windows Workbook," version 5.2, pages 227-236

"WordPerfect for DOS Reference," version 6.0, pages 412-422

"WordPerfect for DOS Learning WordPerfect," version 6.0, pages 195-204

"WordPerfect for Windows Reference," version 6.0, pages 453-473

"WordPerfect for Windows Learning WordPerfect," version 6.0, pages 201-210

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpPrtm


INF: Expressions to Count Yes, No, and Other Responses

Article ID: Q101076

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists sample expressions that you can use to count the

occurrences of Yes, No, or Null in a field with a Yes/No data type.

MORE INFORMATION

================

The following expressions can be used in a report's group footers or

report footer to count the occurrences of Yes, No, or Null in a field

named YesNoField the with data type Yes/No:

   Expression                         Sums What

   --------------------------------------------

   =Sum(IIF([YesNoField],1,0))        Yes

   =Sum(IIF([YesNoField],0,1))        No

   =Sum(IIF(Not[YesNoField],1,0))     No

   =Sum(IIF(IsNull[YesNoField],1,0))  Null

You can also create a related expression to count a specific value in

a field. For example, the following sample expression counts all

occurrences of the value 3 in a field called MyField.

   =Sum(IIF([MyField]=3,1,0))

Example Using Sample Database NWIND.MDB

---------------------------------------

1. Open the sample database NWIND.MDB.

2. Use the Report Wizard to create a Groups/Totals report based on

   the Products table.

3. Select Category ID as the only field on your report.

4. Group on Category ID.

5. In the report's Design view, add an unbound text box in the Category ID

   Footer section with the ControlSource property for the box set to the

   following expression:

      =Sum(IIF([Discontinued],1,0))

6. Add a second unbound text box with the ControlSource property for

   the box set to the following expression:

      =Sum(IIF([Discontinued],0,1))

7. From the File menu, choose Print Preview. The first expression will

   count the number of products within each category that have the

   Discontinued field set to Yes. The second expression will count the

   number of products within each category that have the Discontinued

   field set to No.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptTotal


INF: Extend Mode and ESC in Form View

Article ID: Q96459

UifOthr


INF: Field and Record Validation Rule Enforced at Engine Level

Article ID: Q113874

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 enforces field and record validation rules

defined at the table level, regardless of the data input or editing method.

MORE INFORMATION

================

In Microsoft Access version 1.x, field validation defined at the table

level is not enforced by the database engine. The validation rule and

validation text defined in table design are used as the defaults for the

ValidationRule and ValidationText properties in forms. There is no record

validation in Microsoft Access 1.x.

In Microsoft Access 2.0, the validation rule for both the field and table

record are enforced at the engine level. The validation rules are enforced

whenever you add or edit data, whether through a table's datasheet, a

form bound to the table, an append query, an update query, Access Basic

code, or by importing data from another table.

If you have converted a database from Microsoft Access 1.x to version 2.0,

you can test to see if the data in the table meets the validation rules

with the Test Validation Rules command, available by clicking the right

mouse button on the title bar of the Table Design window.

The expression for a field validation rule cannot refer to fields or

controls in a field validation rule, user-defined functions, Microsoft

Access domain functions, aggregate functions, or the CurrentUser() or

Eval() functions. The expression for a record validation rule cannot

contain user-defined functions, Microsoft Access domain functions,

aggregate functions, or references to forms, queries, or tables.

Expressions can include only references to fields in the table.

The table below identifies the interactions between the field and form

validation rules:

   Field Validation

   Rule Defined       Form Validation

   (Table Level)      Rule Defined      Behavior

   ----------------------------------------------------------------------

   No                 No                No validation is performed

                                        at any level.

   Yes                No                Validation will be enforced

                                        regardless of method used

                                        to insert data.

   No                 Yes               Validation enforced at form level

                                        only. User can bypass the form

                                        validation rule when editing data

                                        outside the form.

                                        This is the same as Microsoft

                                        Access 1.x behavior.

   Yes                Yes               When editing data in a form, form

                                        validation rules will be enforced

                                        first. If the value passes form

                                        validation, then the field

                                        validation rule is enforced. In

                                        order for data to be accepted, it

                                        must pass both rules.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 8 "Changing and

Customizing Tables"

Additional reference words: 2.00

KBCategory:

KBSubcategory: TblFldp


INF: Fill New Record with Data from Prev. Record Automatically

Article ID: Q88670

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are creating new records, you may want to speed up the data

entry process by having fields in the new record fill with values from

fields in the previous record automatically.

This article demonstrates a sample Access Basic function called

AutoFillNewRecord() that you can use to fill fields in a new record with

values from fields in the previous record.

MORE INFORMATION

================

One technique used to automate repetitive data entry is to press

CTRL+apostrophe (') with your insertion point in a field. Microsoft

Access then inserts the value contained in the previous record in the

new field.

However, you may want certain fields in a new record to fill with data

from the previous record automatically.

The following Access Basic function, AutoFillNewRecord(), can be used

to fill either selected fields or all fields in a new record with

values from the previous record:

1. Open the sample database NWIND.MDB.

2. Create the following Access Basic module:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

   ' ********************************************************************

   ' DECLARATION SECTION

   ' ********************************************************************

   Option Explicit

   ' ********************************************************************

   ' FUNCTION: AutoFillNewRecord

   '

   ' PURPOSE:

   '   Speeds up repetitive data entry by automatically filling

   '   selected fields in a new record with data contained in fields in

   '   the previous record.

   '

   ' USAGE:

   '   Set the OnCurrent property of the form to read:

   '

   '      =AutoFillNewRecord()

   '

   '   If you want only certain fields filled in automatically, create

   '   an unbound text box on the form with the following properties:

   '

   '      ControlName: AutoFillNewRecordCriteria

   '      Visible: No

   '      DefaultValue: ;Company Name;Contact Name;Contact Title;Address;

   '

   '   NOTE: The DefaultValue property should be a semicolon-delimited

   '   list of control names on the form. You must have a semicolon

   '   to the left and right of each entry to avoid confusion with

   '   other fields with similar names.

   '

   '   If you want all fields automatically filled in, do not create the

   '   AutoFillNewRecordCriteria text box described above.

   '

   ' ********************************************************************

   Function AutoFillNewRecord ()

      Dim ds As Dynaset, F As Form, RetVal As Variant, i As Integer

      Dim AutoFillCriteria As String, AutoFillField As Variant

      On Error Resume Next

      ' Get the active form.. and exit if it is not available

      Set F = Screen.ActiveForm

      If Err Then Exit Function

      ' See if we are on the new record by trying to reference

      ' .. the bookmark. An error will occur if it is a new record.

      RetVal = F.Bookmark

      ' If there was no error, we are not on new record, so exit.

      If Err = 0 Then Exit Function

      Err = 0   ' Reset error flag

      ' Get the form dynaset and go to the last record. This last

      ' .. record is used to fill the new record with information.

      Set ds = F.Dynaset

      ds.MoveLast

      ' If we cannot move to, or find, last record, exit the function.

      If Err <> 0 Then Exit Function

      DoCmd Echo False

      ' Step through all the fields in the last record of the dynaset

      For i = 0 To F.Count - 1

         ' Get the list of fields to auto fill. An error will occur

         ' .. if there is no criteria field specified, which is

         ' ..  trapped and is examined later.

         AutoFillCriteria = F![AutoFillNewRecordCriteria]

         ' Do not fill the field in the new record by default.

         AutoFillField = False

         ' Fill the field in the new record if:

         '

         '   1. There are criteria fields (Err=0) and the current

         '      field name in the dynaset is found in the field criteria.

         '

         If (Err = 0 And InStr(1, AutoFillCriteria, ";" & _

            (F(i).ControlName) & ";")) Then

            AutoFillField = True

         End If

         '   2. No criteria fields were specified (Err<>0).

         '      (Fill ALL fields if no criteria is specified on the form)

         '

         If Err <> 0 Then  AutoFillField = True

         Err = 0   ' Reset error flag

         ' If we are going to fill the field, copy the value from the

         ' .. dynaset field (in last record) to the new record field

         ' .. on the form.

         If AutoFillField = True Then

            F(i) = ds((F(i).ControlName))

            ' Ignore error if one occurs during the fill.

            If Err <> 0 Then Err = 0

         End If

      Next i

      DoCmd Echo True

   End Function

3. Open the Customers form in Design view. Change the form's OnCurrent

   property to read:

      =AutoFillNewRecord()

4. Create an unbound text box on the form with the following

   properties:

      ControlName: AutoFillNewRecordCriteria

      Visible: No

      DefaultValue: ;Company Name;Contact Name;Contact Title;Address;

When you go to a new record, the Company Name, Contact Name, Contact

Title, and Address fields are filled in automatically. If you want all

fields to automatically fill in, you can either skip step 4 above or

leave the DefaultValue property blank.

Additional reference words: 1.00 1.10 2.00 default value DefaultValue

previous

KBCategory:

KBSubcategory: GnlDe


INF: Filling a Multiple-Column List Box Using Access Basic

Article ID: Q95903

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use Access Basic to fill in the information for a list box or

a combo box. On pages 82-85 of the Microsoft Access "Introduction to

Programming" manual, an example is given on how to fill in a

single-column list box. You can also use Access Basic to fill in a

multiple-column list box or combo box.

MORE INFORMATION

================

To create a multiple-column list box, you must set Code 4 in the

Select Case statement to the number of columns that you want in your

list box. In Code 6 of the Select Case statement, define the data that

will display in each column and row of the list box. The following

code is based on the example on page 84 of the Microsoft Access

"Introduction to Programming" manual:

'*********************************************************************

'Declarations section of the module

'*********************************************************************

Option Explicit

'=====================================================================

'The following function uses a select case statement to fill a

'two-column and four-row list box. The function fills the first column

'of the list box with the dates of the next four Mondays. The second

'column is filled with the dates of the next four Tuesdays.

'=====================================================================

Function ListMonTuesdays(fld As Control, id, row, col, code)

   Dim offset

   Select Case Code

     Case 0                          'Initialize.

       ListMonTuesdays=True

     Case 1                          'Open.

       ListMonTuesdays=id            'Unique ID number for control

     Case 3                          'Number of rows.

       ListMonTuesdays=4

     Case 4                          'Number of columns.

       ListMonTuesdays=2

     Case 5                          'Column width.

       ListMonTuesdays=-1            'Use default width.

'===============================================================

'In the next Case statement:

'

' Offset is the formula for finding the next four Mondays.

' If column=0, then fill in with the dates for the next four

' Mondays in column 1. If column=1, then fill in with the dates

' for the next four Tuesdays in column 2.

'===============================================================

     Case 6                          'Get Date

       Offset=abs((9-Weekday(Now))Mod 7)

       If col=0 then

          ListMonTuesdays=Format(Now()+offset+7*row,"mmmm d")

       Else

          Offset=abs((10-Weekday(Now))Mod 7)

          ListMonTuesdays=Format(Now()+offset+7*row,"mmmm d")

       End if

    End Select

End Function

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, pages 82-85

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: FmsCmbo


INF: FindEOM() Sample Function to Find Last Day of Month

Article ID: Q103184

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample Access Basic function called FindEOM()

that accepts a date as an argument and returns the last day of the

month.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

The sample code below demonstrates how to set up the FindEOM()

function. Enter the following in a new or existing module:

   '******************************************************

   'Declarations Section of Module

   '******************************************************

   Option Explicit

   '******************************************************

   'FindEOM Function

   '******************************************************

   'This function takes a date as an argument and returns the last

   'day of the month.

   Function FindEOM (MyDate)

       Dim NextMonth, EndOfMonth

       NextMonth = DateAdd("m", 1, MyDate)

       EndOfMonth = NextMonth - DatePart("d", NextMonth)

       FindEOM = EndOfMonth

   End Function

Use the following sample expression to call the FindEOM() function:

   =FindEOM(#5/5/93#)

To view the results of the FindEOM() function, type the following in

the module's Immediate window:

   ?FindEOM(#5/5/93#)

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Finding the OLE ClassKey of an Embedded Object

Article ID: Q99319

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access places a wrapper of information around an OLE object

before it stores the object in a table. The Name and ClassKey of the

object start at byte count 21 and are stored from there as two

zero-terminating strings. By reading the field as a text field, you

can parse out the ClassKey.

This article describes how to use Access Basic to find the ClassKey of

an embedded object with an OLE-Object data type.

MORE INFORMATION

================

When an OLE object is stored in a table, the ClassKey is the second

null-terminated string after the 20th byte in the object. It can be

read as text with the following Access Basic code:

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

   Function GetObjectClass$ ()

      If IsNull(screen.activeform!Photo) Then

         GetObjectClass$ = "n/a"

      Else

         MyChunk$ = Mid(screen.activeform!Photo, 21, 40)

         NullOne% = InStr(1, MyChunk$, Chr$(0))

         NullTwo% = InStr(NullOne% + 1, MyChunk$, Chr$(0))

         GetObjectClass$ = Mid(MyChunk$, NullOne% + 1,_

                               NullTwo% - NullOne% - 1)

      End If

   End Function

The GetObjectClass$() function first checks to see if the object is

null and returns the value "n/a" if it is. If the object is not null,

it assigns bytes 21 through 40 of the OLE object to the string

MyChunk$ and then searches for the first null character, the next null

character, and so forth. Finally, it sets the GetObjectClass$()

function equal to the string between the two null characters.

Using the function provided above, a control on the Employees form of

the sample database NWIND.MDB, with the properties below, displays the

ClassKey for the Photo control:

   ControlName:   ObjClassKey

   ControlSource: =GetObjectClass()

This example returns "PBRUSH" for the first photo in the Employees

table.

There are several different ways to use this information.

RegQueryValue(), a function contained in the Microsoft Windows

SHELL.DLL file, uses the ClassKey to obtain information about that

class from the REG.DAT file.

REFERENCES

==========

For more information about calling the RegQueryValue() function to get

the Class Name of an OLE object, query on article Q99322 here in the

Microsoft Knowledge Base.

Microsoft Windows "Programmer's Reference," version 3.1, Volume 2,

page 282

Additional reference words: 1.00 1.10 2.00 dll ClassName Class Key

KBCategory:

KBSubcategory: IntpOle


INF: Force MS Access to Use "Snapshot" Mode for Attached Data

Article ID: Q100972

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access addresses attached data differently than it does

its own native data. This article discusses how Microsoft Access

retrieves attached ODBC data.

MORE INFORMATION

================

If SQLStatistics(), an ODBC API function, reports a unique index on

the table, Microsoft Access goes to the dynaset to select the values

from the unique key fields that adhere to the user's WHERE clause

restrictions. It then selects only the data needed for display, using

the unique key values (10 at a time).

If the table does not have a unique key, Microsoft Access pulls down

all the data at once in read-only ("snapshot") mode. In most cases,

this process will be faster once the data is pulled down, though the

data cannot be updated.

If you want to enforce read-only mode all the time, add the following

line to the [ODBC] section of your MSACCESS.INI file:

   SnapshotOnly=1

This restriction will apply only to tables attached after you make the

change and will simply short-circuit the call to the SQLStatistics()

function during the attachment phase.

In general, a table in dynaset mode typically takes 4-5 seconds to

open, as opposed to 1-2 seconds for a table in read-only mode.

Additional reference words: 1.00 1.10 2.00 snapshot

KBCategory:

KBSubcategory: ObcOthr


INF: Form and Report Modules Have Local Scope

Article ID: Q112726

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes the effect of "scope" of procedures and variables in

form and report modules. Scope refers to the extent to which an identifier

(that is, a constant, data type, variable, or routine) can be referenced

in a program.

MORE INFORMATION

================

The procedures and variables defined in a form or report module have

"local" scope; that is, they and their values do not exist outside of that

object. Attempting to call a function in a form or report module outside

that form or report results in a "reference to undefined function or array"

error message or other "unknown function name..." type of error. A call

made to a subroutine from outside the form or report results in a "syntax

error" message.

A reference to one of the form's variables from a different module produces

unexpected results. Due to the nature of modules and procedures, a new

variable of the same name is implicitly created with an Empty value

(Variant type 0). If Option Explicit has been specified in the module that

refers to the form's variable, then a "Variable not Defined" compile error

occurs.

When you plan to create a procedure or variable in a form or report module,

first determine that nothing outside of that form or report will require

that the procedure or variable exist. Any variable or procedure you

write in a form or report module should be useful to that form or report

only.

If you need to call a procedure from multiple forms or reports, place the

procedure in a global module. Do the same for any variables your code needs

to access from more than one form or report.

The following example demonstrates the scope of a function in a form module

and the errors that can occur:

1. Create a new database.

2. Create the following new form and name it Form1:

     Form: Form1

     -------------------------

     no RecordSource (unbound)

     Form1 Controls

     --------------------------

     command button: Button0

        Caption: Form1_SayHi

        OnClick: =Form1_SayHi()

3. In Form1's Design view, choose Code from the View menu. Form1's

   module will be displayed. Enter the following function in the module:

      Function Form1_SayHi()

        MsgBox "Hi!"

      End Function

4. Create the following new form, and call it Form2:

      Form: Form2

      -------------------------

      no RecordSource (unbound)

      Form2 Controls

      --------------------------

      command button: Button0

         Caption: Form1_SayHi

         OnClick: =Form1_SayHi()

5. From the Database window, create a new module. Enter the following

   function in the module:

      Function Run_Form1_SayHi()

        Run_Form1_SayHi = Form1_SayHi()

      End Function

6. Open both forms. Click the command button on Form1. A message box

   with the text "Hi!" will be displayed. This works because the

   function is in scope in Form1.

7. Click the command button on Form2. An error message will be displayed.

   This is because the function is out of scope for Form2.

8. In the module's Immediate window, type the following and then

   press ENTER:

      ? Run_Form1_SayHi()

The error message "Reference to undefined Function or array" will be

displayed. The error occurs because the function is still out of scope.

Calling the function from anywhere except Form1 will result in an error.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, pages 59-60

Additional reference words: 2.00 cbf code behind forms

KBCategory:

KBSubcategory: FmsOthr


INF: Form OnOpen Property May Not Set Unbound Control Values

Article ID: Q90146

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access version 1.x, if you have unbound controls on a form or

report that you want to set with a macro called from the OnOpen property,

that macro should include a GoToControl or GoToRecord action before the

SetValue action(s). The OnOpen property is triggered when the form or

report opens, before the first record is displayed. When the OnOpen

property is triggered, there is no current record or control to set. You

must have a current record or control before Microsoft Access can set any

controls on a form or report.

In Microsoft Access version 2.0, the timing of events on forms is changed

slightly, making it possible to run a SetValue action without a GoToControl

or GoToRecord action preceding it. The OnOpen timing for reports is not

changed, however, and a GoToControl or GoToRecord action is still

necessary.

MORE INFORMATION

================

In version 1.x, the OnOpen property for forms and reports is triggered when

the object is opened, but before there is a current record. To force the

focus to a specific control in order to set its value before the first

record is displayed, insert a GoToControl or GoToRecord action before the

SetValue action in the macro called from the OnOpen property.

If the controls' values are to come from a specific record, use the

GoToRecord action in your macro before the SetValue action. If you want to

set the value of individual controls, use the GoToControl action.

Actions such as GoToControl or GoToRecord, by default, refer to the object

calling the macro. Therefore, the Item action argument for each GoToControl

and SetValue action need only contain the ControlName (or Name, in version

2.0) of the control whose value you want to set.

REFERENCES

==========

For more information, search for "OnOpen" then "OnOpen, OnClose Properties"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 setvalue

KBCategory:

KBSubcategory: FmsEvnt


INF: Formatting a Label for Each Axis of a Graph

Article ID: Q99398

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Graph versions 3.0 and 5.0

---------------------------------------------------------------------

SUMMARY

=======

The Microsoft Access GraphWizard does not give users the option to

format a label for each axis of the graph. You can modify the labels

in Microsoft Graph, but this change is not permanent. The next time

the graph is updated, the formatting is lost.

This article describes the steps to change the format permanently by

modifying the information that Microsoft Access sends to Microsoft

Graph.

MORE INFORMATION

================

When a graph is created using GraphWizard, a SQL statement is built.

This statement is placed in the RowSource property of the graph

object. Each time the form or report in which the graph resides is

refreshed, the SQL statement is re-executed and the results are sent

to Microsoft Graph.

This SQL statement can be modified by the user. We recommend that you

copy it to a new query, where you can test your changes.

The example below describes the steps to change the format of the

labels in a graph:

Procedure A - Create the Graph

------------------------------

For Microsoft Access 2.0:

1. Open the sample database NWIND.MDB. In the Database window, select

   the Orders table.

2. Choose the New Form button on the toolbar to create a new form.

3. Choose FormWizards. Select Graph and then choose OK.

4. Select the Order Date field from the Available Fields list and

   choose the right arrow to add it to the Fields for Graph list.

5. Repeat step 4 for Freight, then choose Next four times to accept

   the default (Group [Order Date] by: Year).

6. Choose Finish.

Note that the labels for the axes are: 1991, 1992, 1993, 1994

For Microsoft Access versions 1.0 and 1.1:

1. Open the sample database NWIND.MDB. In the Database window, select

   the Orders table.

2. On the Toolbar, choose the Forms button to create a new form.

3. Choose FormWizards. Select Graph and then choose OK.

4. To accept the defaults, press Next when the following message

   appears: "Which type of graph do you want?"

5. Select the Order Date field from the Available Fields list and

   choose the right arrow to add it to the Fields for Graph list.

6. Repeat step 5 for Freight, then choose Next twice to accept

   the default (Group [Order Date] by: Year). Choose Open.

   Note that the labels for the axes are: 1989, 1990, 1991, 1992

Procedure B - Changing the Label Format

---------------------------------------

For Microsoft Access 2.0:

1. Open your form in Design view.

2. Select the graph. If the property sheet is not displayed, choose

   Properties from the View menu.

3. With your right mouse button, click the RowSource property and choose

   Build.

4. Change the field Year([Order Date]) to Format([Order Date],"YY").

   Execute the query to verify that the years in the Order Date column are

   formatted as follows: 89, 90, 91, 92.

5. Close the query and save the changes.

6. Switch to Form view. The labels of the axes should now read as

   follows: 91, 92, 93, 94.

For Microsoft Access versions 1.0 and 1.1:

 1. Switch to Design view. Select the chart object and display the

    property sheet.

 2. Place your insertion point in the RowSource property and press

    SHIFT+F2 to open the Zoom window.

 3. Highlight the entire SQL Statement to select it. Press CTRL+C to

    copy it to the Clipboard.

 4. Create a new query by choosing the Query button on the Toolbar.

 5. From the View menu, choose SQL.

 6. Highlight all the text in the SQL dialog box to select it. Press

    CTRL+V to replace the existing text with the Clipboard contents.

 7. Choose OK. The fields [Order Date] and [Order Amount] are placed in

    the query grid.

 8. Change the field Year([Order Date]) to Format([Order Date],"YY").

    Execute the query to verify that the years in the Order Date column are

    formatted as follows: 89, 90, 91, 92.

 9. Switch to Design view. Copy the contents of the SQL dialog box

    to the Clipboard.

10. Return to the form. Select the chart object and paste the

    contents of the Clipboard into the RowSource property.

11. Switch to Form view. The labels of the axes should now read as

    follows: 89, 90, 91, 92.

Additional reference words: 1.00 1.10 2.00 chart ole embed requery label

KBCategory:

KBSubcategory: RptLabel


INF: Formatting Immediate IF (IIF) Statements in Reports

Article ID: Q106184

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If a report that is based on a query contains a field that includes a null

value from an Immediate If (IIf) statement, you will not be able to

format the field properly on the report.

MORE INFORMATION

================

There are two ways to work around this behavior. The first method is to

format the IIf expression in the query. You can add a format statement to

the beginning of the IIf statement. For example, the following statement

would add formatting to the field:

   Format(IIF([freight] = 32.07,[freight],null),"$0.00")

The second method is to use the IIf statement on the report directly, and

not in the query. For example, you could add the following statement to the

ControlSource property of the expression field's text box:

   =Format(IIF([freight]=32.07,[freight],null),"$0.00")

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Customers and the Orders

   tables. Join the two tables on the Customer ID field. Save the

   query as TestIIF:

      Query: TestIIF

      ---------------------------------------------------

      Field: Company Name

      Field: Order ID

      Field: Freight

      Field: Shipped Date

      Field: MyField: IIf([freight]=32.07,[freight],null)

3. Use the ReportWizards to create a new single-column report based on

   the TestIIF query. Include all the fields on the report.

4. Choose Print Preview to verify that the MyField field is unformatted.

5. Choose Cancel to return to Design view. Try to format the field.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlFrmt


INF: Four Ways to Move to a Record from a Combo Box Selection

Article ID: Q100132

------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

------------------------------------------------------------

SUMMARY

=======

Listed below are four different methods of moving to a specific record

based on a combo box selection:

1. In the AfterUpdate property of the combo box, call a macro using

   the FindRecord action.

2. In the AfterUpdate property of the combo box, call a macro using

   the ApplyFilter action.

3. Use a Form/Subform, with the combo box in the main form and the

   data in the subform, bound by the LinkMasterFields and

   LinkChildFields properties.

4. Base the form on a query joining two tables and bind the combo

   box to the field that controls the join, using the row fix-up or

   dynamic lookup techniques.

MORE INFORMATION

================

These four methods are outlined in the sections below and are based on

the sample database NWIND.MDB.

The following table compares the features (benefits and drawbacks) of

the four methods:

   Method Number:                  1   2   3   4

   ---------------------------------------------

   Requires no code/macros                 x   x

   Saves on subforms               x   x       x

   Can scroll to other records     x       x   x

   Does not require a query        x   x   x

   Can edit records                x   x   x

   ---------------------------------------------

NOTE: These methods can also apply to text boxes.

Method 1

--------

1. Create a form called ComboTest based on the Products table. You must

   include at least the Product ID field on the new form. (Additional

   fields can help to illustrate that you have changed records based

   on the value selected in the combo box.) Set the DefaultView

   property to Single Form.

      Object: Text Box

      -------------------------

      ControlName: Product ID

      ControlSource: Product ID

      Visible: Yes

2. Create an unbound combo box called Combo1 with the properties

   described below. The combo box can be located anywhere on the form,

   but preferably in the form header or footer.

      Object: Combo Box

      ---------------------------------

      ControlName: Combo1

      ControlSource: <leave blank>

      RowSourceType: Table/Query

      RowSource: Products

      ColumnCount: 4

      ColumnWidths: 0 in;0 in;0 in;2 in

      BoundColumn: 1

      After Update: Locate Product

3. Create a new macro called Locate Product with two actions:

      Macro: Locate Product

      ----------------------------

      GoToControl

         ControlName: [Product ID]

      FindRecord

         Find What: =Combo1

         Find First: Yes

4. Switch to Form view. Note that when you choose a product name in

   the combo box, you are moved to the record selected and the

   appropriate Product ID is displayed.

Another example of this method is illustrated in the Suppliers form in

NWIND.MDB in Microsoft Access version 1.x, and in the Products And

Suppliers form in Microsoft Access version 2.0.

Method 2

--------

1. Repeat steps 1 and 2 from Method 1 described above.

2. Create a macro called Locate Product with one action:

      Macro: Locate Product

      ------------------------------------------------

      ApplyFilter

         Where:[Product ID]=Forms![ComboTest]![Combo1]

The Product ID field is the bound field in the combo box. While the

combo box displays the Product Name information, it is bound to (or,

holds internally) the value of the Product ID.

This method is similar to the Suppliers form in NWIND.MDB, which uses

the buttons to filter records from A to Z. Also, see the Alpha Apply

Filter Buttons macro.

Method 3

--------

1. Create a new, unbound form. Add a combo box with the following

   properties:

      Object: Combo Box

      ---------------------------------

      ControlName: Combo1

      ControlSource: <leave blank>

      RowSourceType: Table/Query

      RowSource: Products

      ColumnCount: 4

      ColumnWidths: 0 in;0 in;0 in;2 in

      BoundColumn: 1

2. Create a second form based on the Products table to use as a

   subform. Include at least the Product ID field. (Additional fields

   can help to illustrate that you have changed records based on the

   value selected in the combo box.) Set the DefaultView property to

   Single Form.

      Object: Text Box

      -------------------------

      ControlName: Product ID

      ControlSource: Product ID

      Visible: Yes

3. Save the form, then use it to create a subform control on the first

   form by dragging it from the Database window to the Detail section

   of the first form.

4. Set the subform control properties as follows:

      Object: Subform

      -----------------------------

      LinkChildFields: [Product ID]

      LinkMasterFields: Combo1

By changing the value in Combo1, Microsoft Access ensures that the

records in the subform match the combo box.

The Orders form in NWIND.MDB illustrates this method. The Order

Details subform is related by the LinkMasterFields and

LinkChildFields properties.

Method 4

--------

1. Create a table called Prd containing a single field Product ID. Set

   the data type to Number and the field size to Long Integer. No primary

   key is necessary.

2. Create a single blank record.

3. Create a query called Prd Query based on a join between the Product

   ID fields of the Prd and Products tables. Include the following

   attributes in the query:

      Query: Prd Query

      -----------------------------------------------

      Field: Product ID

         TableName: Prd

         Show: X

      Field: <any other fields you are interested in>

         TableName: Products

4. Create a form based on Prd Query and add all fields. You must add at

   least the Product ID field.

5. Delete the text box control for Product ID and re-create it as a

   combo box, as follows:

      Object: Combo box

      ----------------------------------

      ControlName: Product ID

      ControlSource: Product ID

      RowSourceType: Table/Query

      RowSource: Products

      ColumnCount: 4

      ColumnWidths: 0 in;0 in ;0 in;2 in

      BoundColumn: 1

The Orders form in NWIND.MDB illustrates this method. It allows the

customer name and address to be selected based on the Customer ID

combo box. By changing the Customer ID in the Orders table, the

related Customers record is changed and the corresponding fields are

updated on the form. For another example, see the Products And

Suppliers form.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 270-284 and 545-548

Microsoft Access "User's Guide," version 1.1, pages 274-288 and 549-552

Microsoft Access "User's Guide," version 2.0, Chapter 17, "Creating Forms

Based on More Than One Table"

For more information on the dynamic lookup or row fix-up techniques,

query on the following words here in the Microsoft Knowledge Base:

   dynamic and lookup

   -or-

   row and fix-up

For more information on how to reference controls on a form, search

for "Identifiers in Expressions" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 Forms Controls Text box

KBCategory:

KBSubcategory: FmsCmbo


INF: Function to Determine Retail or Run-Time Version

Article ID: Q103182

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use a function to determine if your

Microsoft Access application is running in the run-time or the retail

version of Microsoft Access. This function can be used to prevent your

application from being used in the retail version of Microsoft Access.

MORE INFORMATION

================

NOTE: This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

The following example demonstrates how to create a function called

IsRunTime() that can be used to prevent an application from being run

in the retail version of Microsoft Access.

1. Add the following function called IsRuntime() to a new or existing

   module in your application:

      Function IsRuntime ()

         On Error GoTo ErrIsRuntime

         IsRuntime = SysCmd(6)

      ByeIsRuntime:

         Exit Function

      ErrIsRuntime:

         If (Err = 5) Then

            IsRuntime = False

         Else

            Error Err

         End If

         Resume ByeIsRuntime

      End Function

Note that it is necessary to trap for Err = 5, Illegal Function Call,

in case your application is being run in Microsoft Access version 1.0,

which does not support the SysCmd(6) call.

2. Create the following macro and save it with the name AutoExec:

      Condition         Action        Defined Below

      ---------------------------------------------

      Not IsRuntime()   MsgBox        1

      ...               Quit          2

      AutoExec Actions

      ----------------

      1. MsgBox

            Message: Invalid setup, run YourAppName setup and try again.

            Beep: Yes

            Type: Critical

            Title: YourAppName

      2. Quit

Additional reference words: 1.10 2.00

KBCategory:

KBSubcategory: GnlApp


INF: Function to Show Date/Time as Hours, Minutes, and Seconds

Article ID: Q115918

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function called

GetTimeStr() that you can use to display a cumulative time amount as total

hours, minutes, and seconds.

The GetTimeStr() function may be useful when you need to display the sum of

the difference between the start time and the end time for a number of

records.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

Given a table with each record having a start time and an end time, you can

find the difference between the two times with the an expression similar

to:

   =[end time] - [start time]

This expression will result in a decimal value because Microsoft Access

stores time as a number representing a fraction of 1 day. You can multiply

the resulting value by 24 to see the value in hours. For example, 12:00

P.M. (noon) is stored as 0.5 (half the day has expired). To see the value

in hours, multiply 0.5 by 24, to get 12 hours. 9:00 A.M. is stored as

0.375. Multiplying 0.375 by 24 results in 9 hours.

You can use the CSng() function to see the numeric equivalent of a time.

For example, the function

   ? CSng(#12:00pm#)

results in 0.5.

The following function demonstrates how to see the difference in two times

as a value in hours:

   ? CSng(#10:00am#-#9:00am#)*24

This function returns a value of 1.

Given a table with 100 records, all of which have a start time of 9:00 A.M.

and an end time of 10:00 A.M., you could sum the difference in times for

the records to get a numeric value of 4.1666666666667. Multiplying the

numeric value of 4.1666666666667 by 24 would return a value of 100 hours.

This works well for whole-hour values. However, numeric values that do not

represent whole hours, when multiplied by 24, will return decimal hour

values, which may not be what you want. For example, the function

   ? CSng(#10:23am#)*24

will return an hour value of 10.38333.

The GetTimeStr() function returns values broken out by hours, minutes, and

seconds.

The GetTimeStr() Function

-------------------------

Syntax: GetTimeStr(DateTime, Format)

Argument           Description

----------------------------------------------------------------------

DateTime           Date/Time data-type value that contains the data

                   you want to use.

Format             String of display format characters.

                   For consistency with Microsoft Access the following

                   symbols are allowed:

                   Symbol    Meaning

                   -------------------------

                   h         Display hours

                   n         Display minutes

                   s         Display seconds

Remarks: To display a unit with a fixed number of leading zeros,

         repeat the symbol as many times as needed. For example,

         to display hours to the hundreds unit, use the format

         "hhh."

         The first symbol will determine the units to be displayed.

         Each additional symbol must be delimited with a colon (:).

         Additional symbols will show additional units as remainders

         of the first unit. The following table demonstrates what will

         be displayed for various formats given a DateTime of 1.11

         (1.11 days):

         Format         Result

         -------------------------------------

         "h"            26 Hrs

         "h:n"          26 Hrs 38 Mins

         "h:n:s"        26 Hrs 38 Mins 24 Secs

         "n"            3996 Mins

         "n:s"          3996 Mins 24 Secs

         "s"            95904 Secs

         If the format does not begin with a valid symbol the result

         is "#Error?"

NOTE: In the following sample code, an underscore (_) at the end of a line

is used as a line-continuation character. Remove the underscore from the

end of the line when re-creating this code in Access Basic.

   Option Compare Database  'Use database order for string comparisons.

   Option Explicit

   Function GetTimeStr (dt As Variant, frmt As String) As String

     Dim totalsec As Double

     Dim hrs As Variant

     Dim mins As Variant

     Dim secs As Variant

     Dim timestr As String

     Dim p As Integer

     Dim timefrmt As String

     If IsNull(dt) Then

       GetTimeStr = ""

       Exit Function

     Else

       totalsec = ((dt) * 86400)

     End If

     Select Case Left$(frmt, 1)

       Case "H"

         hrs = (totalsec \ 3600)

         mins = ((totalsec Mod 3600)) \ 60

         secs = (totalsec Mod 60)

       Case "N"

         hrs = 0

         mins = ((totalsec \ 24))

         secs = (totalsec Mod 60)

       Case "S"

         hrs = 0

         mins = 0

         secs = (totalsec)

       Case Else

         GetTimeStr = "#Error?"

         Exit Function

     End Select

     timestr = ""

     Do Until Len(frmt) = 0

       p = InStr(frmt, ":")

       If p = 0 Then

         timefrmt = frmt

         frmt = ""

       Else

         timefrmt = Left$(frmt, (p - 1))

         frmt = Mid$(frmt, (p + 1))

       End If

       Select Case Left$(timefrmt, 1)

         Case "H"

           timestr = timestr & (Format$(hrs, String$(Len(timefrmt),_

           "0"))  & " Hrs ")

         Case "N"

           timestr = timestr & (Format$(mins, String$(Len(timefrmt),_

           "0")) & " Mins ")

         Case "S"

           timestr = timestr & (Format$(secs, String$(Len(timefrmt),_

           "0")) & " Secs")

       End Select

     Loop

     GetTimeStr = timestr

   End Function

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Functions to Left and Right Pad Character Strings

Article ID: Q96458

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

An imported file may contain field values that have a combination of

numeric and alphabetic characters. These fields do not sort in proper

order if they contain variable numbers of characters. This article

describes functions that you can use to pad these values with a

selected character to produce values of consistent length.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

Suppose you have a table that contains Customer ID numbers with values

entered as follows:

   Customer ID

   -----------

   123B

   1231

   1231B2

   B123

In a query, these numbers would sort in ascending order as follows:

   Unpadded        Right Padded    Left Padded

   -------------------------------------------

   1231            123100          001231

   1231B2          1231B2          00123B

   123B            123B00          00B123

   B123            B12300          1231B2

Right padding does not change the sort order; however, it is useful if

you need to make all values a consistent number of characters. Left

padding, however, will allow proper sorting.

To create a left-padding function and a right-padding function, enter

the following code in a new or existing module in your database.

Note: In the following sample code, an underscore (_) is used as a

line continuation character. Remove the underscore when re-creating

this code in Access Basic.

'*********************************************************************

'Declarations section of the module.

'*********************************************************************

Option Explicit

Dim x As Integer

Dim PadLength As Integer

'=====================================================================

'The following function will left pad a string with a specified

'character. It accepts a base string which is to be left padded with

'characters, a character to be used as the pad character, and a

'length which specifies the total length of the padded result.

'=====================================================================

Function Lpad (MyValue$, MyPadCharacter$, MyPaddedLength%)

   Padlength = MyPaddedLength - Len(MyValue)

   Dim PadString As String

   For x = 1 To Padlength

      PadString = PadString & MyPadCharacter

   Next

   Lpad = PadString + MyValue

End Function

'=====================================================================

'The following function will right pad a string with a specified

'character. It accepts a base string which is to be right padded with

'characters, a character to be used as the pad character, and a

'length which specifies the total length of the padded result.

'=====================================================================

Function Rpad (MyValue$, MyPadCharacter$, MyPaddedLength%)

   Padlength = MyPaddedLength - Len(MyValue)

   Dim PadString As String

   For x = 1 To Padlength

      PadString = PadString & MyPadCharacter

   Next

   Rpad = MyValue + PadString

End Function

The following example shows an update query that would modify the

Customer ID field by left padding the field with the 0 (zero)

character. You will use the Lpad function that was created in step #2.

   Update Query: Leftpad Customer Number

   ---------------------------------------

   Field name: Customer ID

      Update to: Lpad([Customer ID],"0",6)

Additional reference words: 1.00 1.10 2.00 constant

KBCategory:

KBSubcategory: ExrOthr


INF: Hiding the Database Window Menu Bar

Article ID: Q109337

UifOthr


INF: Hints for Printing Mailing Labels

Article ID: Q92807

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Microsoft Access ReportWizard for mailing labels makes it quick

and easy to create a report design for many standard mailing labels.

However, sometimes you may have difficulty getting the labels to print

correctly on your printer. Here are some hints and suggestions for

getting labels to print.

MORE INFORMATION

================

The Microsoft Access ReportWizard for mailing labels creates report

specifications for standard mailing labels. However, in order to do

so, it makes some assumptions about your printer which may not be

true. In particular, it assumes that it can print within a certain

distance of each edge of the paper. Every Windows print driver can

have a different "printable region," which is the rectangle on the

printed page that the application can print into. This rectangle may

be smaller than the rectangle that the physical printer can print, due

to space and efficiency considerations in the print driver. Therefore

you may not be able to print labels as close to the edge of the paper

as you would like.

In general, the ReportWizard assumes that it can print within .25 inch

of the edge of the paper. If you find that some of the text in your

labels is getting cut off or is not getting printed at all, try going

into design mode for the report and moving text items until all of the

text prints. For example: Select all the controls and move the entire

group down a little within the Detail section to adjust for a top

label being missed. You may have to make the items smaller, choose a

smaller font, and move them closer together to get everything to fit

without having the label cut off at either the top or the bottom of

the printed page.

If your printer has such a large top margin that you cannot move your

text items down far enough (or if doing so results in a visually

crowded label), the next thing to do is change the Print Setup margins

so that the first label on each page is not used. To do this, choose

Print Setup and add the height of your labels to the top margin

provided by the ReportWizard. For example, if you are using 1 inch

labels, and the top margin is .03 inch, change it to 1.03 inches to

skip the first label on the page. If you are having trouble with the

last line of the last label getting cut off, you can use the same

technique on the bottom margin to cause the last label on the page to

be skipped.

Another common problem is that some labels come on sheets that are 12

inches tall, whereas the print driver only knows about 11 inch paper.

In this case, you must ignore the last label on the page and use the

labels that fall within the first 11 inches.

Additional reference words: 1.00 1.10 2.00 w_print wizards

KBCategory:

KBSubcategory: RptLabel


INF: How First Line of Data is Used to Import Delimited Text

Article ID: Q99401

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The first line of data is extremely important when you are importing

delimited text files. Microsoft Access uses the first line of data to

determine the following:

 - The number of fields

 - The data type for each field

For this reason, it is important to verify that the first line of data

correctly reflects the rest of the data in the table. This article

discusses some of the common problems you may encounter when the first

line of data is incorrect and how to work around these problems.

MORE INFORMATION

================

To specify the structure that Microsoft Access should use, you can use

the following steps instead of relying on the first line of data:

1. Create a table in Microsoft Access that has the correct number of

   fields and the correct data type for each field.

2. From the File menu, choose Import.

3. Select Text (Delimited) from the Data Source list and choose OK.

4. Select the text file and choose OK.

5. In the Import Text Options dialog box, choose Append To Existing

   Table and specify the table you created in step 1.

6. Choose OK to import the file.

Determining the Number of Fields

--------------------------------

Microsoft Access scans the first line of data to determine the number

of fields in the text file. If successive records contain more fields,

these are ignored and no error message is given. For example, suppose

you have a text file that looks like the following:

   5959,"John Doe","123 Main Street"

   5960, "George Brown","55 Orange Avenue","MainTown","WA","USA"

Because the first line only contains three fields, Microsoft Access

creates the following table:

   Column 1     Column 2          Column 3

   -----------------------------------------------

   5959         John Doe          123 Main Street

   5960         George Brown      55 Orange Avenue

Note that the additional fields are ignored and no error message is

generated.

Determining the Data Types

--------------------------

Microsoft Access scans the first line to determine the data type for

each field. If the data type in the field is invalid, a "Type

Conversion Failure" error message is generated in the Import Errors

table. For example, if the following text file is imported

   5959,"John Doe","123 Main Street",8/12/90

   5960,"George Brown","55 Orange Avenue",81290

   ABCD,"Jane Bell","78 West Street",8/12/90

Microsoft Access detects four fields with the following data types:

   Field      Data Type

   --------------------

   1          Number

   2          Text

   3          Text

   4          Date/Time

The second record fails to convert because the number 81290 in the

fourth field is not a Date/Time data type, as determined by the first

record value (8/12/90). The third record fails because "ABCD" in the

first field is not a number. As a result, Microsoft Access reports

type conversion errors in each case.

Other Workarounds

-----------------

In addition to import appending the text file to an existing table, it

is also possible to use a text editor to edit the first line of data

to correctly reflect the number of fields and data types in the file.

If a field in the first row contains a number that is supposed to

belong in a text field, type double quotation marks around the number

in the first row. Microsoft Access will then correctly interpret the

field as a text field.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 72-79

Additional reference words: 1.00 1.10 2.00 import

KBCategory:

KBSubcategory: IsmTxtd


INF: How Microsoft Access Deletes Objects from a Database

Article ID: Q90129

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The following is a description of what happens internally when an

object (table, form, query, and so on) is deleted from a database in

Microsoft Access.

MORE INFORMATION

================

When you delete an object from the Database window, it is not physically

deleted from the database at that moment. Instead, it is renamed to a

temporary name (for example, ~TMPCLP1) and hidden, so that it disappears

from the Database window. The renaming operation occurs very quickly,

regardless of the object's size. The hidden object is physically deleted

from the database once you take any action other than the Undo Deletion

action.

Objects are deleted this way so that you can undo an accidental deletion,

unless some other action has been taken that then makes "undoing" an object

deletion impossible. Microsoft Access can undo commands only one level

back; it cannot queue up multiple commands to undo actions.

Since the physical object deletion occurs on the next action taken, instead

of when Delete is chosen, your computer may appear to be hung while it is

performing the delete. If the object is large enough, the deletion can take

some time.

NOTE: If you reboot your computer before the deletion is completed, the

hidden temporary object remains in the database, wasting space. To remove

hidden objects like this, compact the database.

Speed of Deletion

-----------------

The time it takes to delete an object depends on how large it is and

how fast the computer is that you are using. Smaller objects are

deleted faster than larger ones. If the database that contains the

object to be deleted is on a network file server, the deletion will

take longer.

How long an object deletion will take cannot be accurately predicted,

since the speed of deleting the object is also affected by the nature

of the data contained in it. (For example, with tables, number columns

are deleted more quickly than memo and OLE columns.)

Internally, Microsoft Access does not provide a status callback for

object deletion, so a progress indicator in the status bar is not

possible. Since there is no progress indicator, Microsoft Access does

not yield to the system until the object deletion procedure is

complete. Therefore, you cannot abort the operation or switch to

another application during object deletion.

Additional reference words: 1.00 1.10 2.00 Tables Deleting Erasing

KBCategory:

KBSubcategory: GnlOthr


INF: How Microsoft Access Uses SHARE.EXE

Article ID: Q113355

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes the SHARE.EXE file-sharing utility, and how it is

used by Microsoft Access to handle file sharing for multiuser databases.

MORE INFORMATION

================

Description of SHARE.EXE

------------------------

SHARE.EXE (Share) is a file-sharing utility included with MS-DOS versions

3.0 and higher. It is used by application programs that work with several

files at a time. It is essential for sharing files on a network with

multiple users.

In MS-DOS, Share is a terminate-and-stay-resident (TSR) utility. If you are

running Windows for Workgroups version 3.11 in enhanced mode, Share is

replaced by an enhanced mode virtual device driver (VxD) called VSHARE.386

(VShare). VShare was designed for Windows for Workgroups and the peer-to-

peer networking it supports. Since Windows for Workgroups 3.11 uses only

VShare, you can conserve memory by not loading Share. Consult your Windows

for Workgroups documentation for more information about using VShare.

Since Share and VShare are functionally identical for Microsoft Access,

only Share will be described further in this article.

Share gives applications an easy, well-defined way to prevent users from

accessing the same file (or region of a file) at the same instant. Once

Share is run, an application can use it to lock a file (or region of a

file) so that only one person at a time can make changes to it, preventing

file read and write conflicts. Most multiuser and network software packages

use Share for their file and record locking tasks.

Microsoft Access uses Share to control file sharing between two or more

instances of Microsoft Access running on the same system and using the same

database, or to allow a workstation to run as a non-dedicated file server

in a Windows for Workgroups environment. Share is also used by certain

object linking and embedding (ODE) applications. OLE applications use Share

to coordinate file usage, and OLE itself opens files using Share. Also, all

of the installable ISAM drivers rely on Share.

How Share Works

---------------

Share maintains two tables in memory: the FILES table and the LOCK table.

The FILES table contains the complete pathname of each file that has been

opened, plus an internal file handle number and other housekeeping

information. The LOCK table contains a list of internal file handle numbers

and corresponding information on the various areas of each file that are

locked. Share checks these tables whenever an application attempts to open

or use a file or a region of a file, and tells the application whether or

not the file or region is available.

Share uses at least one entry in each table for each file that is opened.

The more files your computer opens and locks, the more space Share needs

for its internal tables. You can control the size of Share's internal

tables with two command line options: /F and /L. The /F option controls the

amount of space allocated for the FILES table and the /L option controls

the number of simultaneous locks that Share will allow.

The /F Parameter

----------------

The /F parameter controls the size (in bytes) of the table that Share

reserves for filenames and handles. The syntax for the /F parameter is

   SHARE /F:<n>

where <n> is any number from 0 to approximately 62,000 (depending on the

other applications loaded). The default is /F:2048 (or, 2K). Share stores

the complete pathname of each file, plus 11 bytes of file handle and

housekeeping information. You can figure the largest possible space

requirement by multiplying the number of files in your CONFIG.SYS file by

71 (60 bytes for the longest possible pathname + 11 bytes for other

information). For example, if your system has FILES = 255 in your

CONFIG.SYS file, in the worst case (all 255 files are open) Share would

require over 18,100 bytes for the FILES table.

On a network server, you must allocate enough space for all the files that

will be opened by all the users on the network. The default value is 2048

bytes--enough space to hold the information for 66 files with paths

averaging 20 characters, or about 28 files in a worst-case scenario. If you

know that paths on your system average more than 20 characters or that you

will be opening many files, you should use the /F parameter to give Share

more space for the FILES table.

The /L Parameter

----------------

The /L parameter controls the number of simultaneous locks that Share can

handle. A low number of Share locks is a common problem for Microsoft

Access users on networks. The syntax for the /L parameter is

   SHARE /L:<n>

where <n> is an integer between 1 and approximately 3800 (depending

on the size of other applications loaded). The default is 20 locks.

Opening a file on a server requires at least one lock. In addition, most

network programs use several more locks per file. They lock individual

records, and even individual fields within records. Most multiuser

databases use many locks--sometimes 10 or more per file. On a network, with

several users opening each file, Share's 20-lock default can be used up

almost instantly. The number of Share locks used by Microsoft Access

varies, depending on the amount of data that is accessed. A rough estimate

of the number of locks needed is 5 times the number of records that will be

accessed at any given time. During the Microsoft Access installation

process, the SETUP.EXE program automatically sets the number of locks to

500.

Use the /L parameter to increase the number of locks allowed to prevent

Share lock errors. The /L setting should be at least the number of files

you have specified in your CONFIG.SYS file. If you are running a multiuser

program that opens many files, consider setting /L to at least twice the

number of open files allowed, or in the case of Microsoft Access, 5 times

the number.

Questions and Answers About Share and Microsoft Access

------------------------------------------------------

1. Q: Does Microsoft Access use Share if you open a database

      exclusively?

   A: Yes. Share takes over all File Open calls.

2. Q: Do any of the ODBC drivers (such as those in the Drivers Pack, or

      third-party drivers) require Share?

   A: Yes, all of the ODBC drivers require Share, whether in a multiuser

      or a stand-alone configuration.

3. Q: What is the highest number of locks Microsoft Access might need?

   A: This is impossible to determine exactly, since it depends on the

      amount of data that is accessed at any given time. However, a

      rough estimate is 5 times the number of records that will be

      accessed at any given time.

4. Q: What memory does Share use?

   A: Share uses conventional memory, while VShare uses memory from

      the Windows memory pool (extended, virtual, and so on). You do not

      need to run both Share and VShare, because VShare disables

      Share.

5. Q: Do Share and VShare compete with other applications for memory?

   A: Share is an MS-DOS application that is loaded into the

      conventional memory area, so it does compete with other programs

      that use conventional memory. Also, Share requires a small

      amount of memory to store file and lock information. VShare is a

      Windows-managed VxD, so it can be allocated in any of the available

      Windows memory areas and does not impact other applications.

6. Q: Do transactions use Share?

   A: Yes.

7. Q: Why do I sometimes get a "Share locks exceeded" message, while

      at other times I get an "Out of memory" error message?

   A: If you have a Share locking problem, you get an error message

      identifying Share as the problem. An "Out of memory" message

      can be caused by a number of other things.

Additional reference words: 2.00 MU Multiuser Sharing

KBCategory:

KBSubcategory: GnlMu


INF: How MS Access Variable-Length Fields Export to dBASE

Article ID: Q96971

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

Microsoft Access uses variable-length fields for tables. However, when you

export a table to dBASE, which uses fixed-length fields, field sizes in

dBASE are set based on what their FieldSize property setting is in

Microsoft Access. For example, if you have a table with a text field whose

FieldSize property is 50, that field will have a field length of 50 in

dBASE.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmXbase


INF: How to Activate an Application with Class Name

Article ID: Q104710

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The function AppActivate() activates an application using the title bar

text of the application. You must use the exact title bar text or the

function fails. For example, the title bar text of Microsoft Access is

"Microsoft Access" unless an object (a form or report, for example) is

maximized. If an object is maximized, the title bar text is "Microsoft

Access - <Object Name>." Since knowing the exact title bar text ahead of

time can be challenging, the following function demonstrates how to

activate an application using the application's Class Name and Microsoft

Windows API calls.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access.

MORE INFORMATION

================

When an application is started from the Program Manager it registers

the class name of the form. The window class provides information

about the name, attributes, and resources required by your form. The

Microsoft Access window has the class name "OMain."

You can determine the class name of an application by using SPY.EXE,

supplied with the Microsoft Windows Software Development Kit (SDK)

version 3.1.

To use the application's Class Name to activate the application,

create a new module with the following Declaration section and

function:

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character to improve readability. Remove the

underscore when re-creating this code in Access Basic.

NOTE: You may have some Microsoft Windows API functions defined in an

existing Microsoft Access library or module; therefore, your declarations

may be duplicates. If you receive a duplicate procedure name error message,

remove or comment out the declarations statement in your code.

'**************************************************************

' MODULE DECLARATION SECTION

'**************************************************************

Option Compare Database   'Use database order for string comparisons

Option Explicit

'Windows API Declarations

Declare Function ShowWindow% Lib "User" (ByVal hWnd%, ByVal nCmdShow%)

Declare Function FindWindow% Lib "user" (ByVal lpclassname As Any, _

                    ByVal lpCaption As Any)

Declare Function SetActiveWindow% Lib "User" (ByVal hWnd%)

Const SW_SHOW = 9

'******************************************************************

' FUNCTION: AppActivateClass()

'

' PURPOSE: Used to activate another application by using its

'    class name instead of the title bar text as AppActivate does.

'

' ARGUMENTS:

'    lpClassName$   - The Class Name of the application.

'

' RETURNS:

'     0   - The application was not found - it either was not running

'           or the class name is incorrect

'    -1   - The application was activated

'******************************************************************

Function AppActivateClass (lpclassname$)

   Dim hWnd%       'the application's window handle

   Dim dummy       'Dummy variable

   'Get the Window Handle

   hWnd% = FindWindow%(lpclassname$, 0&)

   'Activate the Application

   dummy = SetActiveWindow%(hWnd%)

   dummy = ShowWindow%(hWnd%, SW_SHOW)

   'Return True if Application Running, or False if not.

   AppActivateClass = hWnd%

End Function

To use this function, call the function and supply the class name

of the application to activate. The following example shows how to

activate Microsoft Word for Windows:

   x=AppActivateClass("opusapp")

Below are some class names of common applications that are shipped

with Windows:

   Class Name         Application

   ------------------------------

   OMain              ACCESS.EXE

   SciCalc            CALC.EXE

   CalWndMain         CALENDAR.EXE

   Cardfile           CARDFILE.EXE

   Clipboard          CLIPBOARD.EXE

   Clock              CLOCK.EXE

   CtlPanelClass      CONTROL.EXE

   XLMain             EXCEL.EXE

   Session            MS-DOS.EXE

   Notepad            NOTEPAD.EXE

   pbParent           PBRUSH.EXE

   Pif                PIFEDIT.EXE

   PrintManager       PRINTMAN.EXE

   Progman            PROGMAN.EXE   (Windows Program Manager)

   Recorder           RECORDER.EXE

   Reversi            REVERSI.EXE

   #32770             SETUP.EXE

   Solitaire          SOL.EXE

   Terminal           TERMINAL.EXE

   WFS_Frame          WINFILE.EXE

   MW_WINHELP         WINHELP.EXE

   #32770             WINVER.EXE

   OpusApp            WINWORD.EXE

   MSWRITE_MENU       WRITE.EXE

Additional reference words: 1.00 1.10 2.00 WinIss ab caption

KBCategory:

KBSubcategory: PgmApi


INF: How to Add a User to a Group with CreateUser Method

Article ID: Q112063

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

To add a user to an existing group with Access Basic code, you must use the

CreateUser method twice: once to create the new user for that Microsoft

Access session, and again to create the user for the group.

MORE INFORMATION

================

The following sample Access Basic function called CUser() demonstrates how

to create a user named MyName for the Users group:

1. Open or create a module and enter the following:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Function CUser (uname As String, upin As String, upwd As String,_

       gname As String)

         Dim u  As User, w As WorkSpace, g As Group

         Set w = dbengine.workspaces(0)          'The default workspace.

         Set u = w.CreateUser(uname, upin, upwd) 'Create a user for the

                                                 'Access session.

         w.users.Append u                        'Add user to workspace.

         w.users.Refresh

         Set g = w.groups(gname)

         Set u = g.CreateUser(uname)             'Create a user for a

                                                  group.

         g.users.Append u                        'Add new user to group.

         g.users.Refresh

      End Function

2. From the View menu, choose Immediate Window.

3. Type the following in the Immediate window, and then press ENTER:

      ? CUser ("MyName","1234","MyName","Users")

4. From the Security menu, choose Permissions, and then select the List

   Users option button.

Note that the new user appears in the Users/Group Name box.

REFERENCES

==========

For more information about the CreateUser method, search for "CreateUser"

then "CreateUser Method" using the Microsoft Access Help menu.

Additional reference words: 2.00 Programming AB

KBCategory:

KBSubcategory: PgmObj


INF: How to Add an Icon to Program Manager Using DDE

Article ID: Q109394

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample Access Basic function called

CreatePROGMANIcon() that you can use to create an icon in the Microsoft

Windows Program Manager using dynamic data exchange (DDE).

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

To set up the CreatePROGMANIcon() function, create a new module and enter

the code below.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Option Explicit

   '**************************************************

   ' FUNCTION: CreatePROGMANIcon

   '

   ' PURPOSE:

   '   To create an icon in the Windows Program Manager.

   '

   ' ARGUMENTS:

   '   CommandLine - The command line argument to execute

   '                 when the icon is double-clicked.

   '   IconText    - The text to appear under the icon.

   '   GroupName   - The name of the group to place the

   '                 icon in.

   ' RESULT:

   '   An icon is placed in the specified group. If the

   '   group does not exist, a new group is created.

   '

   ' *************************************************

   Function CreatePROGMANIcon (CommandLine$, IconText$, GroupName$)

      Dim ChanNum As Integer

      Dim Groups As String

      Dim Exe As String

      ' Begin a DDE conversation with Program Manager.

      ChanNum = DDEInitiate("PROGMAN", "PROGMAN")

      ' Request a tab delimited list of Program Manager groups.

      Groups = DDERequest(ChanNum, "Progman")

      ' See if the requested group exists in the list.

      ' If not, create the group.

      If Not InStr(1, GroupName, Groups) Then

         DDEExecute ChanNum, "[CreateGroup(" & GroupName & ")]"

      End If

      ' Add an icon to the group with the specified text underneath.

      Exe = "[AddItem(" & CommandLine & ", " & IconText & ",,)]"

      DDEExecute ChanNum, Exe

      DDETerminate ChanNum

   End Function

How to Use the CreatePROGMANIcon() Function

-------------------------------------------

Type the command below in an Immediate window and then press ENTER.

NOTE: In the following example, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this

example.

   ? CreatePROGMANIcon("C:\WINDOWS\NOTEPAD.EXE C:\AUTOEXEC.BAT", _

      "AUTOEXEC", "MAIN")

The sample command above uses the CreatePROGMANIcon() function to add an

icon to the Main group in Program Manager. The icon will open the Windows

Notepad text editor and load the C:\AUTOEXEC.BAT file into Notepad.

Note that when the icon is created, Program Manager uses the default icon

supplied with the application specified in the command line. The following

function is a modified version of the CreatePROGMANIcon() function with two

additional arguments. These arguments are IconFile, which specifies the

name of a file containing custom icons, and IconNum, which specifies which

icon in the IconFile to use. Note that if you specify "", or null, for both

of these arguments, the default icon will be used.

   Function CreatePROGMANIcon2 (CommandLine$, IconText$, GroupName$, _

      IconFile$, IconNum$)

      Dim ChanNum As Integer

      Dim Groups As String

      Dim Exe As String

      ' Begin a DDE conversation with Program Manager.

      ChanNum = DDEInitiate("PROGMAN", "PROGMAN")

      ' Request a tab delimited list of Program Manager groups.

      Groups = DDERequest(ChanNum, "Progman")

      ' See if the requested group exists in the list.

      ' If not, create the group.

      If Not InStr(1, GroupName, Groups) Then

         DDEExecute ChanNum, "[CreateGroup(" & GroupName & ")]"

      End If

      ' Add an icon to the group with the specified text underneath.

      Exe$ = "[AddItem(" & CommandLine & ", " & IconText & ", _

             " & IconFile & ", " & IconNum & ")]"

      DDEExecute ChanNum, Exe

      DDETerminate ChanNum

   End Function

The following sample command uses the fourth icon in the MORICONS.DLL file

that is supplied with Windows. This file contains multiple custom icons:

   CreatePROGMANIcon2("C:\TEST\TEST.EXE ","My App","My Group",_

      "C:\WINDOWS\MOREICONS.DLL","4")

The next sample command uses an icon in an .ICO file. Since there is only

one icon in each .ICO file, leave the IconNum argument empty:

   CreatePROGMANIcon2("C:\TEST\TEST.EXE ","My App","My Group",_

      "C:\ICONS\MY.ICO","")

REFERENCES

==========

Windows Software Development Kit "Guide to Programming," pages 19-22

For more information on DDE and Program Manager, query on the following

words here in the Microsoft Knowledge Base:

   dde and progman

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


INF: How to Base Subforms on SQL Pass-Through Queries

Article ID: Q112746

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use an SQL pass-through query for a form's

record source. It assumes that you know how to build and use SQL pass-

through queries.

The following considerations should be kept in mind when you are using SQL

pass-through queries for forms' record sources:

 - SQL pass-through query record sources are read-only.

 - The Query Builder does not save the connect string unless you save

   the query.

 - Subforms can use SQL pass-through queries as record sources only if

   you set the record source in the main form's OnLoad property. Subreports

   cannot use SQL pass-through queries as record sources.

MORE INFORMATION

================

SQL Pass-Through Queries Are Read-Only

--------------------------------------

Forms based on SQL pass-through queries are read-only because SQL pass-

through queries are read-only. The recordset returned by an SQL pass-

through query is a snapshot, or read-only recordset. This behavior is by

design. In order for the form to be updateable, base your form on an

attached table with a unique index.

The Query Builder Does Not Save the Connect String

--------------------------------------------------

The RecordSource property's Query Builder displays a window that looks

similar to a query's Design window. You use this window to build the SQL

string or query for the RecordSource property. The Query Builder will set

the RecordSource property to an SQL string if the SQL string is not saved

as a query. If you save the string as a query, the name of the query will

be used as the RecordSource property.

When you are using an SQL pass-through query created using the Query

Builder, the ODBC connect string defined in that query will not be returned

as part of the RecordSource property SQL string. This can produce the error

message "Couldn't find input table or query '[Table from ODBC Server]'"

because without the ODBC connect string, the form will look for a local

table, instead of a table on the server. If you save the SQL string as a

query, the RecordSource property will contain the name of the query instead

of the SQL string, and the form will be able to retrieve the remote data

correctly.

Subforms Cannot Directly Use SQL Pass-Through Queries as Record Sources

-----------------------------------------------------------------------

The best way to use server-based data in a subform is to attach the remote

table and then base the subform on the attachment.

If you base a subform directly on an SQL pass-through query, you will

receive the following error message when you open the form:

   The crosstab query underlying a subform or subreport must have fixed

   column headings.

If you have to use an SQL pass-through query as a subform's record source,

you can dynamically set the subform's RecordSource property with the main

form's OnLoad event. The following is an example of an OnLoad event

procedure in the main form MainForm that dynamically sets the RecordSource

property in the subform SPTSubForm:

   Sub MainForm_OnLoad

     Me!SPTSubForm.Form.RecordSource = "[<Name of SQL pass-through query>]"

   End Sub

The subform itself should be saved without a RecordSource property.

REFERENCES

==========

For more information about SQL pass-through queries, search for "pass-

through query" then "Creating a Pass-Through Query" using the Microsoft

Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsProp


INF: How to Calculate a Credit Card Expiration Date

Article ID: Q99941

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If you enter a credit card expiration date (month/year) in a date/time

field on a form, Microsoft Access assumes that the card expires on the

first day of the month. This article includes a function that

correctly calculates the expiration date as the last day of the month.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

Use the following function, ExpirationDay(), in the AfterUpdate

property of an expiration text box on your form. The function will

replace the date entered in the text box with the date computed for

the last day of the month/year.

Given a date/time field bound to a text box with the ControlName

property set to "Expiration", the AfterUpdate property should read:

   =ExpirationDay([expiration])

Create a module with the following function:

 Option Explicit

 Function ExpirationDay (dt)

   If Not IsNull(dt) Then

     dt = DateAdd("m", 1, DateAdd("d", (-1 * DatePart("d", dt)), dt))

   End If

 End Function

You can use the following derivative of the ExpirationDay() function

in calculated fields in a query:

   NOTE: In the following sample code, an underscore (_) is used as a

   line continuation character. Remove the underscore when re-creating

   this code in Access Basic.

   Function ExpirationDay (ByVal dt)

      If Not IsNull(dt) Then ExpirationDay = DateAdd("m", _

          1, DateAdd("d", (-1 * DatePart("d", dt)), dt))

   End Function

Additional reference words: 1.00 1.10 2.00 expiration date

KBCategory:

KBSubcategory: PgmOthr


INF: How to Calculate Averages That Exclude Zero Values

Article ID: Q109364

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

========

When you use the Avg() function in a report to average a set of values, the

function uses records containing zero values in the calculation. In some

cases you may not want to include records with zero values in this

calculation.

This article describes how to calculate an average for all the non-zero

values in a set by counting the number of non-zero values in the set of

values and then using that total with a running sum calculation.

MORE INFORMATION

================

In the following example, one text box displays the number of non-zero

values, and the other text box displays the average for the set:

1. Open the sample database NWIND.MDB.

2. Use the ReportWizard to create a new Groups/Totals report based on

   the Order Details table. This report will calculate the average

   discount for each Product ID.

3. Include the Product ID and Discount fields on the report. Group the

   report on the Product ID field, grouped as Normal.

4. Open the report in Design view.

5. Create an unbound text box in the report's detail section. Place this

   text box to the left of the Discount text box. The new text

   box will display the count of non-zero values. Set the box's

   ControlSource property to:

      =IIF([Discount]=0 or [Discount] is null,0,1)

   This expression returns 0 if the value of the Discount field is

   equal to zero or null, otherwise it returns 1. The Avg() function

   automatically excludes nulls as well.

6. Set the text box's RunningSum property to Over Group, and its

   Name property to "Count of Data" (without quotation marks).

   NOTE: In Microsoft Access version 1.x, the Name property is called

   the ControlName property.

7. Create another text box in the report's footer section. This text

   box will display the result of the average calculation.

8. Set the ControlSource property of this text box to:

      =Sum([Discount])/[Count of Data]

9. Preview the report.

The left column displays a running count of non-zero (and non-null)

Discounts and the group footer shows an average Discount based on the

running count.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.1, pages 44, 248-249,

414-415, and 461-462

For more information about the Avg() function, search for "Avg" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 nonzero

KBCategory:

KBSubcategory: RptTotal


INF: How to Call Functions Using a String Variable

Article ID: Q100164

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how Access Basic or user-defined functions can

be called when the function name is stored in a string variable. This

method provides a functionality similar to that of pointers to

functions in other programming languages.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

Calling a function in Access Basic when the function name is stored in

a variable allows significant programming flexibility. This method is

described in the following procedure:

1. Store the function name and parameters in a string variable.

2. Use the Eval() function in Access Basic to evaluate the string. The

   process of evaluating the variable calls the function.

3. Open a new module or a previously created module and enter the

   following code:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

   '------------------------------------------------------------------

   'GLOBAL DECLARATIONS SECTION

   '------------------------------------------------------------------

   Option Explicit

   '------------------------------------------------------------------

   ' The CallMyArray() function creates an array of strings, then

   ' loops, using the Eval() function, to call each element of the array.

   '------------------------------------------------------------------

      Function CallMyArray ()

         Dim MyArray$()

          For i = 0 To 2

             ReDim Preserve MyArray$(i)

             MyArray$(i) = "MyFunc" & i & "(" & i & ")"

          Next i

          For i = 0 To 2

              x = Eval(MyArray(i))

          Next i

      End Function

   '------------------------------------------------------------------

   '    The first function called by CallMyArray().

   '------------------------------------------------------------------

      Function MyFunc0 (nParam)

         MsgBox "This is function: " & nParam

      End Function

   '------------------------------------------------------------------

   '    The second function called by CallMyArray().

   '------------------------------------------------------------------

      Function MyFunc1 (nParam)

         MsgBox "This is function: " & nParam

      End Function

   '------------------------------------------------------------------

   '    The third function called by CallMyArray().

   '------------------------------------------------------------------

      Function MyFunc2 (nParam)

         MsgBox "This is function: " & nParam

      End Function

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, pages 7-14

Additional reference words: 1.00 1.10 2.00 string Eval

KBCategory:

KBSubcategory: PgmOthr


INF: How to Call the Windows Help Search Dialog Box

Article ID: Q109826

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to call the Windows Help Search dialog box

from within your Microsoft Access application using the WinHelp() and

FindWindow() Windows API function calls.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools

provided with Microsoft Access.

MORE INFORMATION

================

The following example demonstrates how to activate the Search dialog box

with a sample Access Basic function called OpenHelpSearch(). This example

uses the Microsoft Access Help file:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code

in Access Basic.

1. Enter the following in a new module's Declarations section:

      Option Explicit

      Global Const HELP_PARTIALKEY = &H105

      Declare Function WinHelp Lib "User" (ByVal hWnd As _

         Integer, ByVal lpHelpFile As String, ByVal _

         wCommand As Integer, ByVal dwData As Any) As Integer

      Declare Function HC_FindWindow% Lib "user" Alias "FindWindow" _

         (ByVal lpClassName As Any, ByVal lpCaption As Any)

2. Create two procedures by entering the following code in the module:

      Function OpenHelpSearch ()

         Dim DummyVal$, Temp%

         DummyVal$ = ""

         Temp% = WinHelp(GetAccessHandle(),_

            "c:\Access\msaccess.hlp",_

            HELP_PARTIALKEY, DummyVal$)

      End Function

      Function GetAccessHandle ()

         GetAccessHandle = HC_FindWindow("Omain", 0&)

      End Function

3. Save the module as Search Help.

4. From the Run menu, choose Compile All.

5. Type the following in the module's Immediate window, and then press

   ENTER:

      ? OpenHelpSearch()

When you call the OpenHelpSearch() function, the Windows API WinHelp()

function is called. The OpenHelpSearch() function passes the current

Microsoft Access handle, the name of the Help file, the command

HELP_PARTIALKEY and a null string to the WinHelp() function. You are then

prompted for a topic to search for. Note that you can call the

OpenHelpSearch() function from any command button.

REFERENCES

==========

"Programming Windows: The Microsoft Guide to Writing Applications

for Windows 3," Charles Petzold, Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to

Programming Reference," Volumes 1-6, Microsoft Press, 1992

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: How to Change the "Microsoft Access" Window Caption

Article ID: Q95932

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

There is no Microsoft Access property to set the main caption of the

Microsoft Access window. To change the default "Microsoft Access"

caption to your own text, you must call the Windows application

programming interface (API) SetWindowText() function.

MORE INFORMATION

================

To change the default "Microsoft Access" caption to your own text

string, create a new module in Microsoft Access and add the following

function below with the appropriate declaration section.

Notes:

 - You may have some Microsoft Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code.

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

   '-----------------------------------------

   ' GLOBAL DECLARATION

   '-----------------------------------------

   Option Compare Database

   Option Explicit

   Declare Function FindWindow% Lib "User" (ByVal lpClassName As Any,_

                       ByVal lpWindowName As Any)

   Declare Sub SetWindowText Lib "User" (ByVal hWnd%, ByVal lpString$)

   '-----------------------------------------

   ' Function: SetCaption ()

   ' This function will set the caption of

   ' Microsoft Access's main window.

   '-----------------------------------------

   Function SetCaption ()

      Dim hWnd%

      hWnd% = FindWindow%("OMain", 0&)

      Call SetWindowText(hWnd%, "This is cool!")

   End Function

To change the caption when Microsoft Access is started, you can

execute the RunCode macro action with SetCaption() as an argument and

save the macro as Autoexec. When you open this database, this macro

will execute and change the "Microsoft Access" caption to "This is

cool!"

REFERENCES

==========

"Microsoft Windows Software Development Kit Programmer's Reference

Volume 2: Functions," version 3.1

Additional reference words: 1.00 1.10 2.00 windows API

KBCategory:

KBSubcategory: PgmApi


INF: How to Change the Caption on the Microsoft Access Window

Article ID: Q92684

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use a function called from a macro to change

the Microsoft Access window default title bar. If you name the macro

Autoexec, the title bar will be changed automatically every time the

database containing the macro is opened.

MORE INFORMATION

================

The following steps demonstrate how to change the title bar caption:

1. Open a new database and name it TEST.MDB.

2. Open a new blank form. Place at least one control on the form.

   Save the form as MainForm and then close it.

3. Create the following new macro, save it as Macro1, and then close it:

      Action    Argument

      -----------------------------------------------------------

      RunCode   ChangeAccessCaption("<Your Custom Caption Here>")

4. Open a new module, and enter the following declarations:

      Option Explicit

      Declare Function GetParent% Lib "USER" (ByVal hwnd%)

      Declare Sub SetWindowText Lib "USER" (ByVal h%, ByVal lpstr$)

5. Enter the following code for the ChangeAccessCaption() function in

   the module:

      Function ChangeAccessCaption (Caption$)

         Dim X%

         Dim hParent%

         ' Example of how to set the caption bar

         DoCmd OpenForm "MainForm"            'Open the main startup form

         X% = Forms!MainForm.hwnd             'Get its handle

         hParent% = GetParent(GetParent(X%))  'Get the form' parent

         Call SetWindowText(hParent%, Caption$)

      End Function

6. Save the module as Module1 and then close it.

7. Run Macro1. The title for the Microsoft Access window should change

   to the text you specified as the function parameter in step 3.

Additional reference words: 1.00 1.10 2.00 header caption

KBCategory:

KBSubcategory: PgmApi


INF: How to Change the Font for the Zoom Box

Article ID: Q96996

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to modify the system UTILITY.MDA database

to change the default font used in the Zoom box of Microsoft Access.

MORE INFORMATION

================

To change the font for the Zoom box, do the following:

1. Before you open Microsoft Access, copy the UTILITY.MDA file to

   MYUTIL.MDA. The UTILITY.MDA file is generally stored in your Microsoft

   Access directory.

2. Start Microsoft Access. From the File menu, choose Open Database,

   select MYUTIL.MDA, and choose the OK button.

   NOTE: When you open this database, you are prompted to choose the OK

   button in response to several error messages. These errors are caused by

   duplicate modules loaded from the UTILITY.MDA database. The messages

   will be similar to the following:

      Tried to load module with duplicate procedure definition: BuilderZoom

3. In Design view, open the ZoomForm form. Select the unbound text box

   control Zoom, and change the following properties to the ones noted

   below or to a font of your choice.

      FontName:    Microsoft Sans Serif

      FontSize:    12

      FontWeight:  Semi-bold

   NOTE: Select a font and a size that suit your needs.

4. Close the database and save your changes to the ZoomForm form. Exit

   Microsoft Access.

5. Use any ASCII text editor, such as NOTEPAD.EXE, to modify the

   MSACCESS.INI file in your Windows directory. You should modify the

   MSACC20.INI file if you are using Microsoft Access version 2.0.

   Change the following line in your [Options] section from

      [Options]

      UtilityDB=C:\ACCESS\UTILITY.MDA

      -to-

      [Options]

      ;UtilityDB=C:\ACCESS\UTILITY.MDA

   Add a new line so the section reads:

      [Options]

      ;UtilityDB=C:\ACCESS\UTILITY.MDA

      UtilityDB=C:\ACCESS\MYUTIL.MDA

6. Save the MSACCESS.INI file or MSACC20.INI file.

When you next start Microsoft Access and use the Zoom box for editing,

the font, size, and weight reflect the changes you made.

Additional reference words: 1.00 1.10 2.00 zoombox font expressions editing

KBCategory:

KBSubcategory: GnlDe


INF: How to Change the Order of Columns in a Graph

Article ID: Q109315

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

By default, a graph sorts the X-axis fields in alphabetical or numeric

order. This article describes two ways to sort the X-axis fields in a

different order.

MORE INFORMATION

================

There are two ways to change the ordering of fields in a graph. The first

way is to add an Order By clause to the SQL statement in the graph's

RowSource property. The second way is to create a query that orders the

fields the way you want them, and then use the query for the graph's

RowSource property.

How to Create a Sample Graph

----------------------------

For Microsoft Access version 2.0:

1. Open the sample database NWIND.MDB.

2. Create a new, blank form, and then add a graph object to the form.

3. In the GraphWizard dialog box, select the Sales By Category query as

   the data source for the graph.

4. Select the Category Name field in the Available Fields box and then

   choose the ">" button. Then select the Product Sales field and choose

   the ">" button. Click Next three times, and then click Finish.

5. View the form in Form view. Note that the Category Name records are

   listed in alphabetical order.

For Microsoft Access version 1.x:

1. Open the sample database NWIND.MDB.

2. Create a new, blank form, and then add a graph object to the form.

3. In the GraphWizard dialog box, select the Sales By Category query as

   the data source for the graph. Then, click the Bar Chart button, and

   then choose Next.

4. Select the Category Name field in the Available Fields box and then

   choose the ">" button. Then select the Product Sales field and choose

   the ">" button. Choose Next.

5. Choose Design.

6. View the form in Form view. Note that the Category Name records are

   listed in alphabetical order.

How to Change the Graph's Sorting Order

---------------------------------------

Method 1:

The following example demonstrates how to add an Order By clause to the SQL

statement in a graph's RowSource property:

1. View the form in Design view.

2. Select the Graph.

3. From the View menu, choose Properties.

4. Select the RowSource property, and then press SHIFT+F2 to zoom the

   window. The RowSource property looks like:

      SELECT DISTINCTROW [Category Name] AS [Sales by Category],

      SUM([Sales by Category].[Product Sales]) AS [Product Sales]

      FROM [Sales by Category]

      GROUP BY [Category Name];

5. Type "Order By SUM([Sales by Category].[Product Sales]) desc"

   (without the quotation marks) before the semicolon at the end of

   the SQL statement. The SQL statement should look like:

      SELECT DISTINCTROW [Category Name] AS [Sales by Category],

      SUM([Sales by Category].[Product Sales]) AS [Product Sales]

      FROM [Sales by Category]

      GROUP BY [Category Name]

      Order By SUM([Sales by Category].[Product Sales]) desc;

6. Choose OK.

7. View the form in Form view. Note that the Category Name records are

   now listed in descending order of sales.

Method 2:

The following example describes how to create and use a query for the

graph's RowSource property:

For Microsoft Access version 2.0:

1. Create a form with a graph using the above steps.

2. View the form in Design view.

3. With your right mouse button, click the graph object, and then choose

   Properties.

4. With your right mouse button, click the Row Source property and then

   choose Build.

5. For the Product Sales field, change the sort order to Descending.

6. Close the Query window and save the changes.

7. Switch to Form view.

For Microsoft Access version 1.x:

1. Create a form with a graph using the above steps.

2. Make a copy of the Sales By Category query. Call the copy Sales By

   Category 2.

3. Open the Sales By Category 2 query in Design view. Create the following

   fields in the query:

      Field: Sales by Category:Category Name

         Total: Group By

         Sort: <leave blank>

      Field: Product Sales

         Total: Sum

         Sort: Desc

   Note that the first field is named "Sales by Category:Category Name"

   because the name of the first field becomes the graph's title.

4. Remove the Product Name field.

5. Save the query.

6. View the form in Design view. Replace the SQL text in the graph's

   RowSource property with the Sales By Category 2 query.

7. View the form in Form view.

The columns will be in descending order.

REFERENCES

==========

For more information on ordering fields, search for "order by" then "ORDER

BY Clause (SQL)" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 queries msgraph

KBCategory:

KBSubcategory: IntpGrph


INF: How to Change the Status Bar Text Using SysCmd()

Article ID: Q105511

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use the SysCmd() function to display

custom messages in the Microsoft Access status bar.

NOTE: This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

The SysCmd() function is documented in the manual "The Secrets of

AccessWizards," which is included with the Microsoft Access Distribution

Kit (ADK) version 1.1. You can use this function to change the text that

appears in the status bar. For example, you might want to change the status

bar to read "Sorting..." while a sort operation is taking place, and then

remove it when the operation is complete.

The SysCmd() function syntax is as follows:

   SysCmd(<action> [, <text>])

Replace <action> with a numeric expression identifying the action to take.

Valid entries are as follows:

   4 - Set the status bar text to the text argument

   5 - Reset the status bar text

Replace <text> with a string expression that will appear left aligned in

the status bar.

The SysCmd() function returns null, which is not used.

Setting Status Bar Text

-----------------------

When the action argument is 4, the string expression in the text argument

will appear in the status bar. For example, type the following expression

in the Immediate window and the message "Sorting..." will appear in the

status bar:

   ? SysCmd(4, "Sorting...")

Removing or Resetting the Status Bar Text

-----------------------------------------

When the action argument is 5, the status bar text set by the previous

SysCmd() function is removed. For example, type the following in the

Immediate window and the "Sorting..." message will be removed:

   ? SysCmd(5)

The text argument can contain about 80 characters. Since the text in the

status bar uses a proportional font, the actual number of characters you

can display is determined by the total width of all the characters in the

text argument.

You cannot set the status bar text to an empty string. If you want to

remove the existing text in the status bar, set the text argument to a

single space.

How to Use SysCmd() in an Access Basic Function

-----------------------------------------------

The following sample function will place a message in the status bar,

display a message box, and then remove the status bar text:

1. Create a new module called Status Bar Test.

2. Enter the following statement in the Declarations section:

      Option Explicit

3. Enter the following function:

      Function StatusBar ()

         Dim RetVal As Variant

         RetVal = SysCmd(4, "The rain in Spain falls mainly ...")

         MsgBox "Press OK when you are ready to finish!"

         RetVal = SysCmd(5)

      End Function

4. To run the function, type the following in the Immediate window, and

   then press ENTER:

      ? StatusBar()

REFERENCES

==========

Microsoft Access Distribution Kit "The Secrets of AccessWizards," version

1.1, page 30

For information on how to use the status bar progress meter, query on

the following words here in the Microsoft Knowledge Base:

   progress and meter and updating

Additional reference words: 1.00 1.10 2.00 StatusBar progressmeter

KBCategory:

KBSubcategory: PgmOthr


INF: How to Check a Menu Item Using Access Basic

Article ID: Q90811

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not have any built-in macro or Access Basic commands

that you can use to place a check mark beside or remove a check mark from a

menu command. To do this in Microsoft Access, you must use Access Basic

code to call Microsoft Windows application programming interface (API)

functions.

MORE INFORMATION

================

The following Windows API function is used to check and uncheck a menu

item:

CheckMenuItem% (hMenu%, wIDCheckItem%, wCheck%)

----------------------------------------------------------------------

This function places check marks next to or removes check marks from

menu items in the pop-up menu specified by the hMenu% parameter.

   hMenu%         Identifies the menu.

   wIDCheckItem%  Specifies the menu item to be checked.

   wCheck%        Specifies how to check the menu item. The

                  wCheck% parameter can be a combination of the

                  MF_CHECKED or MF_UNCHECKED with MF_BYPOSITION or

                  MF_BYCOMMAND flags. These flags can be combined

                  by using the bitwise OR operator. The values are

                  described as follows:

                  Value          Meaning

                  ----------------------------------------------------

                  MF_BYCOMMAND   Specifies that the idCheckItem

                                 parameter gives the menu-item

                                 identifier (MF_BYCOMMAND is the

                                 default).

                  MF_BYPOSITION  Specifies that the idCheckItem

                                 parameter gives the position of the

                                 menu item (the first item is at

                                 position zero).

                  MF_CHECKED     Selects the item (adds check mark).

                  MF_UNCHECKED   Clears the item (removes check mark).

   Return Value   The return value specifies the previous state of

                  the item. It is either MF_CHECKED or

                  MF_UNCHECKED. The return value is -1 if the menu

                  item does not exist.

NOTE: Top-level menu items (items on the Microsoft Access menu bar) cannot

have a check mark.

When determining the position of a menu command, separator bars count as

commands. For example, to get to the Import menu command on the File menu

in the Database window, use the arguments 0 (for the File menu) and 7 (for

the Import command). Positions 3 and 6 correspond to the separator bars on

the File menu.

Example

-------

The example below creates a menu, associated with a form, that can be

used to check and uncheck a menu command.

1. Create a new macro. After adding the following actions and their

   associated properties, save the macro and name it "Menu Checking

   Macro." To display the "Macro Name" column, choose Macro Name from

   the View menu.

      Macro Name             Action        Function Name

      -----------------------------------------------------------

      &Check                 RunCode       Check_Menu_Item(0,0)

      &UnCheck               RunCode       UnCheck_Menu_Item(0,0)

   NOTE: The first parameter in the function indicates which menu on

   the menu bar to use. All menus are zero based. For example, if your

   menu bar contains the File, Edit, Window, and Help menus, and you

   specify 2 as the first parameter for one of these functions, the

   function will work on the Window menu. A 2 indicates the Window

   menu instead of the Edit menu because the parameter uses base 0

   instead of base 1; therefore, 0 indicates the File menu, 1

   indicates the Edit menu, and so on.

   The second parameter in the function indicates which menu command

   (on the menu indicated in the first parameter) to place the check

   mark beside. This parameter also uses base 0. To refer to the first

   command on the menu, use 0; to refer to the second, use 1; and so

   on.

2. Create a new macro. After adding the action below and its

   associated property, save the macro as "Custom Menu."

      Action

      ------------------------------------------

      AddMenu

         Menu Name:          &Check

         Menu Macro Name:    Menu Checking Macro

3. Create a new blank form and display the Properties window of the

   form by choosing Properties from the View menu.

4. In Microsoft Access 1.X, set the OnMenu property to "Custom Menu." In

   Microsoft Access 2.0, set the MenuBar property to "Custom Menu."

5. Close the form by choosing Close from the File menu. Save the form

   as "Menu Checking Form."

6. Create a new module from the Database window. In the new module,

   enter the sample Access Basic code listed at the end of this document.

   Save the module as "Menu Checking Code."

7. From the Database window, select the "Menu Checking Form" form and

   then choose the Open button to display the form in Form view. The

   normal Microsoft Access menu will disappear and be replaced by the

   custom menu that was designed above.

8. There are two options on the Check menu. If you choose the Check

   command, the command will be checked. If you choose the UnCheck

   command, the Check command will be unchecked.

Sample Access Basic Code

------------------------

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

   '*****************************************************************

   'Declarations section of the module.

   '*****************************************************************

   Option Explicit

   Declare Function GetMenu% Lib "user" (ByVal hWnd%)

   Declare Function GetSubMenu% Lib "user" (ByVal hSubMenu%, ByVal nPos%)

   Declare Function CheckMenuItem% Lib "user" (ByVal hSubMenu%,_

                     ByVal nPos%, ByVal Flag%)

   Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,_

                     ByVal lpCaption As Any)

   Declare Function IsZoomed% Lib "user" (ByVal hWnd%)

   Const MF_BYPOSITION = &H400

   Const MF_BYCOMMAND = &H0

   Const MF_CHECK = &H8

   Const MF_UNCHECKED = &H0

   Const MyNull = 0&

   Const ClassName = "OMain"

   Dim ChWnd%       ' Handle to the Microsoft Access window.

   Dim hMenuTop%    ' Handle to the Microsoft Access menu.

   Dim hSubMenu%    ' Handle to the pop-up menu associated with hMenuTop%.

   Dim ItemID%      ' Command ID associated with a specified menu item.

   Dim ReturnVal%   ' Function return value may be used depending on

                    ' the function.

   '==================================================================

   ' This function displays a check mark next to the menu item.

   '==================================================================

   Function Check_Menu_Item% (TopLevel%, SubLevel%)

      'If the form is maximized, the system menu is added to the forms

      'menu bar, so increment the actual TopLevel%

      If (IsZoomed(Screen.ActiveForm.hWnd)) Then

         TopLevel% = TopLevel% + 1

      End If

      Call Get_Menu_Handles(TopLevel%)

      ' The following statement must appear on one line.

      Check_Menu_Item% = CheckMenuItem(hSubMenu%, SubLevel%,_

                         MF_BYPOSITION Or MF_CHECK)

   End Function

   '==================================================================

   ' This function initializes:

   '   - The window handles associated with the Microsoft Access form.

   '   - The handle to the menu of the specified window.

   '   - The menu handle of the specified pop-up menu of the Window menu.

   ' The variables here are global to the database.

   '==================================================================

   Sub Get_Menu_Handles (TopLevel%)

      ChWnd% = FindWindow(ClassName, MyNull)

      hMenuTop% = GetMenu(ChWnd%)

      hSubMenu% = GetSubMenu(hMenuTop%, TopLevel%)

   End Sub

   '==================================================================

   ' This function will uncheck a menu item.

   '==================================================================

   Function UnCheck_Menu_Item% (TopLevel%, SubLevel%)

      Call Get_Menu_Handles(TopLevel%)

      ' The following statement must appear on one line.

      UnCheck_Menu_Item% = CheckMenuItem(hSubMenu%, SubLevel,_

                                 MF_BYPOSITION Or MF_UNCHECKED)

   End Function

REFERENCES

==========

For more information on custom menus, search for "customizing menus" using

the Microsoft Access Help menu.

For more information on similar programming features, query on the

following words here in the Microsoft Knowledge Base:

   GetSubMenu

Additional reference words: 1.00 1.10 2.00 menus checkmark

KBCategory:

KBSubcategory: PgmApi


INF: How to Check for Duplicate Values in Primary Key Fields

Article ID: Q102527

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are adding records, Microsoft Access does not normally check the

values in primary key fields for duplicates until you move to the next

record. If you enter an invalid or duplicate value in a control and move

to the next record, you may invalidate all previous entries. However,

there is a method to force an immediate check for duplicate values. This

article describes how to check for duplicate values immediately.

MORE INFORMATION

================

The following example uses the Customers form in the sample database

NWIND.MDB. The Customers form is based on the Customers table; Customer

ID is the primary key in the table:

1. Create the following new macro. Make sure to choose Conditions

   from the View menu before you begin entering this macro:

   NOTE: In the following sample macro, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this macro.

      MacroName   Condition                                Action

      ----------------------------------------------------------------

      IsItDup     DCount("[customer id]","customers",_     MsgBox

                  "[customer id]=Form.[customer id]")<>0

                  ...                                      CancelEvent

      IsItDup Actions

      ------------------------

      MsgBox

         Message: Duplicate ID

      CancelEvent

2. Open the Customers form in Design view. Change the BeforeUpdate

   property of the Customer ID field as follows:

      Text Box: Customer ID

         BeforeUpdate: IsItDup

After you make this change, adding a duplicate value in the Customer ID

field will result in an error message. The insertion point will remain in

the field so that you can change the value.

Additional reference words: 1.00 1.10 2.00 count before update fasttips

KBCategory:

KBSubcategory: FmsOthr


INF: How to Communicate with NetDDE

Article ID: Q99939

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use NetDDE to communicate with Microsoft

Access on a remote computer. This article assumes that you are familiar

with DDE communications on a local computer, and with the capabilities of

Microsoft Access as a DDE server.

This article also assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

In order to establish a link to a remote application, a DDE share must be

created on the remote computer. A DDE share is a name that represents an

application name, a topic, and any permissions for that topic. A DDE

conversation can only occur with applications and topics assigned to share

names on the remote computer. Note that a utility called Network DDE Share

Manager (provided with the Windows for Workgroups Resource Kit) can be used

to create and edit DDE share names.

How to Create the DDE Share

---------------------------

The following steps demonstrate how to create a DDE share for the Employees

table in the sample database NWIND.MDB:

1. Start the Network DDE Share Manager. From the Share menu, choose New.

2. Type "Northwind Employees" (without the quotation marks) in the Share

   Name box.

3. Type "MSACCESS.EXE" (without the quotation marks) in the Application

   Name box and "NWIND.MDB;TABLE Employees" (without the quotation marks)

   in the Topic Name box. The password information is optional and can be

   left empty.

4. From the File menu, choose Save.

How to Communicate with the Remote Microsoft Access DDE Share

-------------------------------------------------------------

NOTE: Before running the following function, make sure that Microsoft

Access is running on the remote computer and that the NWIND.MDB database is

open.

Create the following module function in Microsoft Access on your local

computer:

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

   Option Explicit

   Function GetRemoteEmployeeInfo()

      Dim iChan As Integer

      Dim EmpRecord As String, FieldNames As String

      iChan = DDEInitiate("\\RemoteMachineName\NDDE$", _

      "Northwind Employees")

      FieldNames = DDERequest(iChan, "FieldNames")

      MsgBox FieldNames, 0, "Employee Table Field Names"

      On Error Resume Next

      EmpRecord = DDERequest(iChan, "FirstRow")

      Do Until EmpRecord = ""

         MsgBox EmpRecord, 0, "Employee Record"

         EmpRecord = ""

         EmpRecord = DDERequest(iChan, "NextRow")

      Loop

   End Function

Change the first argument of the DDEInitiate command (RemoteMachineName) to

reference the name of your remote computer.

When you run this function from the Immediate window, a message box will

display a list of field names in the Employees table. Next, a series of

message boxes will appear displaying each record from the table. The field

data will be delimited by a tab character.

The DDEInitiate Statement

-------------------------

Note the arguments used in the DDEInitiate command to establish the link

with the remote share. The application name is the net DDE server

application NDDE$ located on the remote computer "\\RemoteMachineName".

NDDE$ is a system service application that is run automatically by Windows

for Workgroups in the background. This application is always running and

present when Windows for Workgroups is running and cannot be terminated.

When NDDE$ receives the topic "Northwind Employees" it checks the list of

available DDE shares on the local computer. If it finds the share, it will

validate any permissions on the share and prompt for a password if one is

required. After the validation is complete, NDDE$ establishes a local DDE

link with the application name and topic assigned to the share name.

Once the link has been established, communication with the client

application proceeds as if it were another application on the local

computer. NDDE$ becomes the liaison between the two applications across the

network.

REFERENCES

==========

For more information on Microsoft Access as a DDE server, query on the

following words here in the Microsoft Knowledge Base:

   dde and server

Microsoft Windows for Workgroups "Resource Kit," Chapter 11

Additional reference words: 1.00 1.10 2.00 dynamic data exchange

KBCategory:

KBSubcategory: IntpDde


INF: How To Compute Moving Averages in Access Basic

Article ID: Q106245

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The following sample Access Basic function computes a moving average for a

set of values in a table based on a given period of time. For example, if

you have data that has been collected weekly for the past year, and you

want to compute a historical average for a three-week time period on each

value, you can use this function to return an average for each value in the

table based on the current value and the values from the two previous

weeks.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

The sample function below computes moving averages based on a table with a

multiple-field primary key. The weekly values of foreign currencies are

used for this example.

1. Create the following table. Save the table as Table 1.

      Table: Table 1

      ----------------------------------------

      FieldName: CurrencyType [Primary Key]

      DataType: Text

      Field Size: 25

      FieldName: TransactionDate [Primary Key]

      DataType: Date/Time

      Format: Short Date

      FieldName: Rate

      DataType: Currency

      Decimal Places: 4

2. View the table in Datasheet view, and enter the following values:

      CurrencyType     TransactionDate     Rate

      --------------------------------------------

      Yen              8/6/93              $0.0079

      Yen              8/13/93             $0.0082

      Yen              8/20/93             $0.0085

      Yen              8/27/93             $0.0088

      Yen              9/3/93              $0.0091

      Mark             8/6/93              $0.5600

      Mark             8/13/93             $0.5700

      Mark             8/20/93             $0.5800

      Mark             8/27/93             $0.5900

      Mark             9/3/93              $0.6000

3. Open a new module and enter the following functions:

      '*************************************************************

      'Declarations section of the module.

      '*************************************************************

      Option Explicit

      '===============================================================

      ' The following function MAvgs computes moving averages based on

      ' a table with a multiple field primary key.

      '===============================================================

      Function MAvgs (Periods As Integer, StartDate, TypeName)

         Dim MyDB As Database, MyTable As Table, MySum as double

         Dim i, x

         Set MyDB = CurrentDB()

         Set MyTable = MyDB.OpenTable("Table 1")

         On Error Resume Next

         MyTable.index = "PrimaryKey"

         x = Periods - 1

         ReDim Store(x)

         MySum = 0

         For i = 0 To x

           MyTable.MoveFirst

           MyTable.Seek "=", TypeName, StartDate

                'these two variables should be in the same order as the

                '  primary key fields in your table

            Store(i) =MyTable![rate]

            If i <> x Then StartDate = StartDate - 7

                '7 here assumes weekly data, you would use 1 for daily

                '  data

            If StartDate < #8/6/93# Then MAvgs = Null: Exit Function

                '#8/6/93# is replaced with the earliest date of the data

                '  in your table

            MySum = Store(i) + MySum

            Next i

         MAvgs = MySum / Periods

         MyTable.Close

      End Function

4. Create the following query based on Table 1:

      Query: Query1

      -----------------------------------------

      Field: CurrencyType

      Field: TransactionDate

      Field: Rate

      Field: Expr1: MAvgs(3,[TransactionDate],[CurrencyType])

   NOTE: This query will generate a 3-week moving average of the Rate data.

   To compute a longer or shorter moving average, change the "3" in the

   query's Expr1 column to the value you want to compute.

5. Run the query.

You will see a 3-week moving average for each currency. A null indicates

that there were not enough prior values to compute that week's average.

NOTE: If you want to compute a moving average for a table with a single

primary key, use the primary key both as an argument to be passed to the

function and as the key value for the Seek method.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Convert Currency or Numbers into English Words

Article ID: Q95640

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

By using four functions you can convert a currency or other numeric value

into its equivalent in English words. For example, you can change 24.50

into the following text: Twenty Four DOLLARS and Fifty CENTS.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

Note that none of the words in the result are hyphenated. That is, the

result shows Twenty Four, not Twenty-Four. Revise the code if hyphenation

is important to you.

MORE INFORMATION

================

The following code creates four functions: NumToWord(), GetWord(),

GetTens(), and GetDigit():

' Note: Enter each command on a single line. The underscore (_) on

' the end of some lines is a line continuation character. It's there

' to improve readability. When you enter the line, omit the underscore

' and combine all continued lines into a single line.

'****************************************************************

'Declarations section of the module

'****************************************************************

   Option Explicit

'================================================================

'*** This is the main function call

'================================================================

   Function NumToWord(NumVal)

      Dim NTW, NText, Dollars, Cents, NWord, TotalCents As String

      DIM DecPlace, TotalSets, Cnt, LDollHold As Integer

      ReDim NumParts(9) As String   'Array for Amount (sets of three)

      ReDim Place(9) As String      'Array containing place holders

      Dim LDoll As Integer          'Length of the Dollars Text Amount

      Place(2) = " Thousand "       '

      Place(3) = " Million "        'Place holder names for money

      Place(4) = " Billion "        'amounts

      Place(5) = " Trillion "       '

      NTW = ""                      'Temp value for the function

      NText = Trim(Str(NumVal))     'String representation of amount

      DecPlace = InStr(Trim(NText), ".")'Position of decimal 0 if none

      Dollars = Trim(Left(NText, IIf(DecPlace = 0, Len(NumVal),_

                                     DecPlace - 1)))

      LDoll = Len(Dollars)

      Cents = Trim(Right(NText, IIf(DecPlace = 0, 0, Abs(DecPlace - _

                                    Len(NText)))))

      If Len(Cents) = 1 Then

         Cents = Cents & "0"

      End If

      If (LDoll Mod 3) = 0 Then

         TotalSets = (LDoll \ 3)

      Else

         TotalSets = (LDoll \ 3) + 1

      End If

      cnt = 1

      LDollHold = LDoll

      Do While LDoll > 0

         NumParts(cnt) = IIf(LDoll > 3, Right(Dollars, 3),_

                                              Trim(Dollars))

         Dollars = IIf(LDoll > 3, Left(Dollars, (IIf(LDoll < 3, 3,_

                                       LDoll)) - 3), "")

         LDoll = Len(Dollars)

         cnt = cnt + 1

      Loop

      For cnt = TotalSets To 1 Step -1     'step through NumParts array

         NWord = GetWord(NumParts(cnt))    'convert 1 element of NumParts

         NTW = NTW & NWord                 'concatenate it to temp variable

         If NWord <> "" Then NTW = NTW & Place(cnt)

      Next cnt                             'loop through

      If LDollHold > 0 Then

         NTW = NTW & " DOLLARS and "       'concatenate text

      Else

         NTW = NTW & " NO DOLLARS and "    'concatenate text

      End If

      TotalCents = gettens(Cents)          'Convert cents part to word

      If TotalCents = "" Then TotalCents = "NO"  'Concat NO if cents=0

      NTW = NTW & TotalCents & " CENTS"    'Concat Dollars and Cents

      NumToWord = NTW                      'Assign word value to function

   End Function    'End NumToWord function, Return to calling program

'=================================================================

' The following function converts a number from 0 to 999 to text

'=================================================================

   Function GetWord (NumText)

      Dim GW As String, x As Integer

      GW = ""                       'null out temporary function value

      If Val(NumText) > 0 Then

         For x = 1 To Len(NumText)  'loop the length of NumText times

            Select Case Len(NumText)

               Case 3:

                  If Val(NumText) > 99 Then

                     GW = GetDigit(Left(NumText, 1)) & " Hundred "

                  End If

                  NumText = Right(NumText, 2)

               Case 2:

                  GW = GW & GetTens(NumText)

                  NumText = ""

               Case 1:

                  GW = GetDigit(NumText)

               Case Else

            End Select

         Next x

      End If

      GetWord = GW  'assign function return value

   End Function     'End function GetWord - Return to calling program

 '================================================================

 ' The following function converts a number from 10 to 99 to text

 '================================================================

   Function GetTens (TensText)

      Dim GT As String

      GT = ""           'null out the temporary function value

      If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19

         Select Case Val(TensText)

            Case 10: GT = "Ten"            '

            Case 11: GT = "Eleven"         '

            Case 12: GT = "Twelve"         '

            Case 13: GT = "Thirteen"       ' Retrieve numeric word

            Case 14: GT = "Fourteen"       ' value if between ten and

            Case 15: GT = "Fifteen"        ' nineteen inclusive.

            Case 16: GT = "Sixteen"        '

            Case 17: GT = "Seventeen"      '

            Case 18: GT = "Eighteen"       '

            Case 19: GT = "Nineteen"       '

            Case Else

         End Select

      Else                                 ' If value between 20-99

         Select Case Val(Left(TensText, 1))

            Case 2: GT = "Twenty "         '

            Case 3: GT = "Thirty "         '

            Case 4: GT = "Forty "          '

            Case 5: GT = "Fifty "          ' Retrieve value if it is

            Case 6: GT = "Sixty "          ' divisible by ten

            Case 7: GT = "Seventy "        ' excluding the value ten.

            Case 8: GT = "Eighty "         '

            Case 9: GT = "Ninety "         '

            Case Else

         End Select

         GT = GT & GetDigit(Right(TensText, 1))  'Retrieve ones place

      End If

      GetTens = GT                     ' Assign function return value.

   End Function   'End function GetTens - return to calling program

 '================================================================

 ' The following function converts a number from 1 to 9 to text

 '================================================================

   Function GetDigit (Digit)

      Select Case Val(Digit)

         Case 1: GetDigit = "One"      '

         Case 2: GetDigit = "Two"      '

         Case 3: GetDigit = "Three"    '

         Case 4: GetDigit = "Four"     ' Assign a numeric word value

         Case 5: GetDigit = "Five"     ' based on a single digit.

         Case 6: GetDigit = "Six"      '

         Case 7: GetDigit = "Seven"    '

         Case 8: GetDigit = "Eight"    '

         Case 9: GetDigit = "Nine"     '

         Case Else: GetDigit = ""      '

      End Select

   End Function  'End function GetDigit - return to calling program

How to Use the Sample Code

--------------------------

To change a currency value into English words, call the NumToWord()

function giving the number as the argument. NumToWord() calls the other

functions as needed and returns the result in English words.

There are two ways to call the NumToWord function. You can call it in

Access Basic code as follows:

   Amount = 24.50

   WordValue = NumToWord(Amount)

Or you can call NumToWord() as a parameter in a SetValue action in a macro.

For example, set Amount to 24.50 and use the following in a SetValue

action in a macro:

   NumToWord(Amount)

Additional reference words: 1.00 1.10 2.00 AB functions macros programs

KBCategory:

KBSubcategory: PgmOthr


INF: How to Convert To and From Unsigned Integers

Article ID: Q96475

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

There are situations in which calling functions from external dynamic-link

libraries (DLLs) returns a 2-byte unsigned integer. Access Basic does not

support this data type. Correctly evaluating this data type requires

converting it from an unsigned integer to an Access Basic Long data type.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

The Access Basic integer data type has a range of -32,768 to 32,767.

An unsigned integer has a range of 0 to 65,536.

Access Basic uses the most significant bit to set the sign of the

value. Therefore, when a value exceeds 32,767, bit 16 is set to

reflect a negative number. To evaluate an unsigned integer, you must

manually adjust bit 16.

There are two methods you can use to convert to and from the unsigned

integer type to the Access Basic Long data type. The first method uses

basic arithmetic (65,536 is subtracted or added to the unsigned

integer). The second uses bit-wise operators. The arithmetic method

works as well as the bit-wise method; however, the arithmetic method

may be more readable, and the bit-wise method may be faster when

executed repetitively.

1. Open a new module or a previously created module and enter the

   following code:

   '*************************************************************

   'Declarations section of the module.

   '*************************************************************

   Option Explicit

   '=============================================================

   ' Arithmetic Method:

   ' ------------------

   ' Create the following ar_ConvertFromUnsignedInteger& (Uint%)

   '    and ar_ConvertToUnsignedInteger% (Bytes&) function in the

   '    Module. This first function reads in an unsigned integer

   '    and returns the converted value as a long. The second

   '    function reads in a long a returns an unsigned integer.

   '=============================================================

   Function ar_ConvertFromUnsignedInteger& (Uint%)

      If Uint% < 0 Then

         ar_ConvertFromUnsignedInteger& = Uint% + 65536

      Else

         ar_ConvertFromUnsignedInteger% = Uint%

      End If

   End Function

   Function ar_ConvertToUnsignedInteger% (Bytes&)

      If Bytes& > 32767 Then

         ar_ConvertToUnsignedInteger% = Bytes& - 65536

      Else

         ar_ConvertToUnsignedInteger% = Bytes&

      End If

   End Function

   '=============================================================

   ' Bitwise Method:

   ' ---------------

   ' Create the following bw_ConvertFromUnsignedInteger& (Uint%)

   '    and bw_ConvertToUnsignedInteger% (Bytes&) function in the

   '    Module. This first function reads in an unsigned integer

   '    and returns the converted value as a long. The second

   '    function reads in a long a returns an unsigned integer.

   '    The message box statement in the second function is used

   '    to prevent an overflow message when the value passed to

   '    the function is greater than 64 kilobytes.

   ' To illustrate what is taking place in the first bitwise function:

   '    Uint% equals -23584, a value returned from an external dynamic

   '    link library that is an unsigned integer and needs to be

   '    converted to an long:

   '        1010001111100000 (-23584)

   '    AND   11111111111111 (7FFF)

   '        ----------------

   '          10001111100000 (41952)

   '=============================================================

   Function bw_ConvertToUnsignedInteger% (Bytes&)

      Dim x%

      If Bytes& > 65535 Then

         MsgBox "You passed a value larger than 65535"

         Exit Function

      End If

      x% = Bytes& And &H7FFF

      bw_ConvertToUnsignedInteger% = x% Or -(Bytes& And &H8000)

   End Function

   Function bw_ConvertFromUnsignedInteger& (Uint%)

      bw_ConvertFromUnsignedInteger& = Uint% And &HFFFF&

   '-------------------------------------------------------------

   ' The &HFFFF& requires the & at the end of the hex number. This

   '   qualifies the hex number as 32 bit versus 16 bit.

   '-------------------------------------------------------------

   End Function

Examples of Using These Functions

---------------------------------

An external dynamic-link library (DLL) requires and returns an unsigned

integer. The Declare statement looks like the following:

   Declare Function External_Call% Lib "your.dll" (ByVal ValueToPass%)

The Declare statement uses integer data types because Access Basic

does not support unsigned integers. However, the external dynamic-link

library does not know this and returns an unsigned integer that must be

converted for use; therefore, the code may appear as follows:

   x% = External_Call(bw_ConvertToUnsignedInteger%(41952))

   y& = bw_ConvertFromUnsignedInteger&(x%)

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Convert Twips to Pixels

Article ID: Q94927

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Because Microsoft Access stores dimension/location properties as twips, it

may be necessary to convert to pixels in certain cases, such as when

calling a Windows API function. This article describes how to do this.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

The ConvertTwipsToPixels() function below can be used to convert twips

to pixels. Note that pixels are not always square (the height and

width are not the same), so it is necessary to pass in the desired

"direction" to use (horizontal or vertical).

To add this function to your application, do the following:

1. Create a new module and enter the following Windows API declarations

   and constants into the Declarations section:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Option Explicit

      Declare Function GetDC% Lib "User" (ByVal hw%)

      Declare Function ReleaseDC% Lib "User" (ByVal hw%, ByVal hDC%)

      Declare Function GetDeviceCaps% Lib "GDI" (ByVal hDC%, _

                                                 ByVal iCapability%)

      Const WU_LOGPIXELSX = 88

      Const WU_LOGPIXELSY = 90

2. Add the following function:

      Function ConvertTwipsToPixels (nTwips%, nDirection%) As Integer

         Dim hDC%                        'Handle to device

         Dim nPixelsPerInch%

         Const nTwipsPerInch = 1440

         hDC% = GetDC(0)

         If (nDirection% = 0) Then       'Horizontal

            nPixelsPerInch% = GetDeviceCaps(hDC%, WU_LOGPIXELSX)

         Else                            'Vertical

            nPixelsPerInch% = GetDeviceCaps(hDC%, WU_LOGPIXELSY)

         End If

         hDC% = ReleaseDC(0, hDC%)

         ConvertTwipsToPixels = (nTwips% / nTwipsPerInch%) * nPixelsPerInch

      End Function

3. To call this function, pass the number of twips you want to convert,

   and another parameter indicating whether the horizontal or vertical

   measurement (0 for horizontal, non-zero for vertical). The following

   is a sample call:

      OldTwips = 2377

      NewPixels = ConvertTwipsToPixels(OldTwips, 0)

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: How to Correctly Back Up Multiuser Databases

Article ID: Q109816

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In order to back up a multiuser database correctly, you must make sure that

you have exclusive access to the database. If you back up a database while

others are using it, you risk damaging the backup database.

MORE INFORMATION

================

You must have exclusive access to a database in order to back it up

correctly. If you back up a database that is being modified by other users,

your backup copy of the database may be damaged or corrupted. When you open

such a backup database in Microsoft Access, you may receive the error

message "database is corrupted." If you repair and compact the database,

you may find that data in the database is truncated.

The only way to ensure the integrity of your backup database is to achieve

a static copy of the database. You must have exclusive access to all the

tables in the database at the same time in order to do so. Once you have

exclusive access to the database, you can copy or export the database, and

then archive the copy or export.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlMu


INF: How to Create a "Please Wait" Message

Article ID: Q96989

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Sometimes you may want to display a status message to inform a user he

or she must wait for an action to be completed. For example, you may

want to display the text "Please Wait" while Microsoft Access is

initializing a database, running a long query, and so on. You can do

this by using a form and a macro. This article presents a simple

example using the sample database NWIND.MDB.

MORE INFORMATION

================

To display a status message in Microsoft Access, do the following:

1. Create an unbound blank form named PLEASEWAIT. Add a label with the

   message you want to display. For example, type "Please Wait" (without

   the quotation marks) as the caption. The form properties should be set

   to the following:

      Form: PLEASEWAIT

      ----------------

      ScrollBars: Neither

      Popup: Yes

      Modal: Yes

      RecordSelectors: No

2. Create the following macro named Test1:

      Macro Name             Action

      -----------------------------

      Test1                  OpenForm

                             RepaintObject

                             OpenQuery

                             Close

      Test1 Actions

      -----------------------------

      OpenForm

         Form Name: PLEASEWAIT

         View: Form

         Date Mode: Read Only

         Window Mode: Normal

      RepaintObject

         Object Type: Form

         Object Name: PLEASEWAIT

      OpenQuery

         Query Name: <Daily Orders Total>

         View: Datasheet

      Close

         Object Type: Form

         Object Name: PLEASEWAIT

   NOTE: The above argument for OpenQuery is just an example of what you

   may want to run; this can be anything. The main macro actions in Test1

   are OpenForm, RepaintObject, and Close.

3. Run the macro. The PLEASEWAIT form should open. As soon as the

   query completes processing, the form disappears and the query results

   appear.

Additional reference words: 1.00 1.10 2.00 StatusBar Status Bar Meter Wait

KBCategory:

KBSubcategory: FmsOthr


INF: How to Create a Custom Startup "Splash" Screen

Article ID: Q101374

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to create a custom startup "splash" screen

for your Microsoft Access application.

MORE INFORMATION

================

A startup "splash" screen (title screen) is used by programmers to

display important information about a program during startup and to

give the user something colorful to look at and read while waiting for

the program to complete its initial processing, such as reading and

setting up user-defined preferences.

A typical splash screen contains the following information:

 - The program name and version number

 - The registered user's name and company

 - Copyright information

 - The developer's company name and logo

This article contains two Access Basic functions to implement splash

functionality.

Creating a New Splash Module

----------------------------

1. Create a new Access Basic module with the following functions:

'******************************************************************

' MODULE NAME: Splash

' DECLARATION SECTION

'******************************************************************

Option Explicit

Dim gSplashStart     ' The time when the splash screen opened.

Dim gSplashInterval  ' The minimum time to leave the splash screen up.

Dim gSplashForm      ' The name of the splash screen form.

'******************************************************************

' FUNCTION: SplashStart()

'

' PURPOSE: Used to invoke the splash screen form specified by the

'    SplashForm argument.

'

' ARGUMENTS:

'    SplashForm     - The name of the form to use as the splash

'                     screen.

'    SplashInterval - The minimum time, in seconds, that the splash

'                     screen must remain active on the screen.

'

'******************************************************************

Function SplashStart (ByVal SplashForm As String, ByVal SplashInterval_

As Integer)

    ' Open the splash form.

    DoCmd OpenForm SplashForm

    ' Set the starting time.

    gSplashStart = Timer

    ' Record the global information.

    gSplashInterval = SplashInterval

    gSplashForm = SplashForm

End Function

'******************************************************************

' FUNCTION: SplashEnd()

'

' PURPOSE: Used to close the splash screen form opened by the

'    SplashStart() function. This function checks to ensure that

'    the splash screen remains active until the user-specified

'    interval has expired.

'

'******************************************************************

Function SplashEnd ()

   Dim RetVal

   ' Loop until the splash screen has been active for

   ' .. the desired interval.

   Do Until Timer - gSplashStart > gSplashInterval

      ' Yield control so other applications can process.

      RetVal = DoEvents()

   Loop

   ' Close the splash screen.

   DoCmd Close A_FORM, gSplashForm

End Function

2. Save the new module as Splash.

How to Use the SplashStart() and SplashEnd() Functions

------------------------------------------------------

1. Create an unbound form with the text and graphics you want to

   display on the splash screen. For more information, see the

   "Setting Form Properties" section below.

2. Create a macro with the following actions and save it as AutoExec:

      Action                                           Arguments

      ----------------------------------------------------------

      RunCode                                                1.

      <any startup macro actions required by your program>   2.

      RunCode                                                3.

   AutoExec Actions

   -------------------------------------------------------------------

   1. RunCode

         Function Name: SplashStart("YourSplashFormNameHere", 5)

   2. <any startup macro actions required by your program .. optional>

   3. RunCode

         Function Name: SplashEnd()

Setting Form Properties

-----------------------

For best results, the splash form should have its form properties set

as follows:

   ScrollBars: Neither

   PopUp: Yes

   Modal: Yes

   RecordSelectors: No

Suppressing the Default Splash Screen

-------------------------------------

To prevent the default Microsoft Access splash screen from appearing,

you can use the run-time version of Microsoft Access, provided with

the Microsoft Access Distribution Kit (ADK) for version 1.1, or the

Microsoft Access Developer's Toolkit (ADT) for version 2.0.

Additional reference words: 1.10 2.00 Title Intro

KBCategory:

KBSubcategory: PgmOthr


INF: How to Create a Custom Toolbar Using a Form

Article ID: Q113304

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a custom, floating toolbar using a

Microsoft Access form. Using a form for a custom toolbar provides the

following advantages:

 - Labels, combo boxes and list boxes can be placed on the toolbar.

 - Buttons with custom bitmaps can be placed on the toolbar.

 - You can prevent users from closing or moving the toolbar.

 - You can take advantage of form modules to store the code being used by

   the controls on the toolbar with the toolbar itself.

 - You can disable the shortcut menus from being used on the toolbar.

MORE INFORMATION

================

The example below demonstrates how to create a custom, floating toolbar

that has buttons to find, save, delete, and undo a record, as well as

buttons to navigate among the records, including buttons to go to the first

record, go to the previous record, go to the next record, go to the last

record, and add a new record.

 1. Open the sample database NWIND.MDB and create a new, blank form.

 2. Set the following form-level properties:

       Caption: Tool bar

       ShortcutMenu: No

       ScrollBars: Neither

       RecordSelectors: No

       NavigationButtons: No

       PopUp: Yes

       BorderStyle: Dialog

       MinButton: No

       MaxButton: No

 3. Activate the toolbox by choosing Toolbox from the View menu. Make sure

    the Wizard button is chosen (the button should appear sunken).

 4. Choose the command button tool, and then click anywhere in the form.

 5. In the Categories box, select Record Navigation. In the When Button Is

    Pressed box, select Find Record. Choose Finish.

 6. Drag the new button to the upper left corner of the detail section.

 7. Repeat steps 4-6 to create the other buttons for the toolbar. Use the

    following selection combinations from the Categories and the When

    Button Is Pressed boxes. Move each of the new buttons directly to the

    right of the button before it.

       Categories             When button Is Pressed

       ---------------------------------------------

       Record Operations      Save Record

       Record Operations      Delete Record

       Record Operations      Undo Record

       Record Navigation      Go to First Record

       Record Navigation      Go to Previous Record

       Record Navigation      Go to Next Record

       Record Navigation      Go to Last Record

       Record Operations      Add New Record

 8. Drag the bottom of the detail section up so that it is flush with the

    bottom of the buttons. Drag the right side of the detail section so

    that it is flush with the right side of the last button.

 9. From the View menu, choose Code.

10. Create the following Access Basic function in the toolbar form module:

       Option Explicit

       Function ActivateToolbarForm ()

          On Error Resume Next

          Forms(Me.Tag).SetFocus

          If Err Then

             ActivateToolbarForm = False

          Else

             ActivateToolbarForm = True

          End If

       End Function

    This function will be used to reactivate the form the toolbar is

    floating on, so that the chosen operation is performed on that form

    rather than against the toolbar form itself.

11. For each button on the toolbar form, insert the following line of code

    at the very top of the button's OnClick event procedure. To insert the

    code, select a button, click the right mouse button in the OnClick

    property field, and then choose Build.

       If ActivateToolbarForm() = False Then Exit Sub

    For example, the code for the Search button might look like the

    following:

       Sub Button0_Click ()

       If ActivateToolbarForm() = False Then Exit Sub

       On Error GoTo Err_Button0_Click

          DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, 10, , A_MENU_VER20

       Exit_Button0_Click:

          Exit Sub

       Err_Button0_Click:

          MsgBox Error$

          Resume Exit_Button0_Click

       End Sub

    This code ensures that the form the toolbar is floating on is selected

    for the chosen operation.

12. Save the form with the name Toolbar, and then close the form.

13. Create a new Access Basic module. Add the following code:

       Option Explicit

       Sub SetToolbarForm (F As Form)

          If IsLoaded("Toolbar") Then Forms![Toolbar].Tag = F.Name

       End Sub

    The SetToolbarForm subroutine uses the IsLoaded() function that is in

    the Utility Functions module in NWIND.MDB. You should copy this

    function for use in other databases.

14. For every form that you intend to use the custom toolbar with, add the

    following line of code to the form's OnActivate property:

       SetToolbarForm Me

    For this example, add the line of code above to the OnActivate property

    of the Customers and Employees forms:

    a. Open the Employees form in Design view.

    b. From the View menu, choose Code.

    c. Select Form in the first combo box on the code toolbar.

    d. Select Activate in the second combo box on the code toolbar.

    e. Add the above line of code so the subroutine appears as follows:

          Sub Form_Activate ()

             SetToolbarForm Me

          End Sub

    f. Repeat steps a-e for the Customers form.

    This line of code instructs the custom toolbar to store the name of the

    form to be used when a toolbar button is chosen. This ensures that the

    toolbar actions are performed against the active form.

Using the Custom Toolbar

------------------------

Open the Customers and Employees forms in Form view, and then open the

Toolbar form. Switch back and forth between the Employees form and the

Customers form, using the navigation buttons on the custom toolbar to

navigate among the form records.

Suggested Enhancements to the Custom Toolbar

--------------------------------------------

 - You may want to automate the loading and closing of a custom toolbar

   form from another form's load and unload events. For example, to have

   the custom toolbar open only with the Customers form, add the following

   code to the Customers form's OnLoad and OnUnLoad properties:

      Sub Form_Load ()

         DoCmd OpenForm "Toolbar"

      End Sub

      Sub Form_Unload (Cancel As Integer)

         DoCmd Close A_FORM, "Toolbar"

      End Sub

 - You can set the BorderStyle property of the toolbar form to None, so

   that no border and no caption bar appears. This will prevent users from

   being able to move the toolbar around.

 - You may want to automatically position the toolbar form to a specific

   location on the screen. To do this, use a MoveSize macro action in the

   toolbar form's OnLoad property. The following sample code will position

   the toolbar form to the upper left corner of the screen:

      DoCmd MoveSize 0, 0

Additional reference words: 1.00 1.10 2.00 tool bar

KBCategory:

KBSubcategory: FmsOthr


INF: How to Create a Cyclic Tab Order in a Form

Article ID: Q112064

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a technique that you can use to create a cyclic tab

order on a form, so that pressing TAB in the last control on a form moves

you back to the first control on the form (instead of moving you to the

first control on the next record), and pressing SHIFT+TAB in the first

control on a form moves you to the last control on the form.

MORE INFORMATION

================

The following example demonstrates how to create a cyclic tab order on the

Customers form in the sample database NWIND.MDB. This technique uses two

transparent command buttons, one at the top and one at the bottom of the

form's tab order. When you press TAB in the last control, or SHIFT+TAB in

the first control, you run a macro attached to the OnEnter property of the

transparent command button at the top or bottom of the form's tab order.

1. Create a macro called CyclicCustomers with the following actions:

      MacroName   Action

      ---------------------------------------

      GotoFirst   GotoControl

                     ControlName: Customer ID

      GotoLast    GotoControl

                     ControlName: Fax

2. Open the Customers form in Design view and add the following two

   command buttons with no labels:

      Command Button

      ------------------------------------

      ControlName: btnGotoLast

         OnEnter: CyclicCustomers.GotoLast

         Transparent: Yes

      Command Button

      -------------------------------------

         ControlName: btnGotoFirst

         OnEnter: CyclicCustomers.GotoFirst

         Transparent: Yes

   NOTE: Make these buttons very small, and position them so that users of

   the form are unlikely to choose them accidentally.

3. Set the form's OnOpen property to:

      OnOpen: CyclicCustomers.GotoFirst

   This is necessary since the btnGotoLast button will be the first control

   in the form's tab order. If you do not set the form's OnOpen property to

   CyclicCustomers.GotoFirst, the first command button will be selected

   when the form is opened, moving the focus to the last control on the

   form.

4. From the Edit menu, choose Tab Order.

5. Scroll to the bottom of the list of control names to find the new

   btnGotoLast and btnGotoFirst controls. Select the btnGotoLast control

   and drag it to the top of the list. btnGotoFirst should remain at the

   bottom of the list.

6. View the form in Form view. The first Customer ID in the Customers

   table is displayed.

7. Press SHIFT+TAB. The Fax field (the last field in the form) is selected.

8. Press TAB. The Customer ID field is selected.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsEvnt


INF: How to Create a Graph Bound to Two Combo Boxes

Article ID: Q109323

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a graph that is bound to two combo

boxes. You can control the data that is displayed in the graph with your

selections in the combo boxes.

MORE INFORMATION

================

The following example demonstrates how to set up a graph that is bound to

two combo boxes:

 1. Start Microsoft Access and open the sample database NWIND.MDB.

 2. Create the following query based on the Orders, Order Details, and

    Products tables:

       Query: QueryTest

       -----------------------------------------------------

       FieldName: Order Amount

          Table Name: Orders

          Total: Sum

       FieldName: Product Name

          Table Name: Products

          Total: Group By

       FieldName: Category ID

          Table Name: Products

          Total: Group By

       FieldName: Year: CStr(NulltoZero(Year([Order Date])))

          Table Name:

          Total: Group By

 3. Create a new form based on the QueryTest query. Choose FormWizards.

 4. Select Graph and then choose OK.

 5. Choose Next.

 6. Select SumofOrderAmount and then choose ">". Select Product Name and

    then choose ">". Select Category ID and then choose ">". Choose Next.

 7. Select Category ID, and then choose Next.

 8. Choose Open to view the form in Form view.

 9. View the form in Design view.

10. From the Layout menu, choose Form Hdr/Ftr.

11. Add two combo boxes with the following properties to the form:

       Object: Combo box

       -----------------------------

       ControlName: SelectCat

          RowSourceType: Table/Query

          RowSource: Categories

       Object: Combo box

       ---------------------------------

       ControlName: SelectYear

          RowSourceType: Value List

          RowSource: 1989;1990;1991;1992

12. Select the graph and modify the properties of its object frame as

    follows:

       Object: Object Frame

       -----------------------------------------

       ControlName: Embedded0

          LinkChildFields: Category Id;Year

          LinkMasterFields: SelectCat;SelectYear

13. View the form in Form view. As you make different selections in the

    combo boxes, the contents of the graph will change.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpGrph


INF: How to Create a Multiuser Custom Counter

Article ID: Q88159

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can define a field as a counter in a Microsoft Access table. When a

field is defined as a counter, Microsoft Access manages the numbering in

the field. When you add a record, Microsoft Access assigns the next

available value to the field. You have no control over this value.

You may want to use a unique counter that is not immediately sequential in

nature. For example, you may want to use a counter that decrements, or a

counter that that steps according to some value.

This article demonstrates a sample user-defined Access Basic function that

you can use to create a custom counter field.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

To following steps outline in general how to create a custom counter.

Further below is a more detailed description on how to create a custom

counter.

1. Create a separate table that will maintain the next available

   custom counter. This table will have one field and one record, with

   the value of the next available counter in this one record.

2. From within Access Basic, open this counter table and retrieve the

   value stored there.

3. Increment the value retrieved and store the number back into the

   database.

4. Close the table and use the value in the appropriate table as the

   next available counter.

In a single-user environment, the steps described above can be done

with macro actions. In a multiuser environment, Access Basic is needed

to handle the event where this counter table is locked. Macro actions

do not provide the locking control needed in the multiuser

environment.

The following example describes how to create a custom counter field

with positive number values divisible by 10 (that is, 10, 20, 30, and

so on) in sequential order:

The Table

---------

 1. From the File menu, choose New, then select Table.

 2. Add a field to the table called "Next Available Counter." Set the

    data type of "Next Available Counter" to number.

 3. From the Edit menu, choose Primary Key to make "Next Available

    Counter" the primary key.

 4. From the View menu, choose Datasheet View.

 5. A dialog box will prompt you to save the table. Save it as

    "Counter Table."

 6. Once in Datasheet view, enter a value of 10 into the "Next

    Available Counter" field.

 7. From the File menu, choose Close to close the table.

The Module

----------

 8. From the File menu, choose New, then select Module to create a new

    module.

 9. Add the following function to the module:

    Function Next_Custom_Counter ()

       On Error GoTo Next_Custom_Counter_Err

       Dim MyDB As Database

       Dim MyTable As Table

       Dim NextCounter As Integer

       '==============================================================

       'Open table and get the next available number, increment value

       'by 10 and save the number back into the table.

       '==============================================================

       Set MyDB = CurrentDB()

       Set MyTable = MyDB.OpenTable("Counter Table")

       MyTable.Edit

       NextCounter = MyTable("Next Available Counter")

       '==============================================================

       'The next line can be changed to conform to your custom counter

       'preferences. This example only increments the value by +10

       'each time.

       '==============================================================

       MyTable("Next Available Counter") = NextCounter + 10

       MyTable.Update

       MsgBox "Next available counter value is " & Str$(NextCounter)

       Next_Custom_Counter = NextCounter

       Exit Function

       '==============================================================

       'The following error routine should be replaced with a custom error

       'routine. This example only resumes execution if an error occurs. If

       'a record locking error occurs this is fine. But any non-record

       'locking error will result in an infinite loop.

       '==============================================================

       Next_Custom_Counter_Err:

          Msgbox "Error " & err & ": " & error$

          If ERR <> 0 then Resume

       End

    End Function

10. From the File menu, choose Save. Save the module as "Custom

    Counter Demo."

The Form

--------

11. From the File menu, choose New, then select Form. Choose the Blank

    Form button to start with a blank form.

12. Add a command button to the form from the toolbox. If the toolbox

    is not displayed, from the View menu, choose Toolbox.

13. If the Properties window is not displayed, choose Properties from

    the View menu.

14. Choose the command button with the mouse so that the Properties

    window displays "Command Button" on the title bar.

15. Set the OnPush property to =Next_Custom_Counter().

    NOTE: In Microsoft Access version 2.0, the OnPush property is called

    the OnClick property.

16. Save the form as "Custom Counter Demo" by selecting the Save As

    command from the File menu.

Execution

---------

17. From the View menu, choose Form View to switch to Form view. Click

    the command button; a message box will display the value of the

    next counter.

Additional reference words: 1.00 1.10 2.00 network duplicate

KBCategory:

KBSubcategory: TblDatyp


INF: How to Create a Parameter In() Statement

Article ID: Q100131

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a way to create a query by using the In()

operator with multiple values.

The method shown below uses a query that calls a function, which then

is passed two parameters. The first parameter is the name of a field

that exists in the table on which the query is based. The second

parameter prompts the user to enter a list of values. The function

processes the user's entries as the list of multiple parameters for

the In() operator.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The following example is based on the sample database NWIND.MDB:

1. Create a new module with the following two functions:

      '************************************************************

      'Declarations section of the module.

      '************************************************************

      Option Explicit

      '============================================================

      ' The GetToken() function defines the delimiter character.

      '============================================================

      Function GetToken (stLn, stDelim)

         Dim iDelim as Integer, stToken as String

         iDelim = InStr(1, stLn, stDelim)

         If (iDelim <> 0) Then

            stToken = LTrim$(RTrim$(Mid$(stLn, 1, iDelim - 1)))

            stLn = Mid$(stLn, iDelim + 1)

         Else

            stToken = LTrim$(RTrim$(Mid$(stLn, 1)))

            stLn = ""

         End If

         GetToken = stToken

      End Function

      '============================================================

      ' The InParam() function is the heart of this article. When

      ' the query runs, this function causes a query parameter

      ' dialog box to display so that you can enter a list of values.

      ' The values you enter are interpreted in the same way as if you

      ' had entered them within the parentheses of the In() operator.

      '============================================================

      Function InParam (Fld, Param)

         Dim stToken as String

         'The following two lines are optional, making queries

         'case-insensitive

         Fld = UCase(Fld)

         Param = UCase(Param)

         If IsNull(Fld) Then Fld = ""

         Do While (Len(Param) > 0)

           stToken = GetToken(Param, ",")

           If stToken = LTrim$(RTrim$(Fld)) Then

              InParam = -1

              Exit Function

           Else

              InParam = 0

           End If

         Loop

      End Function

2. Close and save the module.

3. Create a new query based on the Customers table. Drag any fields

   you want to the query grid.

4. Add the following field to the query grid:

      FieldName: InParam([Customer ID],[Enter a list of IDs separated

                  by commas and no spaces:])

      Show: False

      Criteria: True

   NOTE: The value InParam(...) shown for the FieldName should be

   entered as one statement on a single line. The InParam() function

   works with Integer fields as well as with Text fields.

5. From the Query menu, choose Parameters. Enter the following

   parameter with a Text data type:

      Enter a list of ID's separated by commas and no spaces:

6. Choose OK and run the query.

   You are prompted to enter a list of parameters. The following

   message is displayed in the dialog box:

      Enter a list of ID's separated by commas and no spaces:

7. Type the following values, without spaces:

      BLUEL,CACTP,DOLLC

   NOTE: In version 2.0, type

      CHOPS,EASTC,FAMIA

   All records meeting the above criteria are displayed.

Additional reference words: 1.00 1.10 2.00 Queries AB parameters IN

KBCategory:

KBSubcategory: QryParm


INF: How to Create a Running Sum on a Form

Article ID: Q103183

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

While reports have a RunningSum property, forms do not. This article

describes a method to create a running sum on a form.

MORE INFORMATION

================

1. You need a unique, sequential ID field, such as a Counter or a

   Date/Time field.

   NOTE: If such a field does not already exist, you can create one by

   opening the table in Design view and adding a new field.

2. Start Microsoft Access and open the sample database NWIND.MDB.

3. Create a new, blank form based on the Orders table.

4. Set up the form as follows:

   NOTE: The underscore (_) is used in the code below as a

   line-continuation character to improve readability. You must enter

   the entire text as one line.

   Form:  Form1

   ------------

   RecordSource: Orders

   Form Controls

   -------------

   Text Box: Order ID

      ControlSource: Order ID

   Text Box: Order Amount

      ControlSource: Order Amount

   Text Box: Total

      ControlSource: =DSum("[Order Amount]","Orders",_

                             "[Order ID] <= Forms![Form1]![Order ID]")

   The DSum() function calculates the sum total of all orders with an

   Order number less than or equal to the currently displayed order

   number. For this reason, it is important to have a unique and

   sequential ID field.

Additional reference words: 1.00 1.10 2.00 subtotal

KBCategory:

KBSubcategory: FmsOthr


INF: How to Create an SQL Pass-Through Query in Access Basic

Article ID: Q112108

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to create an SQL pass-through (SPT) query in

Access Basic. You can use SPT queries to pass SQL statements directly to an

ODBC data source, avoiding the need to attach tables.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual, Chapter 3, "Introducing Access

Basic."

MORE INFORMATION

================

You can use SPT queries to send commands directly to an ODBC database

server (such as Microsoft SQL Server). Using Access Basic, you can write a

function that will create an SPT query. When you run the query, it will

send commands directly to the ODBC database server for processing.

The following example demonstrates how to create an SPT query in Access

Basic:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

1. Create the following sample Access Basic code:

      '-----------------------------------------------

      ' Declarations Section

      '-----------------------------------------------

      Option Explicit

      '-----------------------------------------------

      ' FUNCTION: CreateSPT()

      ' PURPOSE:

      '   Creates an SQL pass-through query using Access Basic using the

      '   supplied arguments:

      '      SPTQueryName: the name of the query to create

      '      SQLString: the query's SQL string

      '      ConnectString: the ODBC connect string, this must be at

      '         least "ODBC;"

      '-----------------------------------------------

      Function CreateSPT (SPTQueryName As String, SQLString As String, _

                  ConnectString As String)

         Dim mydatabase As Database, myquerydef As QueryDef

         Set mydatabase = DBENGINE.Workspaces(0).Databases(0)

         Set myquerydef = mydatabase.CreateQueryDef(SPTQueryName)

         myquerydef.connect = ConnectString

         myquerydef.sql = SQLString

         myquerydef.Close

      End Function

2. To call this function, type the following in the Immediate window:

      ? CreateSPT("MySptQuery", "sp_help", "ODBC;")

This will create the query MySptQuery and add it to the list of queries in

the Database window. When you run MySptQuery it will prompt you for the

ODBC connect string and run the stored procedure sp_help, which returns a

list of tables from the SQL Server.

To create an SPT query called Test that would return a list of all the

records from the Authors table located on the Red server in the Pubs

database, you would type

   ? CreateSPT("Test", "Select * from authors",_

        "ODBC;DSN=Red;Database=Pubs;USID=JOE;PWD=JOE")

in the Immediate window. This example also includes the UserId and password

(both "Joe") arguments in the ODBC connect string. Note that if you do not

supply at least "ODBC;" as the connect string, you will receive the

following error message:

   Syntax error in SELECT statement.

REFERENCES

==========

For more information about ODBC connect strings, query on the following

words here in the Microsoft Access Knowledge Base:

   ODBC and Connect and Usid

For more information about the syntax of SQL pass-through queries, please

consult the documentation for your server.

Additional reference words: 2.00 spt

KBCategory:

KBSubcategory: ObcOthr


INF: How to Create an Undo Record Button on a Form

Article ID: Q101079

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a button on a form to undo

changes made to the current record.

MORE INFORMATION

================

To undo the changes to the current record, you can use the DoMenuItem

macro action to choose Undo Current Record from the Edit menu.

However, this menu item is available only when there are changes to

undo. Attempting to use the DoMenuItem action when no changes have

been made to the current record causes the following error message to

appear:

   Command not available: UndoCurrentRecord

The following is a module using the Access Basic function

UndoRecord(), which allows you to undo the current record, whether or

not the record has been changed, or "dirtied":

   Option Explicit

   Function UndoRecord ()

      On Error Resume Next

      DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_UNDOFIELD

      DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_UNDO

   End Function

To use this function on a form, create a command button and set its

OnPush or OnClick property to =UndoRecord().

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsEvnt


INF: How to Create and Use Subqueries

Article ID: Q114678

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 supports the use of subqueries. A subquery is

a select query inside another select or action query that acts as a

criterion for a field. A subquery can refer to a table that is part of the

current query, or to a table that is not part of the current query. Union

and crosstab queries are not supported as subqueries.

MORE INFORMATION

================

To create a subquery, enter a valid SQL SELECT statement in the Criteria

row of the field whose value will be compared with the value selected in

the subquery. The field that the criterion is specified for and the field

that is being selected in the subquery must be of the same data type. You

can also have a subquery in the Field row of the query grid, although it is

not recommended.

A correlated subquery is one in which a column from a table specified in

the FROM clause of the main query is used in the WHERE clause of the

subquery, as demonstrated in the following example:

   SELECT * FROM Table1 WHERE FirstName IN (SELECT FirstName FROM Table2

   WHERE Table2.LastName=Table1.LastName);

The following example demonstrates how to create a subquery:

1. Open the sample database NWIND.MDB.

2. Create a new query and add the Products table.

3. Add the Product Name and Unit Price fields to the query grid.

4. Create the subquery by entering the following SQL SELECT statement

   in the Criteria row of the Unit Price field.

   NOTE: In the following statement, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this

   statement.

      <=(SELECT [Unit Price] FROM [Products] WHERE [Product Name]= _

      "Filo Mix")

5. Run the query. The query will return the products whose unit prices are

   less than or equal to the unit price for Filo Mix.

REFERENCES

==========

For more information about creating subqueries, search for "subqueries"

then "Creating a Subquery" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 2.0, Chapter 12, "Advanced

Queries," pages 296-297

Additional reference words: 2.00 sub-select

KBCategory:

KBSubcategory: QryOthr


INF: How to Create Custom Domain Function Similar to DCount()

Article ID: Q103401

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Custom domain functions can be used to provide functionality other

than that provided by the standard domain functions DLookup(), DMin(),

DLast(), and so on.

This article demonstrates how to write a custom domain function that

is similar to the DCount() function. In addition, it demonstrates a

sample function, DFix(), to overcome limitations in concatenating

variables in criteria strings. Information about the limitations of

custom domain functions is at the end of this article.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

The DRecCount() sample custom domain function is useful when the

domain is a totals or aggregate query based on an attached SQL table.

The DRecCount() custom domain function will accurately return the

count of such a dynaset.

To create these examples, open a new module within Microsoft Access

and add the following functions with the appropriate declaration

section:

'-------------------------------------

' GLOBAL DECLARATION

'-------------------------------------

Option Compare Database

Option Explicit

Function DRecCount (FieldName, DomainName, Criteria)

   '---------------------------------------------------

   ' Use DRecCount to return a count

   '   of records when the domain is a query based on a

   '   totals/aggregate query on an attached SQL table.

   '---------------------------------------------------

  Dim MyDB As Database, Myset As Dynaset

  If VarType(FieldName) <> 8 Or Len(FieldName) = 0 Then

    MsgBox "You Must Specify a Field name", , "DRecCount"

    Exit Function

  End If

  If VarType(DomainName) <> 8 Or Len(DomainName) = 0 Then

    MsgBox "You Must Specify a Domain name", , "DRecCount"

    Exit Function

  End If

  If VarType(Criteria) <> 8 And Not IsNull(Criteria) Then

    MsgBox "Invalid Criteria", , "DRecCount"

    Exit Function

  End If

  Set MyDB = CurrentDB()

  Set Myset = MyDB.CreateDynaset(DomainName)

  If FieldName <> "*" Then

    If Len(Criteria) > 0 Then

      Criteria = Criteria & " AND "

    End If

    Criteria = Criteria & "[" & FieldName & "] Is Not Null"

    Myset.Filter = Criteria

    Set Myset = Myset.CreateDynaset()

  End If

  If Myset.EOF Then

    DRecCount = 0

  Else

    Myset.MoveLast

    DRecCount = Myset.recordcount

  End If

  Myset.Close

  MyDB.Close

End Function

Function DFix (ByVal T, DQuote As Integer)

   '------------------------------------------------------------------

   ' Fixes string arguments that are passed

   '   to Criteria in domain functions

   '

   ' DQuote should be TRUE or -1 if Double Quotes (") delimit Criteria

   ' DQuote should be FALSE or 0 if Single Quotes (') delimit Criteria

   '

   ' e.g. this gives an error

   '   (note the quote (') in the data)

   '   X="Mike's Diner"

   '   A=DRecCount("*","Clients","Name='" & X & "'")

   '

   ' Use either:

   '   X=DFix("Mike's Diner",False)

   ' Or:

   '   A=DRecCount("*","Clients","Name='" & DFix(X,False) & "'")

   '------------------------------------------------------------------

  Dim P As Integer, OldP As Integer, Q As String * 1

  If VarType(T) = 8 Then

    If DQuote = 0 Then

      Q = "'"

    Else

      Q = """"

    End If

    P = InStr(T, Q)

    Do While P > 0

      OldP = P + 2

      T = Left$(T, P) & Q & Mid$(T, P + 1)

      P = InStr(OldP, T, Q)

    Loop

  End If

  DFix = T

End Function

General Limitations to Custom Domain Functions

----------------------------------------------

 - You cannot use Forms!FormName!ControlName or Form.ID in quotation

   marks. The following example is not allowed:

      DRecCount("ID","LOG","Name=Form.Name")

   Instead, use:

      DRecCount("ID","LOG","Name = '" & DFix(Name,False) & "'")

   Note that the DFix() function is another custom function that is

   demonstrated in this article.

 - You must always specify a criteria, even if it is "" or Null.

 - Do not place field names or domain names in brackets. For example,

   use "First Name" instead of "[First Name]".

NOTE: DFix() can be used with other criteria strings, such as the

FindRecord method, or when building custom SQL criteria.

REFERENCES

==========

For more information on custom domain functions, query on the

following words here in the Microsoft Knowledge Base:

   custom and domain and function

Additional reference words: 1.00 1.10 2.00 Modules ab

KBCategory:

KBSubcategory: PgmOthr


INF: How to Create Custom Navigation (VCR) Buttons on a Form

Article ID: Q104683

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The navigation (VCR) buttons that appear on a form's horizontal

scroll bar provide a convenient way of navigating among records.

The following information describes how to create custom navigation

buttons on your own forms.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The following sample module demonstrates Access Basic functions that

can be used to create custom buttons for navigating among first, last,

previous, and next records on a form. Functions are provided to

navigate through forms as well as subforms.

To create custom navigation buttons on a form, create a new module

with the following Access Basic code:

   '*******************************************

   ' MODULE DECLARATION SECTION

   '*******************************************

   Option Explicit

   Dim RetVal As Variant

   '*******************************************

   ' MODULE FUNCTIONS

   '*******************************************

   Function GotoFirstRecord ()

      RetVal = GotoRecord(A_FIRST)

   End Function

   Function GotoLastRecord ()

      RetVal = GotoRecord(A_LAST)

   End Function

   Function GotoNextRecord ()

      RetVal = GotoRecord(A_NEXT)

   End Function

   Function GotoPrevRecord ()

      RetVal = GotoRecord(A_PREVIOUS)

   End Function

   Function GotoFirstSubRecord (SubControlName As String)

      DoCmd GoToControl SubControlName

      RetVal = GotoFirstRecord()

   End Function

   Function GotoLastSubRecord (SubControlName As String)

      DoCmd GoToControl SubControlName

      RetVal = GotoLastRecord()

   End Function

   Function GotoNextSubRecord (SubControlName As String)

      DoCmd GoToControl SubControlName

      RetVal = GotoNextRecord()

   End Function

   Function GotoPrevSubRecord (SubControlName As String)

      DoCmd GoToControl SubControlName

      RetVal = GotoPrevRecord()

   End Function

   Function GotoRecord (Direction)

      On Error Resume Next

      DoCmd GoToRecord , , Direction

   End Function

How to Use the Custom Navigation Functions on a Form

----------------------------------------------------

The steps listed below demonstrate how to use the Access Basic functions

detailed above to add custom navigation buttons to the Orders and the

Orders Subform forms in the sample database NWIND.MDB included with

Microsoft Access:

1. Open the Orders form in Design view.

2. Create four buttons on the form to facilitate navigation among the

   Orders records. Place these buttons side by side, with the

   following properties:

      Command Button : btnGotoFirstRecord

         Caption: <<

         OnClick: =GotoFirstRecord()

         (OnPush in version 1.x)

      Command Button : btnGotoPrevRecord

         Caption: <

         OnClick: =GotoPrevRecord()

         (OnPush in version 1.x)

      Command Button : btnGotoNextRecord

         Caption: >

         OnClick: =GotoNextRecord()

         (OnPush in version 1.x)

      Command Button : btnGotoLastRecord

         Caption: >>

         OnClick: =GotoLastRecord()

         (OnPush in version 1.x)

3. Create four buttons on the Orders Subform form to facilitate navigation

   among the records. Place these buttons side by side, with the following

   properties:

      Command Button : btnGotoFirstSubRecord

         Caption: <<

         OnClick: =GotoFirstSubRecord("Orders Subform")

         (OnPush in version 1.x)

      Command Button : btnGotoPrevSubRecord

         Caption: <

         OnClick: =GotoPrevSubRecord("Orders Subform")

         (OnPush in version 1.x)

      Command Button : btnGotoNextSubRecord

         Caption: >

         OnClick: =GotoNextSubRecord("Orders Subform")

         (OnPush in version 1.x)

      Command Button : btnGotoLastSubRecord

         Caption: >>

         OnClick: =GotoLastSubRecord("Orders Subform")

         (OnPush in version 1.x)

NOTE: These buttons can be placed on the main form or on the subform.

The argument being passed to the function ("Orders Subform") is the name

of the subform control.

checkpage record selector vcr

Additional reference words: 1.00 1.10 2.00 scrollbar navigate goto

KBCategory:

KBSubcategory: FmsOthr


INF: How to Create Do While/Do Until Loops in a Macro

Article ID: Q90814

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To perform a Do While or Do Until loop in a Microsoft Access macro,

you need to use a combination of correct macro structure and the

RunMacro action with appropriate information supplied in the Repeat

Expression parameter. These requirements are described in more detail

below.

MORE INFORMATION

================

There are several types of Do loops. Each type handles the looping

procedure and conditions differently. The different types of Do loops

are:

1. Do While <condition>... Loop

   This loop will execute while the condition is true. If the loop is

   encountered and the condition is already false, the loop will not

   be performed.

2. Do Until <condition>... Loop

   This loop will execute until the condition is true. If the loop is

   encountered and the condition is already true, the loop will not be

   performed.

3. Do... Loop While <condition>

   This loop will execute the first time unconditionally, then loop

   while the condition is true. If the loop is encountered and the

   condition is already false, the loop will be performed once.

4. Do... Loop Until <condition>

   This loop will execute the first time unconditionally, then loop

   until the condition is true. If the loop is encountered and the

   condition is already true, the loop will be performed once.

To perform a Do While or Do Until loop in a macro, you would use a

macro similar to the following examples. To create the following

examples, open a new macro and choose Macro Names from the View menu.

Add the following macro names and actions and save this macro group as

Do_Loops.

Do While <Condition>... Loop and Do Until <Condition>... Loop

-------------------------------------------------------------

   Macro Name       Action

   -------------------------

   Do_Loop1         RunMacro

   Loop1            MsgBox

   Do_Loop1 Actions

   ----------------

   RunMacro

      MacroName: Do_Loops.Loop1

      Repeat Expression: <your_condition>

   Loop1 Actions

   -------------

   MsgBox

      Message: ="Loop"

In this example, the Do_Loop1 macro calls the Loop1 macro while the

Repeat Expression parameter of the RunMacro action is true.

Do... Loop While <Condition> and Do... Loop Until <Condition>

-------------------------------------------------------------

   Macro Name       Action

   -------------------------

   Do_Loop1         RunMacro

                    RunMacro

   Loop1            MsgBox

   Do_Loop1 Actions

   ----------------

   RunMacro

      MacroName: Do_Loops.Loop1

   RunMacro

      MacroName: Do_Loops.Loop1

      Repeat Expression: <your_condition>

   Loop1 Actions

   -------------

   MsgBox

      Message: ="Loop"

In this example, the Do_Loop1 macro calls the Loop1 macro once

unconditionally, then continues to call the Loop1 macro while the

Repeat Expression parameter of the RunMacro action is True.

Conditions

----------

The condition used in the loop, which is supplied in the Repeat

Expression parameter of the RunMacro action, can be based on a value

in a field on a form, a property of a control on a form, or the value

returned from a Microsoft Access Basic function. If the condition is

based on a field in a form or a property of a control on a form, it

will have syntax similar to:

   Forms![CounterForm]![Counter]<=10

   -or-

   Forms![EntryForm]![InvoiceNo].Visible=True

If the condition is based on the value returned from a Access Basic

function, it will have syntax similar to:

   Time()>=TimeEntry()

Do While Loops vs. Do Until Loops

---------------------------------

Whether a loop is a Do While loop or a Do Until loop depends on the

condition. The RunMacro action runs the macro until the condition in

the Repeat Expression parameter is false. This behavior is exactly

what is needed for a Do While loop. It is, however, the opposite of

what is needed for a Do Until loop. Therefore, to make a condition for

a Do Until loop work correctly, precede the condition in the RunMacro

action with the Not operator.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 316-317 and

412-414

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: McrCond


INF: How to Create For Next Loops In a Macro

Article ID: Q90815

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To perform a For Next loop in a Microsoft Access macro, you need to

use a combination of correct macro structure and the RunMacro action

with appropriate information supplied in either the Repeat Count or

Repeat Expression parameters.

To enhance your macro, you can use a different macro structure and

include a call to an Access Basic function that maintains a

counter, or use the SetValue macro action to maintain and update a

counter value in a text box on a hidden form. The benefit of

maintaining a counter is that you can use the value of the counter in

your macro processing just as in a Access Basic For Next loop.

MORE INFORMATION

================

To perform a For Next loop in a macro, you would use a macro similar

to the following examples. To create the following sample macros, open

a new macro and choose Macro Names from the View menu. Add the

following macro names and actions, then save this macro group as

"For_Next_Loops".

For Next Loop Using Repeat Count

--------------------------------

   Macro Name       Action

   -------------------------

   For_Next_Loop1   RunMacro

   Loop1            MsgBox

   For_Next_Loop1 Actions

   ----------------------------------

   RunMacro

      MacroName: For_Next_Loops.Loop1

      Repeat Count: 10

   Loop1 Actions

   -------------------

   MsgBox

      Message: ="Loop"

In this example, the For_Next_Loop1 macro calls the Loop1 macro 10

times. The number of times the macro is called is specified in the

Repeat Count parameter of the RunMacro action.

The limitation of this example is that a counter value is not

available to indicate which instance of the loop is being executed. As

a result, there is no way to tell if this is the first, fifth, or

tenth time the loop is being executed.

For Next Loop That Maintains a Counter in a Text Box on a Form

--------------------------------------------------------------

   Macro Name       Action

   -------------------------

   For_Next_Loop2   SetValue

                    RunMacro

   Loop3            MsgBox

                    SetValue

   For_Next_Loop2 Actions

   ----------------------

   SetValue

      Item: Forms![CounterForm]![Counter]

      Expression: 1

   RunMacro

      MacroName: For_Next_Loops.Loop2

      Repeat Expression: Forms![CounterForm]![Counter]<=10

   Loop2 Actions

   -------------------

   MsgBox

      Message: ="Loop Count: " & Forms![CounterForm]![Counter]

   SetValue

      Item: Forms![CounterForm]![Counter]

      Expression: Forms![CounterForm]![Counter]+1

In this example, the For_Next_Loop2 macro uses the SetValue macro

action to initialize (set to a value of 1) a counter in a text box

called Counter on a form called CounterForm. It then runs the Loop2

macro until the Repeat Expression parameter evaluates to false. In

this example, the loop executes 10 times. The Loop2 macro displays a

message box that indicates which instance of the loop is being

executed by referring to the counter value in the Counter text box.

The Loop2 macro then increments the counter (adds 1 to the current

counter value) by using the SetValue macro action.

The benefit of this example is that a counter value is available to

indicate which instance of the loop is being executed. The drawback to

this example is that it depends on a form that must be created and

opened prior to the execution of the loop. The form can be hidden or

visible, but it must be open for this example to work.

For Next Loop Using Access Basic Function to Maintain a Counter

---------------------------------------------------------------

   Macro Name       Action

   -------------------------

   For_Next_Loop3   RunCode

                    RunMacro

   Loop3            MsgBox

                    RunCode

   For_Next_Loop3 Actions

   ----------------------

   RunCode

      Function Name: =LoopCount(1)

   RunMacro

      MacroName: For_Next_Loops.Loop3

      Repeat Expression: LoopCount(3)<=10

   Loop3 Actions

   -------------------

   MsgBox

      Message: ="Loop Count: " & LoopCount(3)

   RunCode

      Function Name: =LoopCount(2)

In this example, the For_Next_Loop3 macro runs the LoopCount(1)

function by using the RunCode macro action. This causes the function

to initialize the counter to a value of 1. It then runs the Loop2

macro using the RunMacro action until the Repeat Expression parameter

is false. LoopCount(3), which is used in the conditional expression,

returns the current value of the counter. Therefore, when the counter

reaches 11, the loop has executed 10 times, and when the RunMacro

action checks the condition, it evaluates to false and will not call

the Loop3 macro again. The Loop3 macro displays a message box that

indicates which instance of the loop is being executed by referring to

the counter value returned by the LoopCount(3) function call. The

Loop3 macro then increments the counter using the RunCode macro

action, which calls the function LoopCount(2).

The benefits of this example are that a counter is available that

indicates which instance of the loop is being executed and you do not

need to create and open a form with a control on it to contain the

counter value. The drawback to this example is that you need to create

the LoopCount() Access Basic function prior to using this

example; however, after you create the function it is available

anywhere in Microsoft Access.

The Access Basic function procedure LoopCount() returns the

current value of a counter that the function declares and maintains.

Depending on which parameter is passed (1, 2, or any other number),

LoopCount() will initialize, increment, or return the counter's

current value. Below is the Access Basic code for the LoopCount()

function procedure.

   Function LoopCount (Action)

      Static LoopCounter             ' Static variable to hold counter

      If Action = 1 Then             ' Initialize counter

         LoopCounter = 0

      ElseIf Action = 2 Then         ' Increment counter

         LoopCounter = LoopCounter + 1

      End If

      LoopCount = LoopCounter        ' Return value

   End Function

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, chapter 3,

pages 6-7 and 10-11

Microsoft Access "Language Reference," version 1.0, pages 246-248,

316-317, 412-414, and 437-438

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: McrOthr


INF: How to Create Synchronized Combo Boxes

Article ID: Q98660

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a combo box that is filtered to list

only items that are related to an item selected in a prior combo box.

MORE INFORMATION

================

In the following example, the first combo box lists the category names

from the Categories table, and the second combo box lists the product

names from the Products table. When you select a category name in the

first combo box, the second combo box is filtered to list only the

product names for that category:

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Categories table, and then

   save it as Categories Lister:

      Query: Categories Lister

      -------------------------

      Field name: Category ID

         Show: Yes

      Field name: Category Name

         Show: Yes

         Sort: Ascending

3. Create the following new query based on the Products table, and then

   save it as Products Lister:

   NOTE: In the following sample query, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this query.

      Query: Products Lister

      -----------------------------------------------------------

      Field name: Product ID

         Show: Yes

      Field name: Product Name

         Show: Yes

         Sort: Ascending

      Field name: Category ID

         Show: Yes

         Sort: Ascending

         Criteria: IIF(IsNull([Forms]![Selector Form]![Category _

                   Selection]),[Category ID],[Forms]![Selector _

                   Form]![Category Selection])

   Note that using the IIf() and IsNull() functions in this query lets

   you see a list of all the products if no category is selected.

4. Create the following new macro, and then save it as Reset Product

   Selection:

      Macro Name                 Action        Argument

      ----------------------------------------------------------

      Reset Product Selection    Requery       Product Selection

                                 GoToControl   Product Selection

5. Create the following new unbound form, and then save it as Selector

   Form:

      Object: Combo Box

      ----------------------------------------

         ControlName: Category Selection

         RowSourceType: Table/Query

         RowSource: Categories Lister

         ColumnCount: 2

         ColumnWidths: 0 in;1 in

         BoundColumn: 1

         After Update: Reset Product Selection

      Object: Combo Box

      ---------------------------------

         ControlName: Product Selection

         RowSourceType: Table/Query

         RowSource: Products Lister

         ColumnCount: 3

         ColumnWidths: 0 in;1 in; 0 in

         BoundColumn: 1

6. View the form in Form view. In the Category Selection box, select

   a category and note that the Product Selection box lists only the

   products for that category.

7. In the Category Selection box, select a different category. Note that

   the Product Selection box is reset and lists the appropriate products

   for the new category.

REFERENCES

==========

For more information on requerying, search for "requery" then "Requery

Action" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 1.0, pages 237 and 541

You can find information, instructions, and examples in the Solutions

sample application (SOLUTION.MDB) included with Microsoft Access version

2.0. For more information about how to list only items that are related to

an item selected in a prior combo box, open the SOLUTION.MDB database

usually located in the ACCESS\SAMPAPPS directory. Select Get More Mileage

From Combo Boxes, List Boxes, Subforms, And Subreports in the Select A

Category Of Examples box, then select Limit The Contents Of One List Based

On The Value Selected In Another in the Select An Example box.

Additional reference words: 1.00 1.10 2.00 combobox parameter listbox

KBCategory:

KBSubcategory: FmsCmbo


INF: How to Create Tasks in MS Project for Windows Using DDE

Article ID: Q103273

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Before data can be sent to Microsoft Project version 3.0 for Windows,

a task must exist in the active project. This article contains sample

code to start Project, create 10 tasks, and fill the task fields with

data.

MORE INFORMATION

================

This article assumes that the user has some knowledge of Access Basic

and is intended as a demonstration of the technique required to create

a task in Project. The following function is not intended to

be replicated exactly.

1. Create a new module in a Microsoft Access database. Add the

   following statement to the Declarations section of the module:

   '------------------------------------------------------------------

   'Declarations Section

   '------------------------------------------------------------------

   Option Explicit

2. Add the following function to the module:

   NOTE: In the following sample code, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this code in Access Basic.

'---------------------------------------------------------------------

'Start of Function

'---------------------------------------------------------------------

Function dde_createtasks (ProjectPath)

   Const DDE_ERROR = 282   'Define DDE return error.

   Dim Temp, Mynum, Chan1, Chan2 'Define variables.

   On Error GoTo StartUp  'If Project is not open, start it.

   Chan1 = DDEInitiate("winproj", "system")

   'Initiate a channel to Project.

   On Error GoTo QuitNow:

   Chan2 = DDEInitiate("winproj", DDERequest(Chan1, "ActiveProject"))

   'Initiate a channel to the active Project.

   For Mynum = 1 To 10

      DDEExecute Chan2, "EditGoto .ID=[" & Mynum & "]"

      'Go to the task.

      DDEExecute Chan2, "SetField .Field=[Name] .Value=MyNewTask" &_

         Mynum & " .Create=[Yes]"

      'Create a new task.

      DDEPoke Chan2, "T((" & Mynum & "),(Name,Duration))", "Task_

         Number " & Mynum & Chr(9) & Mynum & "d"

      'Send information to Project.

   Next

   DDETerminateAll 'Terminate the DDE channel.

   Exit Function

   QuitNow:

      DDETerminateAll  'Terminate the DDE channel.

      Exit Function

   StartUp:

      If Err = DDE_ERROR Then

         Temp = Shell(ProjectPath, 6)  'Start Project.

         Resume    ' Re-execute DDEInitiate() function.

      End If

End Function

'---------------------------------------------------------------------

'End of Function

'---------------------------------------------------------------------

3. To test this function, type the following in the Immediate window

      ?dde_createtasks ("<c:\winproj\winproj.exe>")

   where "<c:\winproj\winproj.exe>" is the path to Project.

Project installs two files, MACRO.WRI and DDEINFO.WRI, in the program

directory that contain more information about macro commands and

dynamic data exchange (DDE) functionality. These files can be opened

in Microsoft Windows Write.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 9,

"Dynamic Data Exchange"

Additional reference words: 1.00 1.10 2.00 dde

KBCategory:

KBSubcategory: IntpOthr


INF: How to Create, Debug, and Use a Microsoft Access Library

Article ID: Q88175

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a Microsoft Access library and discusses

how to create and debug a library, as well as some things to

watch out for.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

Access Basic Library Definition

-------------------------------

When you write a Microsoft Access application, such as the sample database

NWIND.MDB, the application works only within the database in which it was

created. This is satisfactory for many applications that specifically use

the data that resides in the application's database.

However, many Microsoft Access developers write generic applications,

programs, and utilities that are designed to work on any user database. An

example of this is Wizards. Wizards are Access Basic programs that reside

in their own database, but are available to the user in any database the

user has open. If this were not the case, you could not use a Wizard

outside of the database that the Wizard program and system objects reside

in. In order to make a program (such as a Wizard) so that its code and

objects are available to any user database, you must load the database

containing the program and its objects as a library.

To load a database as a library, you must open the .INI file (MSACCESS.INI

in Microsoft Access version 1.x, MSACC20.INI in version 2.0) and add an

line to the Libraries section. When you open the .INI file initially, you

will probably see a Libraries section with an entry for the Wizards

library:

   [Libraries]

   wizard.mda=ro

NOTE: If there is no Libraries section, add it to the end of the file

and continue. The .INI file can be found in your Windows directory.

The "ro" in the Wizard entry means that the library is read-only. If you

have an application that uses its own tables that are to be written to at

any point in your program, you would specify "rw" rather than "ro." For

example, to add an application called STOCKAPP.MDB that uses its own tables

that can be modified, add the following line to the .INI file:

   stockapp.mdb=rw

The complete [Libraries] section might look like:

   [Libraries]

   wizard.mda=ro

   stockapp.mdb=rw

Given these library entries, the WIZARD.MDA library will be loaded

read-only, and the STOCKAPP.MDB library will be loaded as read-write.

After restarting Microsoft Access you would be able to open an Immediate

window in a user database and invoke sub and function procedures from

STOCKAPP.MDB, or open tables, queries, forms, or reports with DoCmd

commands. Even though you can access the code and database objects from

STOCKAPP.MDB, you cannot see them in the Database window.

Note that when a database is loaded as a library, it cannot be opened

as a user database.

Writing and Debugging Access Basic Library Code

-----------------------------------------------

When you write an Access Basic application for use as a library, you

are doing little more than writing the application in a user database

with the intention of using it as a library at a later point. Because

of this, a rule of thumb is to make sure the application works

completely before trying to use it as a library.

Although this rule of thumb is enough to successfully create many

types of library applications, there are some important pitfalls to

watch for when writing a library application, even if the application

works perfectly as a user database.

Debugging an Error in a Library Database

----------------------------------------

Microsoft Access version 1.x:

If the library database generates an error that only occurs while it

is a library, it can be very difficult to locate. An error might occur

that gives you some idea of the general area of the problem, but there

may be little or no indication of the offending line. Because you

cannot set and use breakpoints and stepping in library applications,

you should design error traps that convey meaningful messages and

indicate the location of the problem.

Another debugging tip is to place message boxes at milestone areas of the

code so that you always have an idea of which code is being executed.

Microsoft Access version 2.0:

Add the following line to the [Options] section of the MSACC20.INI file. If

the [Options] section does not exist, add it to the bottom of the file.

   DebugLibraries=True

The completed section might look like:

   [Options]

   DebugLibraries=True

This enables the code debugger to appear when a run-time error occurs in a

library module. You can also get to the library code using the View

Procedures command when you are in a module's Design view. Note that this

will tend to reduce performance because all the library code will have to

be recompiled. Remove this option when the code debugger is not necessary.

CodeDB() Versus CurrentDB()

---------------------------

Access Basic includes the CodeDB() function for opening library

databases. CodeDB() works identically to CurrentDB() if you are

running the application as a user database. However, if you are

running the application as a library, CodeDB() returns the database

object for the library database from which it was called, while

CurrentDB() returns the database object from the current open user

database. Because of this, it is easy to confuse one for the other.

Domain Functions

----------------

Domain functions should be used with caution in library modules as

they can only process user tables and not library tables.

Macros in a Library

-------------------

Microsoft Access version 1.x:

Of all the objects you can create in a Microsoft Access database,

macros are the only type of object you cannot use in a library

application. The most obvious problem this presents is that forms

require the use of macros in order to have menus. Because of this

limitation, you must make sure to use only Access Basic code for

programming.

Microsoft Access version 2.0:

In Microsoft Access 2.0, you can call a macro from a Library database.

However, due to lack of error handling, they should be avoided except

for implementing custom menus.

Keys May Be Redefined in User Database

--------------------------------------

Since the user database may contain an AutoKeys macro to redefine the

meaning of keys, you should use caution when using SendKeys in your

Library application. Use other macro actions where appropriate

and use hot-keys and {tab} rather than arrow keys when manipulating

a dialog box.

USysAddIns Table

----------------

The Microsoft Access 2.0 Add-In Manager will process entries in the

USysAddIns table of a library database to update the MSACC20.INI

[Libraries] and [Menu Add-Ins] sections. This makes installing and

uninstalling libraries more manageable for users. See Chapter 15 of the

Microsoft Access "Building Applications" manual for more information.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: MdlLib


INF: How to Declare C++ Functions Called from Access Basic

Article ID: Q109338

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

The following steps describe how to call C++ dynamic-link library (DLL)

functions in Access Basic:

1. Make sure to define the functions within your C++ code with the

   "extern" declaration. The following example demonstrates the syntax for

   the extern declaration:

      extern "C" {return type} FAR PASCAL  __export {function name}

         ({parameters})

   An example of an actual declaration in your C++ code might look

   like:

      extern "C" int FAR PASCAL __export my_func ()

   To call the sample function above you would define the Declare

   statement as follows:

      Declare Function my_func Lib "MYLIB.DLL" () As Integer

2. Make sure that the declaration is not set for case-sensitive

   exports.

REFERENCES

==========

For more information on calling DLLs, search on "declare external

procedures" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 Programming

KBCategory:

KBSubcategory: PgmApi


INF: How to Delete Duplicate Records from a Table

Article ID: Q109329

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to remove duplicate records from a table using

primary keys. This is particularly useful for tables with more than 10

fields, where it is not possible to use the Group By function in queries.

MORE INFORMATION

================

The following example demonstrates how to remove duplicate records from a

table:

1. Make a copy of the table from which you want to remove the duplicate

   records. To copy a table, select the table in the Database window and

   then choose Copy from the Edit menu. Then choose Paste from the Edit

   menu. Enter a new name for the table and select the Structure Only

   option. Choose OK.

2. Open the new table in Design view and select the field(s) which you

   want to check for duplicates. To make your selection the primary key

   for the table press the Primary Key button or choose Set Primary Key

   from the Edit menu.

3. Save and then close the table.

4. Create an append query and append the data from the original table into

   the new table. Because the primary key fields in the new table will not

   permit duplicates, the error message

      Errors were continued...Proceed anyway?

   will occur when you run the append query. Choose OK. The new table

   will contain the data from the original table, but without duplicates.

NOTE: A fast way to remove duplicates from small tables is to skip the

append query, and instead Edit and Paste the table a second time. This

time, select Append Data To Existing Table. This will result in an error

message similar to the one stated above, and the data from the original

table will be pasted into the new table without the duplicates.

REFERENCES

==========

For more information on deleting duplicate records, query on the

following words here in the Microsoft Knowledge Base:

   query and unique and duplicate and filter

Microsoft Access "User's Guide," Version 1.0, pages 28-29, 32-33, and

174-178

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryMktbl


INF: How to Determine If a Form Exists in a Database

Article ID: Q92825

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses how to obtain a dynaset containing the names of

all the forms in a database whether or not they are active.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

If you want to obtain a complete list of forms whether or not they are

active, you can create a dynaset that queries MSysObjects for all the

forms stored in the current database. MSysObjects stores the names of

every object in a database, and each record includes the type of

object represented by a code and stored in a field called Type. The

code that represents forms in the Type field is -32768. Given this

information, you can create a dynaset that obtains the names of all

the objects in MSysObjects that are forms:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Dim DB As Database, S As Dynaset

   Set DB = CurrentDB()

   Set S = DB.CreateDynaset("SELECT Name FROM MSysObjects _

                                              WHERE Type = -32768;")

After executing the code above, a dynaset called S is created. This

dynaset contains the names of all the forms in the current user database.

You can then process the information as shown in the example below.

The procedure below accepts a form name and opens it if it exists in

the database, or presents a message indicating that it does not exist

in the database:

   Option Explicit

   Sub FormOpener (FormToOpen$)

      Dim DB As Database

      Dim S As Dynaset

      Set DB = CurrentDB()

      Set S = DB.CreateDynaset("SELECT Name FROM MSysObjects _

                    WHERE Type = -32768;")

      S.FindFirst "Name = '" & FormToOpen$ & "'"

      If S.NoMatch Then

         MsgBox FormToOpen$ & " does not exist in this database"

      Else

         DoCmd OpenForm FormToOpen$

      End If

   End Sub

In Microsoft Access version 2.0, you can use the following method that uses

data access objects (DAO):

   Option Explicit

   Sub DAOFormOpener (FormToOpen$)

      Dim mydb As Database, x As Integer

      Set mydb = dbengine(0)(0)

      For x = 0 To dbengine(0)(0).containers("forms").documents.count - 1

        If FormToOpen$ = _

                 dbengine(0)(0).containers("forms").documents(x).name Then

           DoCmd OpenForm FormToOpen$

           Exit Sub

        End If

      Next x

      MsgBox FormToOpen$ & " does not exist in this database."

   End Sub

Additional reference words: 1.00 1.10 2.00 VT

KBCategory:

KBSubcategory: PgmOthr


INF: How to Determine if a Specific Windows Program Is Running

Article ID: Q88167

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

There may be times when you only want one instance of an application to run

under Microsoft Windows. For example, if you place a command button on a

form that starts the Windows Calculator (CALC.EXE) program, the user can

start many instances of Calculator. This is very inefficient use of memory

and system resources. If your program determines if the application is

already running, it can either start the application for the first time, or

bring the existing application to the front.

To determine if a specific program is running, call the Windows application

programming interface (API) function FindWindow(). FindWindow() returns the

handle of the window whose class is given by the lpClassName parameter and

whose window name, or caption, is given by the lpCaption parameter. If the

returned value is zero, the application is not running.

MORE INFORMATION

================

When an application is started from the Program Manager it registers the

class name of the form. The window class provides information about the

name, attributes, and resources required by your form. The Microsoft

Access window has a class name of "OMain." For additional command class

names, see further below.

By calling FindWindow() with a combination of a specific program's class

name and/or the title bar caption, your program can determine whether

that specific program is running.

You can determine the class name of an application by using SPY.EXE,

which is supplied with the Microsoft Windows Software Development Kit

(SDK) version 3.1.

If the window has a caption bar title, you can also use the title to

locate the instance of the running application. This caption text is

valid even when the application is minimized to an icon.

The following example shows three ways to determine if the Windows 3.1

Calculator is running. To create the program, do the following:

 1. From the Program Manager File menu, choose Run and enter CALC.EXE

    to start Calculator.

 2. From the File menu, choose New to create a new database.

 3. From the File menu, choose New, then select Form to create a new

    blank form.

 4. When the form is displayed, from the View menu, choose Toolbox.

 5. Select the command button tool on the toolbar, then double-click

    the form to place a command button on the form.

 6. From the View menu, choose Properties to display the Properties

    window. Set the following command button property:

       Property       Value

       ------------------------------

       On Push        =CalculatorUp()

    NOTE: In Microsoft Access version 2.0, the OnPush property has

    become the OnClick property.

 7. Close and save the form as "FindWindow Form."

 8. From within the Database window, open a new module and

    enter the sample Access Basic code below:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

'=====================================================================

'Declarations section

'=====================================================================

Option Explicit

Declare Function FindWindow% Lib "user" (_

                       ByVal lpClassName As Any,_

                       ByVal lpCaption As Any)

'=====================================================================

'End of Declarations section

'=====================================================================

'=====================================================================

'Code section

'=====================================================================

Function CalculatorUp ()

   Const lpClassName = "SciCalc"

   Const lpCaption = "Calculator"

   'This demonstrates three different ways to call FindWindow:

      '1. The ClassName only.

      '2. The Caption only.

      '3. Both the ClassName and the Caption

   MsgBox "Calculator Handle = " & FindWindow(lpClassName, 0&)

   MsgBox "Calculator Handle = " & FindWindow(0&, lpCaption)

   MsgBox "Calculator Handle = " & FindWindow(lpClassName, lpCaption)

   'This function could return the existence of a window.

   CalculatorUp = FindWindow(lpClassName, 0&)

End Function

'=====================================================================

'End of code section

'=====================================================================

 9. Close and save the module as "FindWindow Code."

10. From within the Database window, open the FindWindow Form. Choose

    the FindWindow Form command button with CALC.EXE running and

    without CALC.EXE running. If CALC.EXE is running, your application

    will print an arbitrary handle. If CALC.EXE is not running, your

    application will print the number zero as a handle.

Below are some class names of common applications that are shipped

with Windows:

   Class Name         Application

   ------------------------------

   OMain              ACCESS.EXE

   SciCalc            CALC.EXE

   CalWndMain         CALENDAR.EXE

   Cardfile           CARDFILE.EXE

   Clipboard          CLIPBOARD.EXE

   Clock              CLOCK.EXE

   CtlPanelClass      CONTROL.EXE

   XLMain             EXCEL.EXE

   Session            MS-DOS.EXE

   Notepad            NOTE.EXE

   pbParent           PBRUSH.EXE

   Pif                PIFEDIT.EXE

   PrintManager       PRINTMAN.EXE

   Progman            PROGMAN.EXE   (Windows Program Manager)

   Recorder           RECORDER.EXE

   Reversi            REVERSI.EXE

   #32770             SETUP.EXE

   Solitaire          SOL.EXE

   Terminal           TERMINAL.EXE

   WFS_Frame          WINFILE.EXE

   MW_WINHELP         WINHELP.EXE

   #32770             WINVER.EXE

   OpusApp            WINWORD.EXE

   MSWRITE_MENU       WRITE.EXE

REFERENCES

==========

"Programming Windows: the Microsoft Guide to Writing Applications for

Windows 3," by Charles Petzold, Microsoft Press, 1990

"Peter Norton's Windows 3.0 Power Programming Techniques," by Peter

Norton and Paul Yao, Bantam Computer Books, 1990

Microsoft Windows 3.0 Software Development Kit "Reference Volume 1"

Additional reference words: 1.00 1.10 2.00 WinIss windows api

KBCategory:

KBSubcategory: PgmApi


INF: How to Determine If a Table or Query Exists

Article ID: Q113549

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined function, IsTableQuery(), that

you can use to determine whether a table or query exists in a database. The

sample function uses the TableDefs and QueryDefs data access objects (DAO)

collections.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

MORE INFORMATION

================

The following example demonstrates how to use the sample user-defined

function IsTableQuery() to determine whether a table or query exists in a

database:

1. Open the sample database NWIND.MDB.

2. Create a new module and add the following line to the module's

   Declarations section:

      Option Explicit

3. Enter the following function in the module:

      '********************************************************

      ' FUNCTION: IsTableQuery()

      '

      ' PURPOSE: Determine if a table or query exists.

      '

      ' ARGUMENTS:

      '   DbName: The name of the database. If the database name

      '           is "" the current database is used.

      '    TName: The name of a table or query.

      '

      ' RETURNS: True (it exists) or False (it does not exist).

      '

      '********************************************************

      Function IsTableQuery (DbName As String, TName As String) As Integer

         Dim Db As Database, Found As Integer, Test As String

         Const NAME_NOT_IN_COLLECTION = 3265

         ' Assume the table or query does exist.

         Found = False

         ' Trap for any errors.

         On Error Resume Next

         ' If the database name is empty...

         If Trim$(DbName) = "" Then

            ' ...then set Db to the current Db.

            Set Db = DBEngine.Workspaces(0).Databases(0)

         Else

            ' Otherwise, set Db to the specified open database.

            Set Db = DBEngine.Workspaces(0).OpenDatabase(DbName)

            ' See if an error occurred.

            If Err Then

               MsgBox "Could not find opened database " & DbName

               IsTableQuery = False

               Exit Function

            End If

         End If

         ' See if the name is in the Tables collection.

         Test = Db.TableDefs(TName).Name

         If Err <> NAME_NOT_IN_COLLECTION Then Found = True

         ' Reset the error variable.

         Err = 0

         ' See if the name is in the Queries collection.

         Test = Db.QueryDefs(TName$).name

         If Err <> NAME_NOT_IN_COLLECTION Then Found = True

         DB.Close

         IsTableQuery = Found

      End Function

4. From the View menu, choose Immediate Window.

5. Type the following line in the Immediate window, and then press ENTER:

      If IsTableQuery("","Orders") = True Then Print "Found it!"

6. Try using other valid database names, and other table and query

   names, in the line above.

REFERENCES

==========

For more information about the TableDefs and QueryDefs collections, search

for "TableDefs" and "QueryDefs" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Determine If Current Database Is Open Exclusively

Article ID: Q117539

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use Access Basic to determine if the current

database is open exclusively in Microsoft Access version 2.0.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

MORE INFORMATION

================

When a database is open exclusively, no other process or program can access

the database's .MDB file. When a database is open nonexclusively, other

processes can get shared access to the .MDB file. This article describes

how to use the Open statement in Access Basic to determine if the database

is open exclusively.

The Open statement's Shared argument lets you attempt to access a file in

shared mode. If that file is the current database, and it is open

exclusively, a "Permission denied" error message will occur. No error

message will occur if the database is open nonexclusively, or shared. You

can trap for this error to determine in what mode the database is open.

The following sample function demonstrates how to use the Open statement to

determine in what mode the current database is open. This function is most

useful to Access Basic programmers who want to warn users that the database

being opened is in the wrong mode:

1. Open the sample database NWIND.MDB exclusively.

2. Create a new module and enter the following line in the declarations

   section:

      Option Explicit

3. Enter the following function in the module:

      Function IsCurDBExclusive20 () As Integer

      '   Purpose: Determine if the current database is exclusive.

      '   Returns: 0 if database is not open exclusively.

      '            -1 if database is open exclusively.

      '            Err if any error condition is detected.

        Dim db As Database

        Dim hFile As Integer

        hFile = FreeFile

        Set db = dbengine.workspaces(0).databases(0)

        If Dir$(db.name) <> "" Then

          On Error Resume Next

            Open db.name For Binary Access Read Write Shared As hFile

              Select Case Err

                Case 0

                  IsCurDBExclusive20 = False

                Case 70

                  IsCurDBExclusive20 = True

                Case Else

                  IsCurDBExclusive20 = Err

              End Select

            Close hFile

          On Error GoTo 0

        Else

          MsgBox "Couldn't find " & db.name & "."

        End If

      End Function

4. From the View menu, choose Immediate Window.

5. Type the following line in the Immediate window, then press ENTER:

      If IsCurDBExclusive20()=True Then Msgbox "It's Exclusive!"

   The message "It's Exclusive!" should appear.

6. Try opening the database nonexclusively and then repeating step 5. The

   message box should not appear.

REFERENCES

==========

For more information about the Open statement, search for "Open" then "Open

Statement" using the Microsoft Access Help menu.

Additional reference words: 2.00 multi-user errmsg

KBCategory:

KBSubcategory: GnlMu


INF: How to Determine Number of Working Days Between Two Dates

Article ID: Q97757

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to calculate the number of working days

between two dates.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

There is no function in Microsoft Access to determine the number of working

days between two given dates. To determine this, you need to call a user-

defined Access Basic function. Note that the function below includes the

start date and the end date, so the number of days between 02/02/93 and

02/03/93 equals one. The code for the sample function Work_Days() is below.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Option Explicit

   Function Work_Days (BegDate As Variant, EndDate As Variant) As Integer

   ' Note that this function does not account for holidays.

      Dim WholeWeeks As Variant

      Dim DateCnt As Variant

      Dim EndDays As Integer

      BegDate = DateValue(BegDate)

      EndDate = DateValue(EndDate)

      WholeWeeks = DateDiff("w", BegDate, EndDate)

      DateCnt = DateAdd("ww", WholeWeeks, BegDate)

      EndDays = 0

      Do While DateCnt < EndDate

         If Format(DateCnt, "ddd") <> "Sun" And _

                          Format(DateCnt, "ddd") <> "Sat" Then

            EndDays = EndDays + 1

         End If

         DateCnt = DateAdd("d", 1, DateCnt)

      Loop

      Work_Days = WholeWeeks * 5 + EndDays

   End Function

To call the function, you can pass either a valid string or an actual

date value. The following are two ways to call this function from the

Immediate window:

   ?Work_Days("01/01/93", "12/31/96") (returns 1043)

   ?Work_Days(#03/05/93#, #04/06/93#) (returns 23)

Additional reference words: 1.00 1.10 2.00 modules Day/Time

KBCategory:

KBSubcategory: PgmOthr


INF: How to Determine the Current Screen Resolution (Size)

Article ID: Q113458

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function that you

can use to determine the current screen resolution. This function is useful

in determining if you are running in standard VGA mode (640 x 480) or Super

VGA mode (800 x 600 or 1024 x 768).

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The example below demonstrates how to create and use the sample

GetScreenResolution() function.

Notes:

 - You may have some Microsoft Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code.

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscores when re-creating this

   code in Access Basic.

 - In Microsoft Access version 2.0, you can create code in a form module.

   Code in a form module is restricted to that form. The Type statement

   used in this example must be global. You can use this code in a form's

   module if the Type statement is in the Declarations section of a global

   Access Basic module. For more information about the Type statement,

   search for "type" then "Type Statement" using the Microsoft Access Help

   menu.

1. Create a new Access Basic module, and enter the following Declarations

   and function:

      ' *****************************************************************

      ' DECLARATIONS SECTION

      Option Explicit

      Type RECT

          x1 As Integer

          y1 As Integer

          x2 As Integer

          y2 As Integer

      End Type

      Declare Function GetDesktopWindow Lib "User" () As Integer

      Declare Function GetWindowRect Lib "User" _

         (ByVal hWnd As Integer, rectangle As RECT) As Integer

      ' *****************************************************************

      ' FUNCTION: GetScreenResolution()

      '

      ' PURPOSE:

      '   To determine the current screen size or resolution.

      '

      ' RETURN:

      '   The current screen resolution. Typically one of the following:

      '      640 x 480

      '      800 x 600

      '      1024 x 768

      ' *****************************************************************

      Function GetScreenResolution () as String

          Dim R As RECT

          Dim hWnd As Integer

          Dim RetVal As Integer

          hWnd = GetDesktopWindow()

          RetVal = GetWindowRect(hWnd, R)

          GetScreenResolution = (R.x2 - R.x1) & "x" & (R.y2 - R.y1)

      End Function

2. From the View menu, choose Immediate Window.

3. Type the following in the Immediate window, and then press ENTER:

      ? GetScreenResolution()

The current screen resolution will be displayed in the Immediate window. If

the current resolution is standard VGA, the following will be displayed in

the Immediate window:

   640x480

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: How to Determine Version of INSTCAT.SQL File on Server

Article ID: Q100467

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Using the SQL Server ODBC driver with Microsoft Access requires that

you run the INSTCAT.SQL file on the ODBC installation disks. This

article describes the SQL stored procedure that you can use to query

for the version number of the INSTCAT.SQL file that was run against

the SQL Server computer.

MORE INFORMATION

================

The following syntax can be executed in a pass-through query in Microsoft

Access version 2.0, as well as in the Query window of SQL Server

Administration Facility (SAF) for MS-DOS, OS/2, Microsoft Windows or any

other operating system in which you can execute a stored procedure:

   sp_server_info 500

The attribute_value field of the returned row contains the version

number. If an empty recordset is returned, it is likely that the

INSTCAT.SQL file was not run on the server. The result will resemble

the following:

   attribute_id   attribute_name      attribute_value

   --------------------------------------------------

   500            SYS_SPROC_VERSION   01.00.2101

OS/2 is manufactured by International Business Machines Corporation, a

vendor independent of Microsoft; we make no warranty, implied or

otherwise, regarding this product's performance or reliability.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: How to Dial a Phone Number in Microsoft Access

Article ID: Q93696

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function,

DialNumber(), that you can use to dial a telephone number from Microsoft

Access using your computer's modem. This method uses Microsoft Windows

application programming interface (API) function calls.

Although this function will work with Microsoft Access version 2.0, version

2.0 has a new AutoDialer feature that can be used for dialing telephone

numbers. For more information about the AutoDialer feature, search for

"AutoDialer" using the Microsoft Access 2.0 Help menu.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

To dial a phone number in Microsoft Access, you can use Microsoft Windows

API calls in the dynamic-link library (DLL) USER.EXE. There are 17

communication API calls available in USER.EXE, but only the following 3 are

used to dial a phone number: OpenComm(), CloseComm(), and WriteComm().

The following steps demonstrate how to create and use the DialNumber()

function.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

1. Open the sample database NWIND.MDB.

2. Create a new Access Basic module with the following in the Declarations

   section:

      Option Explicit

      ' The number of seconds to wait for the modem to dial before

      ' .. resetting the modem. If the phone hangs up prematurely

      ' .. try increasing this value by small increments.

      Const WAITSECONDS = 4

      Declare Function OpenComm Lib "User" (ByVal lpComName$, _

         ByVal wInQueue%, ByVal wOutQueue%) As Integer

      Declare Function CloseComm Lib "User" (ByVal nCid%) As Integer

      Declare Function WriteComm Lib "User" (ByVal nCid%, _

         ByVal lpBuf$, ByVal nSize%) As Integer

      Const ID_CANCEL = 2

      Const MB_OKCANCEL = 1

      Const MB_ICONSTOP = 16, MB_ICONINFORMATION = 64

3. Add the following function to the module:

      ' ***********************************************************

      ' FUNCTION: DialNumber()

      '

      ' PURPOSE: To dial a telephone number using the computer's modem

      '

      ' ARGUMENTS:

      '    PhoneNumber: The telephone number to dial

      '

      '    CommPort: The communications port the modem is connected

      '              to. Typically, modems are found on COM2, however,

      '              they can be configured for any COM port.

      '

      ' EXAMPLE:

      '    Type the following in the Immediate window using a modem

      '    connected to the COM2 port:

      '

      '       ? DialNumber("555-1212", "COM2")

      '

      ' ***********************************************************

      Function DialNumber (PhoneNumber, CommPort As String)

         Dim Msg As String, MsgBoxType As Integer, MsgBoxTitle As String

         Dim ModemCommand As String

         Dim OpenPort As Integer

         Dim RetVal As Integer

         Dim StartTime

         Dim CR As String: CR = Chr$(13)

         Dim LF As String: LF = Chr$(10)

         ' Ask the user to pick up the phone

         Msg = "Please pickup the phone and choose OK to dial " _

            & PhoneNumber

         MsgBoxType = MB_ICONINFORMATION + MB_OKCANCEL

         MsgBoxTitle = "Dial Number"

         If MsgBox(Msg, MsgBoxType, MsgBoxTitle) = ID_CANCEL Then

            Exit Function

         End If

         ' Open the communications port

         OpenPort = OpenComm(CommPort, 1024, 128)

         If OpenPort < 0 Then

            Msg = "Unable to open communication port " & CommPort

            GoTo Err_DialNumber

         End If

         ' Send the telephone number to the modem

         ModemCommand = "ATDT" & PhoneNumber & CR & LF

         If WriteComm(OpenPort, ModemCommand, Len(ModemCommand)) < 0 Then

            Msg = "Unable to dial number " & PhoneNumber

            GoTo Err_DialNumber

         End If

         ' Wait WAITSECONDS seconds for the phone to dial

         StartTime = Timer

         While Timer < StartTime + WAITSECONDS

            DoEvents

         Wend

         ' Reset the modem and take it off line

         ModemCommand = "ATH0" & CR & LF

         RetVal = WriteComm(OpenPort, ModemCommand, Len(ModemCommand))

         ' Close the communications port

         RetVal = CloseComm(OpenPort)

         Exit Function

      Err_DialNumber:      'This is not an On Error routine

         Msg = Msg & CR & CR & "Make sure no other devices are using _

            communication port " & CommPort

         MsgBoxType = MB_ICONSTOP

         MsgBoxTitle = "Dial Number Error"

         MsgBox Msg, MsgBoxType, MsgBoxTitle

      End Function

4. Open the Employees form in Design view.

5. Place a command button with the following properties on the form, next

   to the Home Phone field.

      Microsoft Access 1.x:

         ControlName: btnDialPhone

         Caption: Dial

         OnPush: =DialNumber([Home Phone], "COM2")

      Microsoft Access 2.0:

         Name: btnDialPhone

         Caption: Dial

         OnClick: =DialNumber([Home Phone], "COM2")

6. View the form in Form view. To dial an employee's home phone number,

   choose the Dial button.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: How to Dim (Gray) Menu Items with Access Basic

Article ID: Q88940

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Access Basic does not have a command that allows you to dim (make

unavailable) a menu item. There are also no properties associated with

a form that enable you to set this menu characteristic.

To change such characteristics of a menu item, you can use Windows

application programming interface (API) functions.

NOTE: This will only work for custom menus created with macros. It

will not work for the default Microsoft Access menus. This technique

will also not work for custom menu items created with the DoMenuItem

action. For example, if you add a command to the menu with the

DoMenuItem action and specify the PrintPreview arguments for the

action, Microsoft Access overrides any API function that you write to

check or gray this menu command.

MORE INFORMATION

================

The following Windows API function is used to dim a menu item:

EnableMenuItem% (hMenu%, wIDEnableItem%, wEnable%)

--------------------------------------------------

This function enables, disables, or grays a menu item.

   hMenu%         Specifies the menu.

   wIDEnableItem% Specifies the menu item to be checked. The

                  wIDEnableItem% parameter can specify pop-up menu

                  items as well as menu items.

   wEnable%       Specifies the action to take. It can be a

                  combination of MF_DISABLED, MF_ENABLED, and

                  MF_GRAYED. These values can be combined by using

                  the bitwise 'OR' operator.

   Return Value   The return value specifies the previous state of the

                  menu item. The return value is -1 if the menu item

                  does not exist.

Example

-------

The following example designs a menu that dims a menu item:

1. Create a new macro. After adding the following actions and their

   associated properties, save the macro and name it "Menu

   Manipulation Macro." To display the "Macro Name" column, choose the

   Macro Names command from the View menu.

    Macro Name             Action        Function Name

    ----------------------------------------------------------

    GrayItem               RunCode       Gray_Menu_Item(0,0)

    UnGray                 RunCode       UnGray_Menu_Item(0,0)

   When determining the position of a menu command, separator bars

   count as commands. For example, to get to the Import menu

   command on the File menu in the Database window, use the arguments

   0 (for the File menu) and 7 (for the Import command). Positions 3

   and 6 correspond to the separator bars on the File menu.

2. Create a new macro. After adding the action below and its

   associated property, save the macro as "Custom Demo Menu."

   Macro Name             Action        Function Name

   --------------------------------------------------

   Top Level Menu         AddMenu

   [Top Level Menu].AddMenu Action Arguments

   ------------------------------------------

   Menu Name          &Gray

   Menu Macro Name    Menu Manipulation Macro

3. Create a new blank form and display the Properties window of the

   form by choosing the Properties command from the View menu.

4. Set the OnMenu property to "Custom Demo Menu."

5. From the File menu, choose Close to close the form. Save the form

   as "Menu Manipulation Form."

6. Create a new module from the Database window. Within the new

   module, enter the Access Basic code listed further below. Save the

   module as "Menu Manipulation Code."

7. From the Database window, select the Menu Manipulation form and

   then choose the Open button to display the form in Form view. The

   normal Microsoft Access menu disappears and is replaced by the

   custom menu you created in the previous steps.

8. There are two options on the menu. Choose the GrayItem command and

   the command is dimmed (grayed). Choosing the UnGray command

   makes the GrayItem menu command available.

   NOTE: In the following sample code, an underscore _ is used as a

   line continuation character. Remove the underscore when re-creating

   this code in Access Basic.

'********************************************************************

'Declarations section of the module.

'********************************************************************

Option Explicit

Declare Function FindWindow% Lib "user" (ByVal lpClassName_

                    As Any, ByVal lpCaption As Any)

Declare Function GetMenu% Lib "user" (ByVal hWnd%)

Declare Function GetSubMenu% Lib "user" (ByVal hSubMenu%,_

                    ByVal nPos%)

Declare Function EnableMenuItem% Lib "user" (ByVal hMenu%,_

                    ByVal wItem%, ByVal wEnable%)

Declare Function IsZoomed% Lib "User" (ByVal hWnd%)

Const MF_BYPOSITION = &H400

Const MF_GRAYED = &H1

Const MyNull = 0&

Const ClassName = "OMain"

Dim ChWnd%       'handle to the Microsoft Access window.

Dim hMenuTop%    'handle to the Microsoft Access menu.

Dim hSubMenu%    'handle to the pop-up menu

Dim ItemID%      'command ID associated with menu item.

Dim ReturnVal%

'===========================================================

'This function initializes:

'

' - The window handles associated with the Microsoft Access form.

' - The handle to the menu of the specified window.

' - The menu handle of the specified pop-up menu of the window menu.

'

'The variables here are global to the database.

'===========================================================

Sub Get_Menu_Handles (TopLevel%)

   ChWnd% = FindWindow(ClassName, MyNull)

   hMenuTop% = GetMenu(ChWnd%)

   hSubMenu% = GetSubMenu(hMenuTop%, TopLevel%)

End Sub

'===========================================================

'This function dims a menu item. The text of a dimmed

'menu item appears in light gray text on the menu,

'but does not allow the user to select the item either by

'mouse or keypad. The macro action associated with the

'menu item does not execute when the user tries to select

'the menu item.

'===========================================================

Function Gray_Menu_Item (TopLevel%, SubLevel%)

   'If the form is maximized, the system menu is added to the forms

   'menu bar, so increment the actual TopLevel%

   If (IsZoomed(Screen.ActiveForm.hWnd)) Then

      TopLevel% = TopLevel% + 1

   End If

   Call Get_Menu_Handles(TopLevel%)

   Gray_Menu_Item = EnableMenuItem(hSubMenu, SubLevel%,_

                        MF_GRAYED Or MF_BYPOSITION)

End Function

'===========================================================

'This function does not ungray a menu item that also enables

'the menu item so the user can select the item and run the

'macro associated with the menu.

'===========================================================

Function UnGray_Menu_Item% (TopLevel%, SubLevel%)

   'If the form is maximized, the system menu is added to the forms

   'menu bar, so increment the actual TopLevel%

   If (IsZoomed(Screen.ActiveForm.hWnd)) Then

      TopLevel% = TopLevel% + 1

   End If

   Call Get_Menu_Handles(TopLevel%)

   UnGray_Menu_Item = EnableMenuItem(hSubMenu, SubLevel%,_

                          Not MF_GRAYED And MF_BYPOSITION)

End Function

REFERENCES

==========

For more information about the structure of the Microsoft Access menu

system, query on the following words in the Microsoft Knowledge Base:

   menu and system and findwindow and getmenu and getsubmenu

Additional reference words: 1.00 1.10 2.00 grey out

KBCategory:

KBSubcategory: PgmApi


INF: How to Direct DDE to a Specific Instance of a Server

Article ID: Q105659

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can run multiple instances of the same application under Microsoft

Windows. When you communicate with an application using DDE, it may be

important to be able to identify which instance of an application should

respond to your DDE commands.

You can initiate a DDE conversation with a specific instance of an

application by appending the application's Task ID number to the

application name argument in the DDE initiate command.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

Each instance of each application launched in Windows is assigned a unique

number called a Task ID. This number can be used to distinguish among

multiple instances of an application.

To initiate a DDE conversation using the System topic with an instance of

Microsoft Excel that has a Task ID of 34567, you could use the following

sample command:

   Chan = DDEInitiate("excel34567", "System")

If you do not specify a Task ID number, you will initiate a conversation

with the first instance of the application that Windows finds. Note that

the order in which Windows finds instances of an application does not

always correspond to the order in which the applications were started.

How to Get the Task ID of an Application

----------------------------------------

You can get the Task ID of an application by doing one of the following:

 - Use the Access Basic shell command to launch the application. The shell

   command will return the application's Task ID if the application is

   launched successfully.

   -or-

 - Use an Access Basic function to find the Task ID. The following sample

   function can be used to find an application's Task ID:

Notes

-----

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

 - You may have some Microsoft Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code.

   Option Explicit

   Declare Function GetActiveWindow Lib "User" () As Integer

   Declare Function GetWindowWORD Lib "User" (ByVal hWnd As Integer, _

      ByVal nIndex As Integer) As Integer

   Const GWW_HINSTANCE = (-6)

   Function GetActiveTaskID ()

      GetActiveTaskID = GetWindowWORD(GetActiveWindow(), _

         GWW_HINSTANCE)

   End Function

The following Access Basic code demonstrates the use of both of these

techniques in getting the Task ID.

   Function TestTaskID()

      Dim TaskID

      TaskID = Shell("excel", 1)

      MsgBox TaskID & " and " & GetActiveTaskID()

   End Function

How to Use an Application's Task ID in a DDE Conversation

---------------------------------------------------------

The following example demonstrates how to use Task IDs to indicate which

instance of an application should be used in a DDE conversation. This

sample code will launch two instances of Microsoft Excel, start a DDE

conversation with each instance, and poke data to Sheet1 of each instance:

   Function DDEWithTwoInstances ()

      Dim TaskID1, TaskID2

      Dim Chan1, Chan2

      ' Start 2 instances of Excel and record Task ID numbers

      TaskID1 = Shell("excel.exe", 1)

      TaskID2 = Shell("excel.exe", 1)

      ' Initiate DDE conversations with both instances using

      ' the Task ID numbers. Trap an error that may happen

      ' if we try to initiate a conversation and the copy of

      ' Excel is still trying to start from the shell command.

      On Error GoTo ExcelNotYetReady

      Chan1 = DDEInitiate("excel" & TaskID1, "Sheet1")

      On Error GoTo 0

      On Error GoTo ExcelNotYetReady

      Chan2 = DDEInitiate("excel" & TaskID2, "Sheet1")

      On Error GoTo 0

      ' Poke information into each instance of Excel

      DDEPoke Chan1, "R1C1", "This is Task1!"

      DDEPoke Chan2, "R1C1", "This is Task2!"

      DDETerminateAll

      Exit Function

   ExcelNotYetReady:

      DoEvents

      Resume

   End Function

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.1, pages 139-147

Additional reference words: 1.00 1.10 2.00 Dynamic Data Exchange ADK

KBCategory:

KBSubcategory: IntpDde


INF: How to Disable PAGE UP and PAGE DOWN Keys in a Form (2.0)

Article ID: Q114506

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes the following two methods that you can use to

disable the PAGE UP and PAGE DOWN keys in a form:

 - Open the form as a Dialog form using the OpenForm macro action.

   -or-

 - Trap the PAGE UP and PAGE DOWN keys in the KeyDown event.

MORE INFORMATION

================

Method 1: Opening the Form as Dialog Using the OpenForm Macro Action

--------------------------------------------------------------------

The PAGE UP and PAGE DOWN keys will be inoperative in a form if the form is

opened using an OpenForm macro action with the Window Mode argument set to

Dialog. To demonstrate this technique, create and run a new macro with the

following actions in the sample database NWIND.MDB:

   OpenForm

      Form Name: Customers

      Filter Name: <leave empty>

      Where Condition: <leave empty>

      View: Form

      Data Mode: Edit

      Window Mode: Dialog

The drawback to this technique is that a Dialog form cannot use a custom

menu, nor will you be able to switch to another form while the Dialog form

is open.

NOTE: The Microsoft Access Wizards use this technique to limit navigation

in multiple-page forms.

Method 2: Trapping PAGE UP and PAGE DOWN in the KeyDown Event

-------------------------------------------------------------

The PAGE UP and PAGE DOWN keys can be detected and trapped in a control by

adding the following lines of Access Basic code to the KeyDown event for

all the controls on a form where the PAGE UP and PAGE DOWN keys should be

disabled:

   If KeyCode = KEY_PRIOR Or KeyCode = KEY_NEXT Then

      KeyCode = 0

   End If

NOTE: The constants for KeyCode are defined in the CONSTANT.TXT file, which

is included with Microsoft Access. To use these constants in your code, you

must either declare them yourself or copy them from the CONSTANT.TXT file

and paste them into the Declarations section of your module.

The following example demonstrates how to detect and trap the PAGE UP and

PAGE DOWN keys in a control's KeyDown event.

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or

perform these steps on a copy of the NWIND database.

1. Open the Customers form in Design view.

2. Create an event procedure with the following code for the KeyDown

   event for each control on the form:

      If KeyCode = KEY_PRIOR Or KeyCode = KEY_NEXT Then

         KeyCode = 0

      End If

   NOTE: To create each event procedure, select a control, click the Build

   button to the right of the OnKeyDown property, and then select Code

   Builder.

   For example, the event procedure code for the Customer ID field will

   look like the following:

      Sub Customer_ID_KeyDown (KeyCode As Integer, Shift As Integer)

         If KeyCode = KEY_PRIOR Or KeyCode = KEY_NEXT Then

            KeyCode = 0

         End If

      End Sub

3. Close the module and then switch the form to Form view.

REFERENCES

==========

For more information about Dialog forms, search for "OpenForm" then

"OpenForm Action" using the Microsoft Access Help menu.

For more information about the KeyDown event, search for "KeyDown" then

"KeyDown, KeyUp Events" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 pgup pgdn

KBCategory:

KBSubcategory: FmsOthr


INF: How to Display Immediate Window Without Module Window

Article ID: Q89594

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not display the Immediate window unless the

Module window is visible. This can be a problem if the user wants to

print to the Immediate window while in Datasheet view of a form. By

calling two Windows application programming interface (API) functions

from Access Basic, the Immediate window can be displayed at any time,

even without the Module window visible.

MORE INFORMATION

================

To display the Immediate window at any time, you need to call the

FindWindow() API function to get the handle to the Immediate window,

and then call the ShowWindow() API function to make the actual window

visible. You can attach the Access Basic function that includes these

API functions to a command button, a RunCode action in the Autokeys

macro, or add it to your toolbar.

To display the Immediate window, do the following:

1. Create a new module, or open an existing module.

2. Add the following declarations to the Global section of the module:

   Note: In the following sample code, an underscore _ is used as a

   line continuation character. Remove the underscore when re-creating

   this code in Access Basic.

   Option Explicit

   Declare Function ShowWindow% Lib "user" (ByVal hWnd%, ByVal nCmd%)

   Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,_

                                           ByVal lpWindowName As Any)

3. Add the following ShowImmediateWindow function:

   Function ShowImmediateWindow ()

      Dim IhWnd%                ' Handle to the Immediate Window.

      Dim ApiResults%           ' Returns the previous state of IW.

      Const MyNull = 0&

      Const SW_SHOW = 5         ' Internal constant to show window.

      Const ClassName = "OImmediate"    ' Internal ClassName of IW.

      IhWnd% = FindWindow(ClassName, MyNull)

      If IhWnd% = 0 Then

         MsgBox ("You need to open the IW once for this to work.")

      End If

      ApiResults% = ShowWindow(IhWnd%, SW_SHOW)

   End Function

4. Attach the code to a command button of a form.

5. When you first start Microsoft Access, the Immediate window is not

   displayed. When you open a module and display the Immediate window,

   then close it, Microsoft Access sets the window's Visible property to

   False. Calling ShowWindow resets the Visible property to True. If you

   call this function without first displaying the Immediate window at

   least once, you receive the error message because Microsoft Access has

   not created the Immediate window yet and therefore cannot return a

   window handle.

   For more information on how to display the Immediate window

   automatically from a module, query on the following words in the

   Microsoft Knowledge Base:

      immediate and window and macro

   With the information in the article referenced above, you can open

   the Immediate window with macros once, then use the code from this

   article to display the Immediate window at any time.

6. If you have registered the Immediate window with Windows by opening

   it at least once, pressing the command button of the form while in

   Datasheet view displays the Immediate window. Any Debug.Print

   statements should then be visible.

NOTE: This is unsupported code, and there may be instances when this

example does not work.

Additional reference words: 1.00 1.10 2.00 desktop iw

KBCategory:

KBSubcategory: PgmApi


INF: How to Display Intervals Greater Than 24 Hours

Article ID: Q109320

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are displaying an interval of greater than 24 hours in a

calculated control, the interval will not be displayed correctly.

Depending on the format of the control, you will see just the hours and

minutes, or you will see an incorrect date, such as 12/31/1889.

This article demonstrates three sample functions you can add to a

calculated control to correctly display intervals of greater than 24

hours.

MORE INFORMATION

================

NOTE: This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access.

To find the number of hours elapsed between two dates, you can subtract

the values in Access Basic. For example, the sample code

   StartDate=#6/1/93 8:00AM#

   EndDate=#6/1/93 1:00PM#

   ?Format(EndDate-StartDate,"hh:mm")

will return a value of 05:00, which is the correct result.

However, the sample code

   StartDate=#6/1/93 8:00AM#

   EndDate=#6/3/93 3:00PM#

   ? Format(EndDate-StartDate,"hh:mm")

will return a value of 07:00, which is incorrect. The correct result

is 55:00.

The following three sample functions will display the elapsed time

correctly:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

1. Open a module and enter the following in the Declarations section:

      Option Explicit

      Global StartDate

      Global EndDate

2. Enter the following functions:

      '---------------------------------------------------

      ' This function accepts a time interval and returns

      ' a value, such as "55:23" for 55 hours and 23 minutes.

      '---------------------------------------------------

      Function HoursMinutes (Interval)

         Dim Hours As Long, Minutes As Integer

         If IsNull(Interval) Then

            HoursMinutes = Null

         Else

            Hours = Int(Interval * 24)

            Minutes = CInt((Interval * 24 - Hours) * 60)

            If Minutes = 60 Then

               Minutes = 0

               Hours = hours + 1

            End If

            HoursMinutes = Hours & ":" & Format(Minutes, "00")

         End If

      End Function

      '---------------------------------------------------

      ' This function accepts a time interval and returns

      ' a value, such as "1 Day 23 Hours."

      '---------------------------------------------------

      Function DaysHours (Interval)

         Dim Days As Long, Hours As Long

         If IsNull(Interval) Then

            DaysHours = Null

         Else

            Days = Int(Interval)

            Hours = CInt((Interval - Days) * 24)

            If Hours = 24 Then

               Hours = 0

               Days = Days + 1

            End If

            DaysHours = Days & IIf(Days = 1, " Day ", " Days ") & _

               Hours & IIf(Hours = 1, " Hour", " Hours")

         End If

      End Function

      '---------------------------------------------------

      ' This function accepts a time interval and returns

      ' a value, such as "3 Days 17:43".

      '---------------------------------------------------

      Function DaysHoursMinutes (Interval)

         Dim Days As Long, Remainder As Double

         If IsNull(Interval) Then

            DaysHoursMinutes = Null

         Else

            Days = Int(Interval)

            Remainder = Interval - Days

            If Remainder > #23:59:59# Then

               Remainder = 0

               Days = Days + 1

            End If

            DaysHoursMinutes = Days & IIf(Days = 1, " Day ", " Days ") & _

               Format(Remainder, "hh:mm") & " Hours"

         End If

      End Function

3. Open a new module, and type the following in the module's Immediate

   window:

      StartDate=#6/1/93 8:00AM#

      EndDate=#6/3/93 3:05PM#

      ?HoursMinutes(EndDate-StartDate)

   The HoursMinutes() function will return a value of 55:05.

4. Type:

      ?DaysHours(EndDate-StartDate)

   The DaysHours() function will return the value "2 Days 7 Hours."

5. Type:

      ?DaysHoursMinutes(EndDate-StartDate)

   The DaysHoursMinutes() function will return the value "2 Days 07:05."

REFERENCES

==========

For more information on calculating time differences, query on the

following words here in the Microsoft Knowledge Base:

   calculate and timevalue

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Dynamically Create a Filter

Article ID: Q109334

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a method of dynamically creating a filter by

applying expressions on a form using a macro. The same technique can

also be adapted to a Query by Form (QBF) method.

The article assumes that you are familiar with form and macro design.

MORE INFORMATION

================

The "+" and "&" operators are used to concatenate (join) two string

values. However, each operator behaves differently when used on null-

valued strings. For example, if you use a null variable "Name" in the

expression "Dear "+[Name], then the expression evaluates to null,

whereas if you have the expression "Dear "&[Name], then the expression

evaluates to "Dear ".

You can use these different behaviors to build a string for use in the

Where condition of an ApplyFilter or OpenForm macro action. You combine

the strings using the + operator to concatenate values to dynamically

build each separate part of the filter (which becomes null if no value

is entered), then use the & operator to concatenate the separate strings.

The example below, using the sample database NWIND.MDB, uses a form and

a macro to create a 3-field filter:

1. Open the sample database NWIND.MDB.

2. Open the Employees form in Design view.

3. Choose Save As from the File menu and save the form as Employees 2.

4. Widen the Employees 2 form and add the following controls to the

   new blank area in the detail section to the right of the photo:

   NOTE: The labels should be to the left of their corresponding text

   boxes.

      Label

      ------------------

      Caption: Search ID

      Text Box

      -------------------------------

      Name: SID

      ControlSource: <leave blank>

      AfterUpdate: Filter.Make null 2

      NOTE: In Microsoft Access version 1.x, The Name property is

      called ControlName.

      Label

      --------------------------

      Caption: Search First Name

      Text Box

      -----------------------------------------------------

      Name: SName

      ControlSource: <leave blank>

      Validation Rule: Not Like "*'*" Or Is Null

      Validation Text: Can't use apostrophe in filter text.

      AfterUpdate: Filter.Make null

      Label

      -------------------------

      Caption: Search Hire Date

      Text Box

      -----------------------------------------------------

      Name: SDate

      ControlSource: <leave blank>

      Validation Rule: Not Like "*'*" Or Is Null

      Validation Text: Can't use apostrophe in filter text.

      AfterUpdate: Filter.Make null

      NOTE: In the following example, an underscore (_) is used as a

      line-continuation character. Remove the underscore when re-creating

      this line.

      Text Box

      -------------------------------------------------------------------

      Name: Where Text

      ControlSource: =Mid((" And [Employee ID]="+[SID]) & _

                             (" And [First Name] Like '"+[SName]+"'") & _

                             (" And [Hire Date] Like '"+[SDate]+"'"),6)

      Command Button

      ---------------------------

      Caption: Apply Filter

      OnClick: Filter.Apply Filter

      NOTE: In Microsoft Access version 1.x, the OnClick property

      is named OnPush.

5. Create the following macro group:

      Macro Group: Filter

      --------------------------------------------------------------

      Macro Name: Make null

         Condition:  IsNull(Screen.ActiveControl)

         Action: StopMacro

         Description: This macro is for text fields.

         Condition: Len(Screen.ActiveControl)=0

         Action: SetValue

         Item: Screen.ActiveControl

         Expression: Null

         Description: Make an empty text field null.

      Macro Name: Make null 2

         Condition: IsNull(Screen.ActiveControl)

         Action: StopMacro

         Description: This macro is for numeric fields.

         Condition: Not IsNumeric(Screen.ActiveControl)

         Action: SetValue

         Item: Screen.ActiveControl

         Expression: Null

         Description: Turn non-numeric values into nulls.

      Macro Name: Apply Filter

         Condition: IsNull([Where Text])

         Action: ApplyFilter

         Where Condition: True

         Description: No Where Text, so select all records and stop.

         Condition: ...

         Action: StopMacro

         Condition: Len([Where Text]) > 255

         Action: MsgBox

         Message: You have selected too many criteria in the filter.

         Title: Apply Filter

         Description: If filter too long, display warning and stop.

         Condition: ...

         Action: StopMacro

         Action: ApplyFilter

         Where Condition: =[Where Text]

         Description: Apply the filter.

6. Save the macro and the form.

7. View the form in Form view and enter values in the search fields.

Note that the data for the Apply Filter's Where condition is

constructed in the Where text control. If you do not want users to see

this, set the Visible property of the Where text field to False.

Limitations

-----------

 - The length of the ControlSource property for the Where text box cannot

   exceed 255 characters. Microsoft Access will not let you type an

   expression longer than this. One workaround to this limitation is to

   use several text boxes to build each part of the criteria, then use a

   final text box to combine the various parts into a single Where

   clause.

 - The string that the expression produces cannot exceed 255 characters.

   The second test in the Apply Filter macro above tests for this

   condition. If the filter string is longer than 255 characters, you

   will receive a warning that the filter is too long and the macro

   will halt.

To modify the above example for a QBF method, add the controls

to a blank unbound form and change the ApplyFilter actions to OpenForm

actions. To select all the records using OpenForm actions, leave the

Where condition blank instead of using True.

REFERENCES

==========

For more information on the ApplyFilter action, search for "ApplyFilter"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 macros forms

KBCategory:

KBSubcategory: McrActn


INF: How to Edit Library Databases

Article ID: Q114682

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes two methods for editing Microsoft Access library

databases.

A library database is a database that contains a collection of database

objects that can be loaded automatically when you start Microsoft Access.

You specify that a database is to be loaded by adding its name to the

[Libraries] section of the MSACCESS.INI (version 1.x) or MSACC20.INI

(version 2.0) file, or by installing it using the Add-in Manager (version

2.0). Library database files usually have .MDA extensions.

Since library databases are loaded when Microsoft Access starts, you cannot

open them directly for editing. If you try to do so, you will receive an

error message similar to:

   The database 'c:\access\filename.mda' is already open as a library

   database

MORE INFORMATION

================

NOTE: You should back up library database files before you modify them.

Method 1

--------

NOTE: This method applies only to Microsoft Access version 2.0.

1. While Microsoft Access is not running, open the MSACC20.INI file located

   in your Windows directory with any text editor (such as Windows

   Notepad).

2. Add the line "DebugLibraries=True" (without quotation marks) to the

   [Options] section of the file. The section will look like:

       [Options]

       Systemdb=c:\Access\SYSTEM.MDA

       UtilityDB= c:\Access\Utility.MDA

       DebugLibraries=True

3. Save and then close the file.

4. Start Microsoft Access.

5. Open any database.

6. Open any module.

7. From the View menu, choose Procedures.

8. In the Databases box, select the library that you want to edit.

Method 2

--------

1. While Microsoft Access is not running, open the MSACCESS.INI (version

   1.x) or MSACC20.INI (version 2.0) file in your Windows directory in any

   text editor (such as Windows Notepad).

2. Locate the entry for the library file that you want to edit. The

   entry will be similar to:

      Wzlib.mda=rw

3. Comment the line out by adding a semicolon (;) at the beginning of

   the line. The entry should be similar to:

      ;Wzlib.mda=rw

4. Save and then close the .INI file.

5. Start Microsoft Access.

6. From the File menu, choose Open Database.

7. Select the library you want to open. Note that by default, the Open

   Database dialog box only displays files with .MDB extensions. Either

   type the name of the library you want to open, or type "*.MDA" (without

   quotation marks) in the File Name box to display files with .MDA

   extensions.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 15, "Using

Library Databases and Dynamic-Link Libraries"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: MdlLib


INF: How to Fill an Array Using Access Basic

Article ID: Q109727

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes two methods of filling an array using Access

Basic. The first method fills an array when the number of elements in the

array is known. The second method fills an array when the number of

elements in the array is not known.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

This example demonstrates how to fill a one-dimensional array when the

number of elements is known:

1. Open the sample database NWIND.MDB.

2. Create a new module with the following sample code:

      Option Explicit

      Function FillOneDimArray ()

         Dim i As Long

         Dim DB As Database, SS As Snapshot

         Dim RecordCount As Long

         On Error GoTo ErrorHandler

         Set DB = CurrentDB()

         Set SS = DB.CreateSnapshot("Employees")

         ' Get number of records.

         SS.MoveLast

         RecordCount = SS.RecordCount

         ' Create the (zero-based) array.

         ' Address elements starting from row 0 rather than 1.

         ReDim AnArray(RecordCount - 1)

         ' Fill the array.

         SS.MoveFirst

         For i = 0 To RecordCount - 1

            AnArray(i) = SS.[Last Name]

            SS.MoveNext

         Next i

         ' Print the array contents to the Immediate window.

         For i = 0 To RecordCount - 1

            Debug.Print AnArray(i)

         Next i

         SS.Close

         DB.Close

         Exit Function

      ErrorHandler:

         MsgBox Error

         Exit Function

      End Function

3. Choose Immediate Window from the View menu. Type the following

   in the Immediate window and press ENTER:

      ? FillOneDimArray()

The following will be printed to the Immediate window:

   Davolio

   Fuller

   Leverling

   Peacock

   Buchanan

   Suyama

   King

   Callahan

   Dodsworth

The next example demonstrates how to fill an array when the number of

elements is not known. A Dynaset will be used to fill the array. Records

can be added to or removed from the Dynaset while the array is being

filled:

1. Open the sample database NWIND.MDB.

2. Create a new module with the following sample code:

      Function FillIndefArray ()

         Dim DB As Database, DS As Dynaset, Count As Integer

         Dim AnArray()

         Dim i As Long

         Set DB = CurrentDB()

         Set DS = DB.CreateDynaset("Employees")

         ' Create the (zero-based) array with only one row.

         ' NOTE: The Preserve keyword allows the size of the array

         ' to be adjusted without the contents being destroyed.

         ' Adjusting the size of an array using Preserve can

         ' cause your code to go significantly slower. It is better

         ' to create an array with a known number of elements prior

         ' to filling it.

         Count = 0

         ReDim Preserve AnArray(0)

         ' Fill the array.

         DS.MoveFirst

         Do Until DS.eof

            ' Fill the array row with the last name.

            AnArray(Count) = DS![Last Name]

            ' Increase the number of elements in the array

            ' by one to accommodate the next record.

            ReDim Preserve AnArray(UBound(AnArray) + 1)

            Count = Count + 1

            DS.MoveNext

         Loop

         ' Remove the remaining empty array row.

         ReDim Preserve AnArray(UBound(AnArray) - 1)

         DS.Close

         ' Print the array contents to the Immediate window.

         For i = 0 To Count - 1

            Debug.Print AnArray(i)

         Next i

      End Function

3. From the View menu, choose Immediate Window. Type the following in

   the Immediate window, and then press ENTER:

      ? FillIndefArray()

The following will be printed to the Immediate window:

   Davolio

   Fuller

   Leverling

   Peacock

   Buchanan

   Suyama

   King

   Callahan

   Dodsworth

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 3,

"Access Basic Essentials," and Chapter 4, "Debugging Your Access Basic

Code"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Fill Text Boxes on a Report with Access Basic

Article ID: Q109943

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes two methods you can use to populate, or fill,

controls on a bound report when you run the report.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

Both of the examples below use Access Basic code to fill a control on a

report bound to the Employee List query. The code will fill in the City

field on a report that only contains the Employee ID and Employee Name

fields.

The first example demonstrates how to fill a field using Access Basic

code called from the OnFormat property of the report's detail section:

1. Open the sample database NWIND.MDB.

2. Using the ReportWizard, create a new report based on the Employee

   List query with the following options:

    - Single-Column

    - Include both fields

    - Sort by Employee Name

    - Select Executive style

3. View the report in Design view.

4. Place the following text box in the report's detail section:

      ControlName: City

      ControlSource: <leave empty>

5. Save the report as Fill Report1.

6. Enter the following sample code in a new or existing module:

   Option Explicit

   Function fillrep()

      Dim ds as Dynaset, db as Database

      Set db=CurrentDB()

      set ds=db.CreateDynaset("Employees")

      ds.MoveFirst

      ds.FindFirst "[Employee ID]=" & Reports![Fill Report1]![Employee ID]

      Reports![Fill Report1]![City]=ds![city]

   End Function

7. Modify the report's detail section OnFormat property to be:

      =fillrep()

8. Preview the report. The City fields on the report will be filled by

   the Access Basic code.

The second example demonstrates how to fill a field using Access Basic

code called from a text box's ControlSource property:

1. Open the sample database NWIND.MDB.

2. Using the ReportWizard, create a new report based on the Employee

   List query with the following options:

    - Single-Column

    - Include both fields

    - Sort by Employee Name

    - Select Executive style

3. View the report in Design view.

4. Place the following text box in the report's detail section:

      ControlName: City

      ControlSource: <leave empty>

5. Save the report as Fill Report2.

6. Enter the following sample code in a new or existing module:

   Function fillit()

      Dim ds as Dynaset, db as Database

      Set db=CurrentDB()

      set ds=db.CreateDynaset("Employees")

      ds.MoveFirst

      ds.FindFirst "[Employee ID]=" & Reports![Fill Report2]![Employee ID]

      fillit=ds!city

   End Function

7. Change the ControlSource property of the City text box on the

   report to be:

      =fillit()

8. Preview the report. The City fields on the report will be filled by

   the Access Basic code.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.1, chapter 7

For more information on calling functions, query on the following words

here in the Microsoft Knowledge Base:

   functions and called and from and events and expressions

Additional reference words: 1.00 1.10 2.00 on format ControlSource

KBCategory:

KBSubcategory: McrArg


INF: How to Filter a Subform by Changing the Record Source

Article ID: Q112796

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

The ApplyFilter action cannot be used with a subform. In Microsoft Access

version 1.x, some of this functionality could be achieved by basing the

subform on a parameter query. In Microsoft Access version 2.0, however, you

can achieve this by changing the subform's RecordSource property.

MORE INFORMATION

================

The ApplyFilter action is used to dynamically restrict or sort the records

in a table, or the records from a form or report's underlying table or

query. Although you cannot use this action with a subform, you can

accomplish the same thing by changing the subform's RecordSource property.

The following example demonstrates how to dynamically change the sort order

of the Categories Subform subform in the sample database NWIND.MDB:

1. In the NWIND database, create a new query based on the Products table.

   Include all the fields from the table in the query.

2. Set the Sort row of the Unit Price column to Ascending.

3. Save the query as Unit Price Sort.

4. Open the Categories form in Design view, and add a command button

   to it.

5. Set the command button's OnClick property to the following:

      If Me![Categories Subform].Form.RecordSource = "Products" Then

         Me![Categories Subform].Form.RecordSource = "Unit Price Sort"

      Else

         Me![Categories Subform].Form.RecordSource = "Products"

      End If

6. View the Categories form in Form view.

7. Choose the command button you added in step 4.

The form's sort order will toggle between the Unit Price and the Product ID

fields as you choose the command button.

REFERENCES

==========

For more information about how to use the RecordSource property, search for

"RecordSource" then "Changing a Form or Report's Underlying Table or Query"

using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsProp


INF: How to Find a Record in a Form Using Access Basic

Article ID: Q114556

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a method you can use to find a record in a form

using the form's recordset and a bookmark.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The Microsoft Access "User's Guide" demonstrates a method using the

FindRecord macro action that can be used to find records in a form by

selecting a key value from a list. (See the Microsoft Access "User's

Guide," version 1.0, pages 547-548, or version 1.1, pages 551-552, or

version 2.0, pages 651-652.) This method is limited in the following ways:

 - It requires that the key search field be located on the form.

 - You are limited to searching for a single key value.

The example below demonstrates a sample user-defined Access Basic function

called FindRecord_RS() that uses the FindFirst recordset method to find a

record in a form:

1. Create a new module with the following in the Declarations section:

      Option Explicit

2. Add the following function to the module:

      Function FindRecord_RS (SQLWhere)

         Dim DS As Dynaset

         Set DS = Screen.ActiveForm.Dynaset

         DS.FindFirst SQLWhere

         If DS.NoMatch Then

            MsgBox "No record found!"

         Else

            Screen.ActiveForm.Bookmark = DS.Bookmark

         End If

      End Function

The FindRecord_RS() function's SQLWhere argument must be a string

expression that is any valid SQL WHERE clause (without the word WHERE).

The following are examples of valid SQL WHERE clauses:

   "[Customer ID] = 3"

   "[Customer ID] = " & [Find Customer]

If the field is a text field, the WHERE clause may look like the

following:

   "[Customer ID] = '3'"

   "[Customer ID] = '" & [Find Customer] & "'"

NOTE: You can use single or double quotation marks to delimit text values.

The following examples are functionally identical to the two examples

above:

   "[Customer ID] = ""3"""

   "[Customer ID] = """ & [Find Customer] & """"

The SQL WHERE clause to find a record for a particular customer on a

given date might look like the following:

   "[Customer ID] = 3 AND [Order Date] = #1/1/94#"

   "[Customer ID] = " & [Find Customer] & " AND [Order Date] = " &

   [Find Order Date]

Using the FindRecord_RS Function

--------------------------------

Microsoft Access Version 1.x:

The Suppliers form in the sample database NWIND.MDB has a combo box called

Select Company To Find that lists available suppliers. When you select a

supplier, the Find Company macro is run to find the supplier matching the

selection using the FindRecord action.

The following steps demonstrate how to use the FindRecord_RS() method

instead of the Find Company macro:

1. Open the Suppliers form in Design view.

2. Select the Select Company To Find combo box in the form footer,

   and alter the AfterUpdate property from

      Find Company

   to:

      =FindRecord_RS("[Company Name] = """ & [Company Pick List] & """")

When you make a selection in the combo box, the FindRecord_RS() function

will find a record in the Suppliers form whose Company Name field matches

your selection in the combo box.

Microsoft Access Version 2.0:

The Products And Suppliers form in the sample database NWIND.MDB has a

combo box called Select Product To Find that lists the available products.

When you select a product, the Product Pick List.Find Product macro is run

to find the product record matching the selection using the FindRecord

macro action.

The following example demonstrates how to use the FindRecord_RS() method

instead of the Product Pick List.Find Product macro:

1. Open the Products And Suppliers form in Design view.

2. Select the Select Product To Find combo box in the form header, and

   alter the AfterUpdate property from

      Product Pick List.Find Product

   to:

      =FindRecord_RS("[Product Name] = """ & [Product Pick List] & """")

When you select an item in the combo box, the FindRecord_RS() function will

find a record in the Products And Suppliers form whose Product Name field

matches your selection in the Select Product To Find combo box.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 22, "Using Macros

with Forms," pages 547-548

Microsoft Access "User's Guide," version 1.1, Chapter 22, "Using Macros

with Forms," pages 551-552

Microsoft Access "User's Guide," version 2.0, Chapter 25, "Using Macros

with Forms," pages 651-652

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsEvnt


INF: How to Find a Record Using a Bound Control (2.0)

Article ID: Q115189

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use a single bound control both for

finding records and entering data in a form.

You can use this technique to find whether the value entered in a field

already exists in another record. If the value does exist in another

record, the record containing that value will be displayed. If the value

does not exist in another record, you can continue entering data for the

new record.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

MORE INFORMATION

================

The Microsoft Access "User's Guide" demonstrates a method that you can use

to find records in your database by selecting a key value from a list. (See

"Finding a Record by Selecting a Value from a List.") This method is

limited in that it requires two controls. One control is an unbound control

that is used to select the value to look for, and the other control is a

bound control in which data entry for that value occurs.

The following example demonstrates how to use a single, bound control to

achieve the same functionality:

1. Open the sample database NWIND.MDB. Create a new module with the

   following declarations and functions:

      ' *******************************************************

      ' DECLARATIONS SECTION

      ' *******************************************************

      Option Explicit

      Dim Found

      Function Find_BeforeUpdate ()

         Dim RS As Recordset, C As Control

         Set C = Screen.ActiveControl

         Set RS = Screen.ActiveForm.RecordsetClone

         On Error Resume Next

         ' Try to find a record with a matching entry in

         ' the form's dynaset as a numeric field.

         RS.FindFirst "[" & C.ControlName & "]=" & C

         ' If it was not a numeric field (error 3070),

         ' try finding the record as a text field.

         If Err = 3070 Then

            Err = 0

            RS.FindFirst "[" & C.ControlName & "]='" & C & "'"

         End If

         On Error GoTo 0

         ' If any unexpected error happened, present to user and exit.

         If Err <> 0 Then

           MsgBox "Err " & Err & ": " & Error$, 48

           DoCmd CancelEvent

           Exit Function

         End If

         ' If a record was found, save the found record's bookmark.

         If RS.NoMatch Then

              Found = Null

         Else

              Found = RS.Bookmark

         End If

         ' If the record was found...

         ' ...cancel the BeforeUpdate event

         ' ...undo changes made to the current record

         ' ...and TAB to the next control to trigger the OnExit routine.

         If Not IsNull(Found) Then

            DoCmd CancelEvent

            SendKeys "{ESC 2}{TAB}", False

         End If

      End Function

      Function Find_OnExit ()

         ' If the record was found, cancel the OnExit routine to stay

         ' in the control and go find the record.

         If Not IsNull(Found) And Found <> "" Then

            DoCmd CancelEvent

            ' Synchronize the form record with the found record.

            Screen.ActiveForm.Bookmark = Found

            Found = Null

         End If

      End Function

2. Open the Customers form in Design view. Change the following properties

   for the Customer ID field:

      BeforeUpdate: =Find_BeforeUpdate()

      OnExit: =Find_OnExit()

3. View the form in Form view. In the Customer ID field, type "AROUT"

   (without quotation marks) and then press ENTER. Microsoft Access will

   find and display the Around The Horn customer.

4. In the Customer ID field, type "POPSI" (without quotation marks) and

   then press ENTER. Since this key value does not exist, you can

   continue entering data for the record.

How the Sample Functions Work

-----------------------------

The Find_BeforeUpdate() function uses the FindFirst method to search the

dynaset the form is based on to see if the value entered in the control

exists in the table.

If the value does not exist, the global variable Found is set to NULL and

the function exits. If the value does exist, the global variable Found is

set to the bookmark of the found record to be used by the Find_OnExit()

function.

Before the found record can be presented, the BeforeUpdate event must be

canceled, and a SendKeys action must send two ESC keys to undo changes to

the current record.

Next, the SendKeys action sends a TAB key to exit the field. This event

triggers the Find_OnExit() function, which checks to see if the find was

successful. If it was, the CancelEvent action is run to prevent exiting the

control, and then the form record is synchronized with the found record by

setting its bookmark equal to the bookmark of the found record. Found is

then reset back to NULL.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, pages 651-652

Additional reference words: 2.00 findrecord

KBCategory:

KBSubcategory: FmsOthr


INF: How to Find Access Basic Error Codes

Article ID: Q105666

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Microsoft Access manuals do not contain a listing of all the error

codes and messages you can receive when you are running custom Access Basic

functions. To obtain the error codes and messages, you can run a custom

Access Basic function and use the Microsoft Access Help system.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

There are approximately 700 error messages that can result from running

Access Basic code. To print a list of the error values and descriptions to

the Immediate window, add the sample function below to a module:

   Function PrintErrorStrings ()

      For i = 1 To 32767

         E$ = Error$(i)

         If E$ <> "User-defined error" And E$ <> "Reserved Error" Then

            Debug.Print i; Error$(i)

         End If

      Next i

   End Function

The following example demonstrates how to save the error code list in a

table:

1. Create a new table with the following fields. Save the table as Error

   Codes:

      Table Name: Error Codes

      -----------------------

      FieldName: Err

         DataType: Number

         FieldSize: Integer

      FieldName: Error

         DataType: Text

         FieldSize: 255

2. Revise the PrintErrorStrings() function as follows:

   Function PrintErrorStrings ()

      Dim MyDB As Database, MyTable As Table

      Set MyDB = CurrentDB()

      Set MyTable = MyDB.OpenTable("Error Codes")

      For i = 1 To 32767

         E$ = Error$(i)

         If E$ <> "User-defined Error" And E$ <> "Reserved Error" Then

            MyTable.AddNew

            MyTable![Err] = i

            MyTable![Error] = E$

            MyTable.Update

          End If

      Next i

      MyTable.Close

      MyDB.Close

   End Function

3. Type the following in the Immediate window, and then press ENTER:

   ? PrintErrorStrings()

The error codes and descriptions will be written to the Error Codes table.

The Microsoft Access Help system contains descriptions of the errors.

However, the error values are not in the Help system. To determine the

error value, match the description to the values returned by the

PrintErrorStrings() function.

REFERENCES

==========

For more information on error messages, search for "error messages:

reference" then "Error Messages Reference" using the Microsoft Access Help

menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmErr


INF: How to Find If an Object Exists in the Database

Article ID: Q90989

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

It may be necessary to check for the existence of an object before the

creation of a new table, form, report, and so on, using Access Basic.

This article explains how functions can check for the existence of a

given object.

MORE INFORMATION

================

Definition of Variables Used

----------------------------

ObjectFound% - a test variable. If -1 then the object exists, otherwise

it does not.

WhatObjectType$ - the object type of the item in question.

ObjectName - the name of the item in question.

Follow these four steps to create a user-defined function to check for

the existence of a given object:

1. Choose Module from the database window.

2. Choose New to create a new module.

3. Type the following function that checks for the existence of a given

   object:

      Function ObjectExists% (WhatObjectType$, ObjectName$)

         Dim ObjectFound%

         On Error Resume Next

         If WhatObjectType = "Form" Then

            DoCmd SelectObject A_FORM, ObjectName, True

         ElseIf WhatObjectType = "Table" Then

            DoCmd SelectObject A_TABLE, ObjectName, True

         ElseIf WhatObjectType = "Macro" Then

            DoCmd SelectObject A_MACRO, ObjectName, True

         ElseIf WhatObjectType = "Module" Then

            DoCmd SelectObject A_MODULE, ObjectName, True

         ElseIf WhatObjectType = "Report" Then

            DoCmd SelectObject A_REPORT, ObjectName, True

         ElseIf WhatObjectType = "Query" Then

            DoCmd SelectObject A_QUERY, ObjectName, True

         Else

            MsgBox WhatObjectType & " type does not exist!"

            WhatObjectType = "False"

         End If

         If Err <> 2544 And WhatObjectType <> "False" Then

         'Object was found in the Database Container (DBC)

            Err = 0     'Reset the error level

            ObjectFound% = -1

         Else           'Object was not found in the DBC

            ObjectFound% = 0

            MsgBox "Error #" & Err & ": " & Error

            'Give error number and message

         End If

         ObjectExists% = ObjectFound%

      End Function

This function returns a value of True (-1) if the object exists. If

the object does not exist, or an error is encountered, the function

will return a value of False (0).

To use the function ObjectExists, do the following:

Choose Immediate Window from the View Menu while in a module, then

type:

   ?ObjectExists("object type","Object name")

NOTE: Where "object type" is "Form", "Table", "Macro", "Module",

"Query", or "Report" and "object name" is the name of the object in

question. An sample call would be:

   ?ObjectExists("Table","Employees")

If the object exists, the Database window becomes active and the

object is selected. If the object does not exist a message box pops up

stating the error that occurred and that the object does not exist. If

the object type is incorrect, a message box pops up stating that the

object type does not exist.

NOTE: A side effect of this function is that the Database window becomes

the active window. If you call the function from a form, you can follow

the function call with a SelectObject action to set focus back to your

form.

REFERENCES

==========

"Microsoft Windows Software Development Kit", Microsoft Press, 1992

"Programming Windows: the Microsoft Guide to Writing Applications for

Windows 3", Charles Petzold. Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to

Programming Reference" Volumes 1 - 6, Microsoft Press, 1992

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Find the Number of Days In a Month

Article ID: Q109703

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates two methods of returning the total number of

days in the current month. The first method uses a query, and the second

method uses a user-defined Access Basic function.

MORE INFORMATION

================

Query Method

------------

Create the following new query based on any table:

NOTE: In the following example, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this

example.

   Query: QueryTest

   --------------------------------------------------------------

   Field: DateDiff("d",Date()-(Day(Date()- 1)), DateSerial(Year _

          (Date()),(Month(Date())+1),1))

      Total: First

      Show:  True

This query will return an integer for the number of days in the current

month. For example, if the current month is April, the query will return

the integer 30.

User-Defined Access Basic Function

----------------------------------

NOTE: This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

Create the following sample function in a new or existing module:

   '******************************************************

   'Declarations Section of Module

   '******************************************************

   Option Compare Database

   Option Explicit

   '******************************************************

   'DaysInMonth Function

   '******************************************************

   ' This function takes a date as an argument and returns

   ' the total number of days in the month.

   Function DaysInMonth (MyDate)

      Dim NextMonth, EndOfMonth

      NextMonth = DateAdd("m", 1, MyDate)

      EndOfMonth = NextMonth - DatePart("d", NextMonth)

      DaysInMonth = DatePart("d",EndOfMonth)

   End Function

Type the following expression in the module's Immediate window:

   ?DaysInMonth(Date())

The number of days in the current month will be returned. To obtain the

number of days in the month of a specific date, enter the specific date as

follows:

   ?DaysInMonth(#11/4/93#)

The integer 30 will be returned in the Immediate window, since there are

30 days in the month of November.

To use this function in a query or form, use an equal sign (=) instead of

the question mark (?) before the function name:

   =DaysInMonth(<date value or variable>)

REFERENCES

==========

For more information on date functions, search for "date" and then check

each of the date function topics using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Find the Windows and System Paths

Article ID: Q109733

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use the GetWindowsDirectory() and

GetSystemDirectory() Windows API functions to return the Windows and

Windows System directory paths.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

The following example demonstrates how to use the GetWindowsDirectory()

and GetSystemDirectory() Windows API functions:

1. Create a new module with the sample code below.

NOTE: You may have some Microsoft Windows API functions defined in an

existing Microsoft Access library; therefore, your declarations may be

duplicates. If you receive a duplicate procedure name error message,

remove or comment out the declarations statement in your code.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code

in Access Basic.

   '**********************************

   'Declarations section of the module

   '**********************************

   Option Compare Database

   Option Explicit

   Declare Function GetWindowsDirectory% Lib "Kernel" (ByVal lpbuffer _

      As String, ByVal nsize As Integer)

   Declare Function GetSystemDirectory% Lib "Kernel" (ByVal lpbuffer _

      As String, ByVal nsize As Integer)

   'Returns the path to the Windows directory as a string.

   Function GetWinDir () As String

      Dim lpbuffer As String * 144

      Dim Length%

      Length% = GetWindowsDirectory(lpbuffer, Len(lpbuffer))

      GetWinDir = Left(lpbuffer, Length%)

   End Function

   'Returns the path to the Windows System directory as a string.

   Function GetSysDir () As String

      Dim lpbuffer As String * 144

      Dim Length%

      Length% = GetSystemDirectory(lpbuffer, Len(lpbuffer))

      GetSysDir = Left(lpbuffer, Length%)

   End Function

2. From the View menu, choose Immediate Window. Type the following in

   the Immediate window, and then press ENTER:

      ? GetWinDir()

   The Windows directory path will be returned.

3. Type the following in the Immediate window, and then press ENTER:

      ? GetSysDir(0

   The Windows System directory path will be returned.

Additional reference words: 1.00 1.10 2.00 path system windows api ab

KBCategory:

KBSubcategory: PgmApi


INF: How to Float Windows on Other Windows

Article ID: Q101325

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

With the Microsoft Access Popup property, you can create forms that "float"

(that is, they stay on top of other forms) within Microsoft Access.

However, if you set focus to a non-Microsoft Access application, these

forms are overlapped. If you want your forms to stay on top of forms in

non-Microsoft Access windows, you must call the Windows application

programming interface (API) subroutine SetWindowPos().

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools

provided with Microsoft Access. For more information on Access Basic,

please refer to the "Microsoft Access 1.x Introduction to Programming" or

"Microsoft Access 2.0 Building Applications" manual.

MORE INFORMATION

================

To make your form stay on top of non-Microsoft Access forms, call the

following Access Basic function from an event such as your form's

OnOpen property.

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

You may have some Windows API functions defined in an existing

Microsoft Access library; therefore, your declarations may be

duplicates. If you receive the duplicate procedure name error message,

remove or comment out the declarations statement in your code.

1. Add the following to your global declarations section:

   Declare Sub SetWindowPos Lib "User" (ByVal hwnd%,_

                                     ByVal hWndInsertAfter%, _

                                     ByVal X%, ByVal Y%, ByVal cx%, _

                                     ByVal cy%, ByVal wFlags%)

   Global Const HWND_TOPMOST = -1

   Global Const SWP_NOSIZE = &H1

   Global Const SWP_NOMOVE = &H2

2. Create the following function:

      Function TopMost (F As Form)

         Call SetWindowPos(f.hwnd, HWND_TOPMOST, 0, 0, 0, 0,_

                           SWP_NOMOVE Or SWP_NOSIZE)

      End Function

3. Create a form and set the following properties:

      OnOpen: =TopMost(Form)

      Popup: True

4. Close the form to save any changes; changing the Popup property in

   Design view has no effect unless you reopen your form.

5. Open the form. When you switch to any other application, this form

   should stay on top of the other application.

To Float any Other Application

------------------------------

To float any other application on top of another application, such as

floating the Windows Calculator, you can use SetWindowsPos() along

with the FindWindow() Windows API function as demonstrated below:

Option Compare Database   'Use database order for string comparisons

Option Explicit

'Windows API Declarations

Declare Function FindWindow% Lib "user" (ByVal lpclassname As Any,_

   ByVal lpCaption As Any)

Declare Sub SetWindowPos Lib "User" (ByVal hwnd%, _

   ByVal hWndInsertAfter%, ByVal X%, ByVal Y%, ByVal cx%, ByVal cy%, _

   ByVal wFlags%)

Global Const HWND_TOPMOST = -1

Global Const SWP_NOSIZE = &H1

Global Const SWP_NOMOVE = &H2

Function Float_Cal()

   Dim X%, hwnd%

   X = Shell("CALC.EXE", 1)

   hwnd% = FindWindow%("SciCalc", 0&)

   Call SetWindowPos(hwnd%, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or_

      SWP_NOSIZE)

End Function

To demonstrate this, open the Immediate window, enter the following

command, and press ENTER:

   ? Float_Calc()

NOTE: CALC.EXE is an application that comes with Windows and should be

in your Windows directory.

REFERENCES

==========

"Microsoft Windows Programmer's Reference, Volume 2: Functions,"

version 3.10

Additional reference words: 1.00 1.10 2.00 float

KBCategory:

KBSubcategory: PgmApi


INF: How to Force a New Line in a MsgBox Statement

Article ID: Q90810

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To force a new line in a message box, enter the message as a string

formula and concatenate a carriage return/line feed, Chr$(13) +

Chr$(10), in the message anywhere you want to start a new line.

MORE INFORMATION

================

For example, if you had the message:

   Notice: This is an Important Message!

And instead of having it all display on one line, or letting Microsoft

Access determine where to break the message onto a new line, you want to

force it to display as:

   Notice:

   This is an Important Message!

To force the message to display like this you need to enter the message

as a string formula. If you call the message box from a macro the syntax

would be:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Action

   --------------------------------------------------------------------

   MsgBox

      Message: ="Notice:" & Chr(13) & Chr(10) & "This is an Important _

               Message!"

If you call the message box from a macro the syntax would be:

   MsgBox "Notice:" & Chr(13) & Chr(10) & "This is an Important_

          Message!"

This formula places "Notice:" on the first line and insert 1 carriage

return/line feed to force a hard carriage return between the 2 lines

of text.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 19, 66, and 316-

320

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: McrArg


INF: How to Get and Use the Microsoft Access Window Handle

Article ID: Q113881

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function that you

can use to get the handle to the Microsoft Access window. This article also

describes how to use the sample function to:

 - Minimize, maximize, and restore the Microsoft Access window.

 - Determine if the Microsoft Access window is minimized, maximized or

   restored.

 - Move and size the Microsoft Access window.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

Every window in the Microsoft Windows environment has a unique number, or

window handle, assigned to it that is used to identify the window. The

window handle is a required argument for many Microsoft Windows application

programming interface (API) functions.

The following steps describe how to create the sample function

GetAccesshWnd() that you can use to get the Microsoft Access window handle:

Notes:

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

 - You may have some Microsoft Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code.

1. Create a new module.

2. Add the following lines to the module's Declarations section:

      Option Explicit

      Declare Function GetActiveWindow Lib "User" () As Integer

      Declare Function GetParent Lib "User" (ByVal hWnd As Integer) _

         As Integer

3. Enter the following function in the module:

      Function GetAccesshWnd ()

         Dim hWnd As Integer

         Dim hWndAccess As Integer

         ' Get the handle to the currently active window.

         hWnd = GetActiveWindow()

         hWndAccess = hWnd

         ' Find the top window without a parent window.

         While hWnd <> 0

            hWndAccess = hWnd

            hWnd = GetParent(hWnd)

         Wend

         GetAccesshWnd = hWndAccess

      End Function

How to Use the GetAccesshWnd() Function

---------------------------------------

General Use:

1. Choose Immediate Window from the View menu in the module's Design view.

2. Type the following and then press ENTER:

      ? GetAccesshWnd()

   The window handle for the Immediate window will be returned.

How to Minimize, Maximize, or Restore the Microsoft Access Window:

1. Add the following to the module's Declarations section:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Declare Function ShowWindow% Lib "User" (ByVal hWnd%, _

         ByVal nCmdShow%)

      Global Const SW_MAXIMIZE = 3

      Global Const SW_SHOWNORMAL = 1

      Global Const SW_SHOWMINIMIZED = 2

2. Enter the following functions in the module:

      Function AccessMinimize()

         AccessMinimize = ShowWindow(GetAccesshWnd(), SW_SHOWMINIMIZED)

      End Function

      Function AccessMaximize()

         AccessMaximize = ShowWindow(GetAccesshWnd(), SW_MAXIMIZE)

      End Function

      Function AccessRestore()

         AccessRestore = ShowWindow(GetAccesshWnd(), SW_SHOWNORMAL)

      End Function

3. To run these functions, type "? <function name>()" (without quotation

   marks) in the module's Immediate window.

How to Determine If the Microsoft Access Window Is Minimized, Maximized, or

Restored:

1. Add the following to the module's Declarations section:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Declare Function IsIconic Lib "User" (ByVal hWnd As Integer) _

         As Integer

      Declare Function IsZoomed Lib "User" (ByVal hWnd As Integer) _

         As Integer

2. Enter the following functions in the module:

      Function IsAccessMaximized ()

         If IsZoomed(GetAccesshWnd()) = 0 Then

            IsAccessMaximized = False

         Else

            IsAccessMaximized = True

         End If

      End Function

      Function IsAccessMinimized ()

         If IsIconic(GetAccesshWnd()) = 0 Then

            IsAccessMinimized = False

         Else

            IsAccessMinimized = True

         End If

      End Function

      Function IsAccessRestored ()

         If IsAccessMaximized() = False And _

               IsAccessMinimized() = False Then

            IsAccessRestored = True

         Else

            IsAccessRestored = False

         End If

      End Function

3. To run these functions, type "? <function name>()" (without quotation

   marks) in the module's Immediate window. For example, type

      ? IsAccessMaximized()

   to return a -1 if the Microsoft Access window is maximized, or a 0 if it

   is not.

How to Move and Size the Microsoft Access Window:

1. Add the following to the module's Declarations section:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Declare Sub MoveWindow Lib "User" (ByVal hWnd As Integer, _

         ByVal X As Integer, ByVal Y As Integer, _

         ByVal nWidth As Integer, ByVal nHeight As Integer, _

         ByVal bRepaint As Integer)

2. Enter the following function in the module:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Function AccessMoveSize (iX As Integer, iY As Integer, _

         iWidth As Integer, iHeight As Integer)

         MoveWindow GetAccesshWnd(), iX, iY, iWidth, iHeight, True

      End Function

To move the Microsoft Access window to the upper left corner of the screen

and size it to the standard VGA display size of 640 x 480 pixels, type the

following in the module's Immediate window:

   ? AccessMoveSize(0, 0, 640, 480)

On a computer configured with the standard VGA video driver, this will give

the Microsoft Access window the appearance of being maximized, although it

is really restored and sized to fill the screen. Note that the dimensions

you supply to this function are in pixels.

REFERENCES

==========

For information about how to determine the current screen resolution, query

on the following words here in the Microsoft Knowledge Base:

   get and screen and resolution

Additional reference words: 1.00 1.10 2.00 hWnd hWindow hWin

KBCategory:

KBSubcategory: PgmApi


INF: How to Get Field Data Types from a Table Using DDE

Article ID: Q102520

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The functionality of the DDE FieldNames item has been enhanced in

Microsoft Access version 1.1 by adding the ability to get the field

type for the field. In Microsoft Access version 1.0, the FieldNames

item could get the field name, but not the field type. The new item is

called FieldNames;T, and can be requested on any open Microsoft Access

database.

Examples showing how to use this DDE feature from Microsoft Excel and

Microsoft Word for Windows are listed below.

MORE INFORMATION

================

The following sample Microsoft Excel macro demonstrates how to use the

FieldNames;T item to get the field name and field type from the

Categories table in the sample database NWIND.MDB:

1. Start Microsoft Access and open NWIND.MDB.

2. Start Microsoft Excel and open a new worksheet.

3. Select cells A1-D2.

4. Type the formula:

      =MSAccess|'C:\ACCESS\NWIND.MDB;Table Categories'!'Fieldnames;T'

5. Press CTRL+SHIFT+ENTER. This will enter the formula as an array

   formula. The results will be propagated through the selected range.

The following information will be returned:

   Category ID    Category Name    Description    Picture

       10             10               12           11

The numeric values returned describe the data type for the field. The

data types are:

    0    Invalid

    1    True/False (non-Null)

    2    Unsigned byte (Byte)

    3    2-byte signed integer (Integer)

    4    4-byte signed integer (Long)

    5    8-byte signed integer (Currency)

    6    4-byte single-precision floating-point (Single)

    7    8-byte double-precision floating-point (Double)

    8    Date/Time (integral date, fractional time)

    9    Binary data, 255 bytes maximum

   10    ANSI text, not case sensitive, 255 bytes maximum (Text)

   11    Long binary (OLE Object)

   12    Long text (Memo)

The following example for Microsoft Word for Windows demonstrates how

to use the FieldNames;T item to get the field name and field type from

the Categories table in the sample database NWIND.MDB:

1. Start Microsoft Access and open NWIND.MDB.

2. Start Microsoft Word for Windows and open a new document.

3. From the Insert menu, choose Field.

4. Type the following formula in the Field Codes box, and then choose

   OK:

   DDE MSAccess "C:\\ACCESS\\NWIND.MDB;Table Categories" FieldNames;T

The following information will be displayed:

   Category ID    Category Name    Description    Picture

       10              10              12           11

Some formatting of the text may be necessary to align the field type

descriptor numerals under the table names.

NOTE: If you see the formula you typed instead of this data, and you

are using Word 6.0 for Windows, you need to clear the Field Codes

check box on the View tab by choosing Options from the Tools menu. If

you are using Word 2.0 for Windows, choose Field Codes from the View

menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpDde


INF: How To Get Microsoft Works Files into Microsoft Access

Article ID: Q93698

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not directly import the Microsoft Works for

Windows or Microsoft Works for MS-DOS database (.WDB) file format.

Microsoft Access does, however, import any version of Microsoft Works

spreadsheet (.WKS) files. This article explains how you can transfer

your database and spreadsheet files from Microsoft Works into

Microsoft Access tables.

MORE INFORMATION

================

You can import spreadsheet files (.WKS) directly into Microsoft

Access. To import database files you should save them as dBase III or

IV files, or convert them to Works spreadsheet files first.

Microsoft Works for Windows Database files

------------------------------------------

Database files created in Microsoft Works can be imported by Microsoft

Access if they are converted to a dBase III or IV file format. The

conversion retains field names and most data types, with these

exceptions:

 - Currency fields are converted to Number fields.

 - Fields defined as formulas are converted to Number fields with

   values.

Conversion process:

1. Start Microsoft Works and open your Works database file.

2. From the File menu choose Save As.

3. Using the Save File As Type box, change the format to dBase

   III or dBase IV.

4. Change the name of the file so it has a .DBF extension and choose

   OK.

5. Start Microsoft Access and open the .MDB file you want to import

   to.

6. From the File menu choose Import.

7. Select dBase III or dBase IV from the format list.

8. Select the name of your .DBF file from the list. If it does not

   appear in the list you may need to change the drive and directory

   to the correct location.

9. Choose the Import button. The file is imported as a Microsoft

   Access table with the same name as the .DBF file.

Microsoft Works for MS-DOS Database files

-----------------------------------------

Save your Microsoft Works 2.0 database files in the format "Text &

Commas". Microsoft Access imports this file type as Text (delimited)

files.

Save your Microsoft Works 3.0 database files in dBase III or dBase IV

format following the method outlined above.

Microsoft Works spreadsheet files (either version)

--------------------------------------------------

Spreadsheet files, created in either the MS-DOS or Windows version of

Works, can be imported by Microsoft Access with little effort. If the

first row of the spreadsheet contains a name for each column this can

be recognized as the name of each field in the new Microsoft Access

table. If there is only data in the spreadsheet Microsoft Access

creates default field names for the table. Most data types are

retained, with these exceptions:

 - Fields formatted as TRUE or FALSE are converted to Number fields.

   A FALSE value is converted to 0 and a TRUE value is converted

   to 1.

 - Formula fields are converted to Number fields with values.

Conversion process:

1. Start Microsoft Access and open the .MDB file you want to import

   the Microsoft Works spreadsheet file to.

2. From the File menu, choose Import.

3. Select Lotus (WKS) from the format list.

4. Select the name of the .WKS file from the list. If it does not

   appear, you may need to change the drive and directory to the

   correct location.

5. If the first row of the spreadsheet contains the column names,

   select the option "First Row Contains Field Names".

6. Select the Import button. The file will be imported as a Microsoft

   Access table with the same name as the .WKS file.

Depending upon the type of data in your Microsoft Works files, you may

choose either method to convert files to Microsoft Access tables.

REFERENCES

==========

For more information about sharing Microsoft Works data with other

progams, see the Microsoft Works "User's Guide."

Microsoft Access "User's Guide," version 1.0, pages 64-65 and 72-75

Additional reference words: 1.00 1.10 2.00 spreadsheet dbase

KBCategory:

KBSubcategory: IntpOthr


INF: How to Get Record Position Number from Record Selector

Article ID: Q103260

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not provide a way to retrieve the position

number found in the record selector at the bottom of the form or

datasheet.

This article demonstrates a sample user-defined Access Basic function

called GetRecordPosition() that you can use to retrieve the current record

position. This article also explains how to use the GetRecordPosition()

function to create your own custom record position box on a form.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The number that appears in the record selector is actually not a

record number. It is a number used to indicate the record's relative

position in the current record set, not the record's natural position

in the table.

The following Access Basic function, GetRecordPosition(), can be used

to get the record's relative position in the record set. Add this

function to a new or existing module.

   'Global Declaration Section

   Option Explicit

   '***************************************************************

   ' FUNCTION: GetRecordPosition

   '

   ' PURPOSE:

   '   Gets the number representing the relative position of the

   '   record in the currently active form. This is the number that

   '   appears in the record selector found at the bottom of a form

   '   or datasheet.

   '

   ' RETURN:

   '   The relative record position. If there are no records in

   '   the active form's dynaset, or if there is no active form,

   '   Null is returned.

   '

   '***************************************************************

   Function GetRecordPosition ()

       Const ERR_NO_CURRENT_RECORD = 3021

       Dim DS As Dynaset

       Dim RecordPos As Long

       On Error GoTo Err_GetRecordPosition

       Set DS = Screen.ActiveForm.Dynaset

       DS.Bookmark = Screen.ActiveForm.Bookmark

       RecordPos = 0

       While Not DS.BOF

           DS.MovePrevious

           RecordPos = RecordPos + 1

       Wend

       GetRecordPosition = RecordPos

   Bye_GetRecordPosition:

       Exit Function

   NoCurrentRec_GetRecordPosition:

       On Error Resume Next

       DS.MoveLast

       If Err <> 0 Then

           ' There must be no records in the set, so new record is 1

           GetRecordPosition = 1

       Else

           ' We are on last record of set, so count + 1

           GetRecordPosition = DS.RecordCount + 1

       End If

       GoTo Bye_GetRecordPosition

   Err_GetRecordPosition:

       Select Case Err

           Case ERR_NO_CURRENT_RECORD

               Resume NoCurrentRec_GetRecordPosition

           Case Else

               Resume Bye_GetRecordPosition

       End Select

   End Function

Creating a Record Position Box on a Form

----------------------------------------

Use the following steps to create your own custom record position box

on a form using the GetRecordPosition() function:

1. Create a new macro called Refresh Record Position with the

   following macro action:

      Requery

         ControlName: Record Position

2. Open your form in Design view. Make sure that the Form Hdr/Ftr

   option is selected on the Layout menu.

3. Create a text box in the footer with the following properties:

      Name: Record Position   (ControlName: Record Position in version 1.x)

      ControlSource: =GetRecordPosition()

4. Set the following properties on the form (not on the control):

      OnCurrent: Refresh Record Position

      AfterUpdate: Refresh Record Position

   The current record position will display in the text box in the

   footer of the form either when you navigate to a different record

   or when a new record is created.

   NOTE: The AfterUpdate property of the form is set in the event a

   new record is created and written to disk. The current record

   position may need to account for this new record.

REFERENCES

==========

For more information on record numbers, query on the following words

here in the Microsoft Knowledge Base:

   access and record and numbers and position

Additional reference words: 1.00 1.10 2.00 VCR

KBCategory:

KBSubcategory: PgmOthr


INF: How to Get Red, Green, or Blue Components from RGB Value

Article ID: Q112061

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function,

GetRGB(), that returns the red, green, or blue component from an RGB color

value. Note that this behavior is the opposite of the Access Basic function

RGB().

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

RGB color values are mathematical combinations of red, green, and blue

components. The intensities of these components can range from 0 to 255.

For example, the RGB color value for white is 16777215, which has component

intensities of 255 for red, green, and blue.

The following example demonstrates how to use the GetRGB() function to

return the RGB color components from the RGB color value in the Order

form's detail section BackColor property:

1. Open the sample database NWIND.MDB.

2. Create a new module and add the following line to the Declarations

   section:

      Option Explicit

3. Create the following function in the module:

      '-----------------------------------------------------------------

      'PURPOSE: Returns red/green/blue color from RGB color value.

      'ACCEPTS: RGB color value as Long, and component number as integer

      '         that represents the component color to return (1=red,

      '         2=green, 3=blue).

      'RETURNS: The intensity of the color component (0 - 255) as an

      '         integer or -1 indicating that an argument was invalid.

      '-----------------------------------------------------------------

      Function GetRGB (RGBval As Long, Num As Integer) As Integer

         ' Check if Num, RGBval are valid.

         If Num > 0 And Num < 4 And RGBval > -1 And RGBval < 16777216 Then

           GetRGB = RGBval \ 256 ^ (Num - 1) And 255

         Else

           ' Return True (-1) if Num or RGBval are invalid.

           GetRGB = True

         End If

      End Function

4. Save the module as MyUtilities and then close it.

5. Create the following macro with the actions listed:

      Action   Comment

      --------------------------------

      MsgBox   Display red component

      MsgBox   Display green component

      MsgBox   Display blue component

      MsgBox Action

      -------------------------------------------------------------------

      Message: =GetRGB(Forms![Orders].Section(0).Backcolor,1) & ": Red"

      Message: =GetRGB(Forms![Orders].Section(0).Backcolor,2) & ": Green"

      Message: =GetRGB(Forms![Orders].Section(0).Backcolor,3) & ": Blue"

6. Save the macro as GetRGB and then close it.

7. Open the Orders form in Form view.

8. From the Database window, run the GetRGB macro.

Note that you can change the BackColor property of the detail section of

the Orders form and then run the macro again to see the results change.

REFERENCES

==========

Microsoft Access "Language Reference," versions 1.0 and 1.1, pages 403-404

For more information about the RGB() function, search for "RGB" then "RGB

Function" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 video screen

KBCategory:

KBSubcategory: PgmOthr


INF: How to Get the Last Two Digits of the Year

Article ID: Q95907

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to display only the last two digits of the

year. The expression

   =Year(Now())

displays all four digits of the current year (for example, 1993).

In order to display only the last two digits of the year (for example,

93), use one of the following expressions:

   =Format(Now(),"yy")

   -or-

   =Right(Str(Year(Now())),2)

The breakdown of expression 2 is:

 - Now() returns the today's date and time.

 - Year(Now()) returns the current year.

 - Str(...) converts the date to a string data type.

 - Right(...,2) returns the right two characters.

REFERENCES

==========

For more information on the first expression, search for "formatting dates"

then "Format Property-Date/Time Data Types" using the Microsoft Access Help

menu.

For more information about the elements in the second expression, search

for "year," "right," "str," or "now" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ExrOthr


INF: How to Get the Name and Path of the Current Database

Article ID: Q113919

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function that

uses data access objects (DAO) to return the name and path of the current

database.

MORE INFORMATION

================

A Database object in the Databases collection has a Name property that will

return the name and path of the database.

The following Access Basic function demonstrates how to access the

Name property of the current database:

1. Create a new module with the following in the Declarations section:

      Option Explicit

2. Enter the following function in the module:

      Function GetNamePath ()

         Dim MyDB As Database

         ' Set MyDB to the current database.

         Set MyDB = DBEngine.Workspaces(0).Databases(0)

         ' Return the value in the Name property.

         GetNamePath = MyDB.Name

      End Function

3. From the View menu, choose Immediate Window.

4. In the Immediate window, type the following, and then press

   ENTER:

      ? GetNamePath()

The path and name of the current database will be displayed in the

Immediate window.

NOTE: Do not confuse this function with the CurDir$() function, which

returns the path of the current directory. The current directory may not be

the directory where the current database is located.

REFERENCES

==========

For more information about the Database object and Databases collection,

search for "Database" then "Database Object, Databases Collection," using

the Microsoft Access Help menu.

Additional reference words: 2.00 AB Programming

KBCategory:

KBSubcategory: PgmOthr


INF: How to Give Users the Ability to Change Passwords

Article ID: Q100970

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to distribute a secure application with the

Microsoft Access Distribution Kit or Developer's Toolkit and still give

your users the ability to change their passwords.

MORE INFORMATION

================

To achieve this functionality, do the following:

1. Make the Database window active so that you can access the Security

   menu. (The best method for this is to select an object in the Database

   window through a macro).

2. From the Security menu, choose Password. The user then changes the

   password.

3. Once the user has closed the Password dialog box, set the focus

   back to the form you called the macro or function from.

   Here is a sample macro:

      Macro:Change Password

      ---------------------

      Actions

      -------

      SelectObject

      DoMenuItem

      SelectObject

      Action arguments

      ----------------

      SelectObject

          Object Type: Macro

          Object Name: Autoexec

          In Database window: Yes

      DoMenuItem

          Menu Bar: Database

          Menu Name: Security

          Command: Change Password

          Subcommand:

      SelectObject

          Object Type: Form

          Object Name: Form1

          In Database window: No

The Database window appears, as well as the dialog box to change the

password. You cannot select anything in the Database window because

the Change Password dialog box is modal.

In the Microsoft Access Distribution Kit or Developer's Toolkit, the

functionality is identical except that the Database window is not

displayed.

Additional reference words: 1.00 1.10 2.00 container adk adt

KBCategory:

KBSubcategory: ScrtOthr


INF: How to Group Column Headings in a Crosstab Query

Article ID: Q109949

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to group values in a crosstab query using a

fixed number of headings, rather than having a column for every value.

MORE INFORMATION

================

The following example demonstrates how to use the Switch() function to

group non-numeric values under four fixed headings. The headings are

A-F, G-O, P-Z, and Other.

1. Open the sample database NWIND.MDB.

2. Create the following query based on the Orders and Customers tables.

   NOTE: In the following example, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this

   example.

      Query: Switch Limits Headings

      --------------------------------------------------------------

      Type: Crosstab Query

      Join: Orders.[Customer ID] <-> Customers.[Customer ID]

      Field: Country

         Table: Customers

         Total: Group By

         Crosstab: Row Heading

      Field: Expr1: Switch([Company Name] Like "[A-Fa-f]*", "A-F", _

             [Company Name] Like "[G-Og-o]*", "G-O", [Company Name]_

             Like "[P-Zp-z]*", "P-Z", True, "Other")

         Total: Group By

         Crosstab: Column Heading

      Field: Order ID

         Table: Orders

         Total: Count

         Crosstab: Value

   Note that both "A-F" and "a-f" are required in the Switch() function's

   argument because the argument is case sensitive. The "True" in the

   argument acts like an Else condition, collecting data that does not

   match any of the previous conditions.

3. Run the query.

REFERENCES

==========

For more information about crosstab queries, search for "crosstab queries"

then "Summarizing Data Using a Crosstab Query" using the Microsoft Access

Help menu.

For more information about the Switch() function, search for "Switch" then

"Switch Function" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryCross


INF: How to Hide Objects In the Database Window

Article ID: Q114683

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are developing an application, you may want to create an object

that is hidden in the Database window. Hiding objects helps reduce the

number of objects available to users of your application, while still

allowing them to return to the Database window.

This article describes how to create an object that is hidden in the

Database window.

MORE INFORMATION

================

You can hide an object by causing Microsoft Access to treat the object as a

system object. Note that the Show System Objects option must be set to No

in the Options dialog box in order for this method to work.

To hide an object, prefix the object name with "USYS" (without quotation

marks). For example, to hide the Employees table in the sample database

NWIND.MDB, change its name to USYSEmployees. Tables, queries, forms,

macros, reports, and modules can all be hidden in this way.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 3

Microsoft Access "Building Applications," version 2.0, page 359

Additional reference words: 2.00 usys temporary invisible

KBCategory:

KBSubcategory: GnlApp


INF: How to Hide the Database Window at Startup

Article ID: Q88160

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

During normal startup of Microsoft Access, the Database window is visible.

If you do not want to give a user access to the Database window, you can

create an Autoexec macro that will hide the Database window. This article

describes how to create a macro to do this.

MORE INFORMATION

================

When a Microsoft Access database is first loaded, Microsoft Access checks

for an Autoexec macro and runs it if it exists. The following macro will

hide the Database window from the user:

1. From the File menu, choose New to create a new database. Give the

   database a unique name.

2. From the File menu, choose New and then choose Macro to create a new

   macro.

3. Add the following actions:

      Action              Comment

      ------------------------------------------------------------------

      SelectObject        Select an object in the Database window so the

                          focus is set to the Database window.

      DoMenuItem          Hide the object that has the current focus.

4. Set the following properties for the actions entered above:

      SelectObject Action

      -----------------------

      Object Type: Macro

      Object Name: Autoexec

      In Database Window: Yes

      DoMenuItem Action

      -----------------

      Menu Bar: Form

      Menu Name: Window

      Command: Hide

5. From the File menu, choose Save As, and save the macro as

   Autoexec.

6. Close and reopen the database.

The macro will hide the Database window. However, menu items (Show window

on the File menu) will still exist to show the Database window. To hide

these items, you can create a custom menu for your application, or disable

the Show command on the File menu.

REFERENCES

==========

For more information on custom menus, search for "customizing menus" using

the Microsoft Access Help menu.

For more information on using Windows API function calls to disable menu

commands, query on the following words here in the Microsoft Knowledge

Base:

   GetMenu and GetSubMenu

Additional reference words: 1.00 1.10 2.00 gray grey dimmed

KBCategory:

KBSubcategory: McrActn


INF: How to Import a Data File to a Control on a Form

Article ID: Q109393

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to write the contents of a text data file to

a control on a form.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The sample code below will read the contents of your CONFIG.SYS file into a

text box on a form. Note that you can substitute any text file for the

CONFIG.SYS file in this example.

1. Create a new, blank form.

2. Place a text box on the form. Set its Name property to My_Text1. Size

   the text box large enough to fit the contents of the text file that will

   be read in.

   NOTE: In Microsoft Access version 1.x, the Name property is called the

   ControlName property.

3. Place a command button on the form. Set the button's properties as

   follows:

      OnClick: =WriteFile()

      Caption: Bring Text In

   NOTE: In Microsoft Access version 1.x, the OnClick property is called

   the OnPush property.

4. Save the form as Form1.

5. Create a new module, and enter the following sample code:

      '==================================

      'Declarations section of the module

      '

      Option Explicit

      '==================================

      Function WriteFile ()

         Dim Linedata as String

         Dim WholeFile as String     'These variables are used to

                                     'temporarily store the lines of

                                     'the file.

         Open "C:\CONFIG.SYS" For Input As #1

                                     'Open the read file.

         Do While Not EOF(1)         'Continue reading until end-of-

                                     'file is reached.

            Line Input #1, Linedata  'Read a line of data.

            WholeFile = WholeFile + Chr(13) & Chr(10) + Linedata

                                     'Store each line of data in the

                                     'variable "WholeFile," padded

                                     'with carriage return and line-

                                     'feed characters on the end of

                                     'each line.

         Loop

         Forms!Form1![My_Text1] = WholeFile

                                     'Transfer accumulated lines to

                                     'text box control.

         Close #1                    'Close the data file.

      End Function

6. View the form in Form view. Choose the Bring Text In button.

Note that you can erase the contents of the text box by setting it to

an empty variable, such as:

   Forms!Form1![My_Text1] = Null   'Erases the text.

You can call this variable from the Immediate window, or you can assign

it to another button on the form.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmObj


INF: How to Import a Microsoft Windows Cardfile Data File

Article ID: Q98797

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function that you

can use to import a Microsoft Windows Cardfile (.CRD) file.

MORE INFORMATION

================

The function below can be used to import a Microsoft Windows Cardfile

data file. To use this function, you need to add it to a new or

existing Microsoft Access module. In addition, you need to create

the following table in your database before running the function:

   Table Name: CardFile

   --------------------

   Field: Title

      Type: Text

      Length: 50

   Field: Comment

      Type: Text

      Length: 255

You can run the function from the Immediate window, or you can call it

from a command button by setting a command button's OnPush property to:

   =Import_CRD()

NOTE: In Microsoft Access version 2.0, the OnPush property is named the

OnClick property.

Make sure to substitute the correct path and filename for the .CRD file you

want to import in the function below. Or, you can pass the path and

filename to the function as a string argument.

Code for the Import_CRD() Function

----------------------------------

   Option Compare Binary

   Option Explicit

   Type CRD_Record_Type

       Reserved As String * 6

       Position As Long

       Flag As String * 1

       Index As String * 40

       EndOfRecord As String * 1

   End Type

   Function Import_CRD ()

       Const VER30 = &H474D&

       Const VER31 = &H5252&

       Const VER30_NUMRECORDS_OFFSET = &H4&

       Const VER31_NUMRECORDS_OFFSET = &H8&

       Const VER30_FIRSTENTRY = &H6&

       Const VER31_FIRSTENTRY = &HA&

       Dim MyDB As Database

       Dim MyTable As Table

       Dim FileNum#

       Dim NumberOfCards%, NextRecord&, I%, VersionInfo%, EntryLength%

       Dim CRD_Record As CRD_Record_Type

       Dim Message$

       Dim n As Integer

       Set MyDB = CurrentDB()

       Set MyTable = MyDB.OpenTable("CardFile")

       FileNum# = FreeFile

       'Be sure to supply the correct path and filename for the .CRD file.

       Open "c:\my_cards.crd" For Binary As FileNum#

       'The number of files in the .CRD file is at the 4 bytes offset.

       Get #FileNum, , VersionInfo%

       If VersionInfo% = VER31 Then

           Get #FileNum, VER31_NUMRECORDS_OFFSET, NumberOfCards%

           NextRecord& = VER31_FIRSTENTRY

       ElseIf VersionInfo% = VER30 Then

           Get #FileNum, VER30_NUMRECORDS_OFFSET, NumberOfCards%

           NextRecord& = VER30_FIRSTENTRY

       End If

       For I% = 1 To NumberOfCards%

           Get #FileNum, NextRecord&, CRD_Record

           Get #FileNum, CRD_Record.Position + 3, EntryLength%

           Message$ = Space$(EntryLength%)

           Get #FileNum, CRD_Record.Position + 5, Message$

           MyTable.AddNew

               n = InStr(CRD_Record.Index, Chr$(0))

               If n > 1 Then

                   MyTable.Title = Left$(CRD_Record.Index, n - 1)

               ElseIf n = 1 Then

                   MyTable.Title = ""

               Else

                   MyTable.Title = CRD_Record.Index

               End If

               n = InStr(Message$, Chr$(0))

               If n > 1 Then

                   MyTable.Comment = Left$(Message$, n - 1)

               ElseIf n = 1 Then

                   MyTable.Comment = ""

               Else

                   MyTable.Comment = Message$

               End If

           MyTable.Update

           NextRecord& = NextRecord& + Len(CRD_Record)

       Next I%

       Close

   End Function

REFERENCES

==========

For information about the format of .CRD files, query on the following

words here in the Microsoft Knowledge Base:

   cardfile and format and graphic and absolute and hexadecimal

Additional reference words: 1.00 1.10 2.00 .crd

KBCategory:

KBSubcategory: IntpOthr


INF: How to Import FoxBase for Macintosh Files

Article ID: Q109331

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

FoxBase for Macintosh files can be imported into or attached to Microsoft

Access by specifying a dBASE III data source file type.

MORE INFORMATION

================

Although you can import or attach FoxBase for Macintosh files in Microsoft

Access by specifying a dBASE III data source file type, make sure to note

the following restrictions:

 - You cannot import FoxBase for Macintosh files that contain fields with

   a PICT data type. The PICT data type is similar to the Microsoft Access

   OLE data type. If you import a file that contains a field with a PICT

   data type, you will receive the following error message:

      External table isn't in the expected format.

 - You can import FoxBase for Macintosh files that contain memo fields only

   if the associated .DBT file is present. The .DBT file must be located in

   the same directory as the FoxBase (.DBF) file. The .DBT file will be

   incorporated into the Microsoft Access table and is not needed by

   Microsoft Access after the import process is complete.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 4, "Importing,

Exporting, and Attaching," pages 60-64

Additional reference words: 1.00 1.10 2.00 Foxbase Import Macintosh

KBCategory:

KBSubcategory: IsmXbase


INF: How To Import or Attach Paradox for Windows 1.0 Files

Article ID: Q109716

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 1.x can attach and import Paradox version 3.x for

DOS tables. Microsoft Access version 2.0 can attach and import Paradox

version 3.x and 4.x for DOS tables. Neither Microsoft Access version 1.x

nor 2.0 can attach or import Paradox version 1.0 for Windows tables

directly.

In Microsoft Access version 1.x, attempting to attach or import a Paradox

version 1.0 for Windows table causes you to be prompted for a password.

In Microsoft Access 2.0, you receive the error message:

   Can't open this Paradox <n>.x table because ParadoxNetStyle is set to

   3.x in MSACCESS.INI

In the error message above, <n> is either 3 or 4, depending on the Paradox

version selected in the Import or Attach dialog box.

MORE INFORMATION

================

To attach or import a Paradox version 1.0 for Windows table you must first

export the table in Paradox to dBASE IV format. The following steps

describe how to export the table in dBASE IV format:

1. In Paradox 1.0 for Windows, choose Utilities from the File menu,

   then choose Copy.

2. In the Copy File From line, enter the name of the file you want to

   export.

3. In the Copy File To line, enter a new name for the file. Give the file

   a .DBF extension. This extension causes Paradox 1.0 for Windows to save

   the file in dBASE IV format.

4. Start Microsoft Access and import or attach the .DBF file.

Paradox is manufactured by Borland International, a vendor independent of

Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 Importing

KBCategory:

KBSubcategory: IsmPdox


INF: How to Import Several dBASE Databases Simultaneously

Article ID: Q88764

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to import dBASE databases in a batch process

using Access Basic.

Many new Microsoft Access users want to immediately import data from the

systems they are currently using. The Import dialog box in Microsoft Access

allows you to import one table at a time, which usually is sufficient.

However, some users have numerous tables to import, or they may want to

import multiple tables regularly.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

Importing tables with a batch process can be done quickly using an Access

Basic procedure and a batch table. This procedure is designed for importing

only dBASE databases, but it can easily be modified to accommodate other

file formats.

The batch table lists the tables that you want to import. The Access Basic

procedure reads the table and imports each foreign table listed there. To

do this, use the following procedure:

1. Create a table called Batch Import with the following structure:

      Field name         Type   Length

      --------------------------------

      Source Directory   Text   50

      Source Database    Text   50

      Imported Name      Text   50

      Type of Table      Text   50

2. Enter information in the new Batch Import table about the tables you

   want to import. The fields in the Batch Import table should be

   filled out as follows:

    - Source Directory: This is the full path for the location of the

      foreign database file (for example, C:\DBASE).

    - Source Database: This is the name and extension of the dBASE

      database you want to import (for example, CUSTOMER.DBF).

    - Imported Name: This is the name you want the table to have once it

      is imported into Microsoft Access (for example, Customers).

    - Table Type: This can be either dBASE III or dBASE IV. Specify dBASE

      III for both dBASE III and dBASE III PLUS databases.

   For example, to import a dBASE IV database called EMPLOYEE.DBF from the

   C:\DBASE4 directory and a dBASE III database called ORDERS.DBF from the

   D:\DBASE3\DATA directory, you would fill out the fields in the Batch

   Import table as follows:

      Source Directory   Source Database  Imported Name   Table Type

      --------------------------------------------------------------

      C:\DBASE4          EMPLOYEE.DBF     Employee Table  dBASE IV

      D:\DBASE3\DATA     ORDERS.DBF       Orders Table    dBASE III

3. Create a new module, and enter the following code:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Sub BatchImport ()

         Dim B_DB As Database, B_TBL As Table

         Set B_DB = CurrentDB()

         Set B_TBL = B_DB.OpenTable("Batch Import")

         DoCmd Hourglass True

         B_TBL.MoveFirst

         Do Until B_TBL.EOF

            DoCmd TransferDatabase A_IMPORT, B_TBL![Type of Table],_

             B_TBL![Source Directory], A_TABLE, B_TBL![Source Database],_

             B_TBL![Imported Name], False

            B_TBL.MoveNext

         Loop

         DoCmd Hourglass False

      End Sub

4. Import the foreign databases as follows:

   a. Open a module.

   b. From the View menu, choose Immediate Window.

   c. Type the following command, and then press ENTER:

         BatchImport

The pointer will become an hourglass and remains so until all of your

databases are imported. This process may take several minutes, depending on

the sizes of the databases.

dBASE III, dBASE III PLUS, and dBASE IV are manufactured by Borland

International, Inc., a vendor independent of Microsoft; we make no

warranty, implied or otherwise, regarding the performance or reliability of

these products.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmXbase


INF: How to Index an Existing Field with DAO

Article ID: Q112107

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to create a compound (multiple-field) index

in an existing table using data access objects (DAO).

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual, Chapter 3, "Introducing Access

Basic."

MORE INFORMATION

================

An Index object contains the fields that are being indexed, and usually

contains only a single field. The Index object created in the example below

will have two fields appended to it, creating a multiple-field index.

The example below demonstrates how to create a multiple-field index with

DAO:

 1. Open the sample database NWIND.MDB.

 2. Create the following new table:

    Table: Interviews

    --------------------------

    FieldName: CustomerID

       DataType: Number

       FieldSize: Long Integer

    FieldName: InterviewerID

       DataType: Number

       FieldSize: Long Integer

    FieldName: Appointment

       DataType: Date/Time

 3. Save the table as Interviews without creating a primary key, then

    close it.

 4. Create a new module and enter the following Declaration:

       Option Explicit

 5. Create the following function in the module:

       '---------------------------------------------------------------

       'PURPOSE: Adds a multiple-field index to a table.

       'ACCEPTS: Nothing.

       'RETURNS: Nothing.

       '---------------------------------------------------------------

       Function AddMultiIndex ()

          Dim DB As Database, TDef As TableDef

          Dim Idx As Index, Fld As Field

          Set DB = DBEngine.Workspaces(0).Databases(0)

          ' Open the table definition.

          Set TDef = DB.TableDefs("Interviews")

          ' Create an index called PrimaryKey for this TableDef

          ' .. and turn on the Primary and Required properties.

          Set Idx = TDef.CreateIndex("PrimaryKey")

          Idx.Primary = True

          Idx.Required = True

          Idx.Ignorenulls = False

          ' Create an index field with the same name as a table field,

          ' .. then append it to the index.

          Set Fld = Idx.CreateField("CustomerID")

          Idx.fields.Append Fld

          '   Do the second field the same way.

          Set Fld = Idx.CreateField("InterviewerID")

          Fld.Attributes = DB_DESCENDING

          Idx.fields.Append Fld

          '   Append the index to the TableDef.

          TDef.indexes.Append Idx

       End Function

 6. Save the module as DAOaddMultiIndex.

 7. From the View menu, choose Immediate Window.

 8. Type the following in the Immediate window, then press ENTER:

       ? AddMultiIndex()

 9. Close the Immediate window and the module.

10. Open the Interviews table in Design view. Note the compound

    primary key on the CustomerID and InterviewerID fields.

REFERENCES

==========

For more information about Index objects, search for "Index" then "Index

Object, Indexes Collection" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Launch MS Wizards with WLib_WizMain() Function

Article ID: Q115121

UifOthr


INF: How to Make a Combo Box Default to First Item in List

Article ID: Q105519

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you move to a new record on a form that has a combo box or a list box,

the combo box will be blank or the list box will not have any value

selected. The combo box or list box may have a table or query defined in

its RowSource property that provides the list of items to display in the

box. Since the data in the underlying RowSource property will vary with the

addition or deletion of records, it is difficult to know what item will

appear at the top of the list when the form is used.

This article describes how to force a list box or combo box to default to

the first row in the underlying list. The methods outlined in this article

work only if the combo box is bound to a field.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

Microsoft Access Version 2.0

----------------------------

In Microsoft Access version 2.0, you can use the ItemData method to cause a

list box or combo box to default to any row. To have the first row selected

automatically, set the box's DefaultValue property to the following:

   =[<MyCombo>].ItemData(0)

Microsoft Access Version 1.x

----------------------------

The first method below uses a user-defined Access Basic function, and the

second method uses the built-in DLookUp() function, to display the first

value in the list automatically.

Method 1:

The following example demonstrates a sample Access Basic function called

GetFirst() that can be used to find the first item in the underlying

table or query. The function's result can be used by the DefaultValue

property to automatically select the first item in the list.

To create the GetFirst() function, add the following to a new or existing

module:

   Option Explicit

   Function GetFirst (BoundColName As String, RowSource As String)

      Dim DB As Database

      Dim DS As Dynaset

      Set DB = CurrentDB()

      Set DS = DB.CreateDynaset(RowSource)

      On Error Resume Next

      DS.MoveFirst

      If Err = 0 Then GetFirst = DS(BoundColName)

   End Function

Note that the first argument of the GetFirst() function is the name of

the field that is used as the BoundColumn property for the combo box. The

second argument is the name of the table or query specified in the

RowSource property of the combo box.

The following example demonstrates how to use GetFirst() to automatically

select the first employee in the Salesperson combo box on the Orders form

in the sample database NWIND.MDB:

1. Open the Orders form in Design view.

2. Select the Salesperson combo box. Display the property sheet by

   choosing Properties from the View menu.

3. Set the DefaultValue property to the following:

      =GetFirst("Employee ID", "Employee List")

4. View the form in Form view.

5. From the Records menu, choose Data Entry.

Note that the combo box automatically displays "Buchanan, B.L."

Differences Between GetFirst() and DFirst():

The GetFirst() function is similar to the built-in DFirst() aggregate

function. However, DFirst() may return unexpected results when used to find

the first item in a list.

If the underlying table or query is indexed, the value returned by DFirst()

will be the first indexed record. Otherwise, DFirst() will return items in

the actual order in which they were entered in the database. Therefore, if

the RowSource property of a combo box is a query that sorts the data by a

non-indexed field, DFirst() may not return the expected value.

For example, if you change the DefaultValue property of the Salesperson

combo box on the Orders form to

   =DFirst("[Employee ID]", "Employee List")

the item returned will be "Davolio, Nancy," which is not the first item in

the combo box, but the first indexed item in the Employees table.

Method 2:

This method uses the DLookUp() function to look up the first record in the

list. The expression will be the field referred to in the BoundColumn

property (or the ControlSource property) of the combo box or list box. The

domain will be the same table or query that the combo box or list box uses

as its RowSource property. The optional criteria will not be used so that

the DLookUp() function will return the first record.

The following example demonstrates how to use DLookUp() to automatically

select the first employee in the Salesperson combo box on the Orders form

in the sample database NWIND.MDB:

1. Open the Orders form in Design view.

2. Select the Sales Person combo box. View the property sheet by choosing

   Properties from the View menu.

3. Set the DefaultValue property to the following expression:

      =DLookUp("[Employee ID]","Employee List")

4. View the form in Form view.

5. From the Records menu, choose Data Entry.

Note that the combo box automatically displays "Buchanan, B.L."

REFERENCES

==========

For more information about the ItemData method, search for "ItemData" then

"ItemData Method" using the Microsoft Access version 2.0 Help menu.

Microsoft Access "User's Guide," version 1.0, Chapter 9, "Designing Forms,"

pages 233-242

Microsoft Access "User's Guide," version 1.1, Chapter 9, "Designing Forms,"

pages 237-246

Microsoft Access "Language Reference," versions 1.0 and 1.1, pages 131-132,

139-140, and 144-146

Additional reference words: 1.00 1.10 2.00 listbox combobox

KBCategory:

KBSubcategory: FmsCmbo


INF: How to Make the Immediate Window Available at All Times

Article ID: Q88925

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Immediate window is helpful for debugging Access Basic code in

that you can try out an expression to see if it returns the expected

value, or any value at all. The Immediate window can also be helpful for

debugging macros, learning how to use expressions, and more. However,

the Immediate window is only available when a module window is selected.

This article describes how you can make the Immediate window available

at all times.

MORE INFORMATION

================

You can type an expression in the Immediate window and see the results

of that expression, without having to write and run an Access Basic

procedure. To run an expression in the Immediate window, use the Acess

Basic "?" command, as demonstrated below:

   ? 2 + 2

When you type this statement in the Immediate window and press ENTER,

Microsoft Access displays the number 4 just below the expression.

Another example of using the Immediate window is to set the value of a

variable or to test for the value of a variable. For example, set the

value of a variable and then test for the value of the variable with the

following:

   MyVar = 2

   ? MyVar

The "?" statement returns the number 2 since that is the value you

assigned to the variable MyVar.

The Immediate window is helpful for debugging Access Basic code, because

you can suspend execution of the procedure and set the values of variables

in the procedure to see what kind of result you would get with different

values. You can also use the Immediate window to suspend a procedure and

check for the value of a variable or expression to see if it is calculating

as you expect it to.

In the same way that an Immediate window can be helpful for debugging

code, it can also be helpful for other tasks, such as:

 - Trying out a form expression such as Forms!MyForm!MyControl to see

   if it returns a value.

 - Trying out a query expression, such as a DSum().

 - Trying out a macro action with the DoCmd command to see if the macro

   action produces the desired results.

However,the Immediate window is only available when a module window is

selected. You can make the Immediate window available at all times by

following these steps:

1.  In the database window, choose Macro.

2.  If you already have a macro called AutoKeys, open it in design

    mode. Otherwise, choose New.

3.  If the Macro Name column does not appear in the macro sheet,

    choose Macro Names from the View menu.

4.  If the Condition column does not appear in the macro sheet,

    choose Conditions from the View menu.

5.  Add the following action and its corresponding property:

    Macro name    Condition                                 Action

    ------------------------------------------------------------------

    ^I                                                      SendKeys

                                                            DoMenuItem

                                                            SendKeys

                  MsgBox ("IW already on the screen?")=7    DoMenuItem

    SendKeys Action Parameters

    --------------------------

    KeyStrokes: {F11}

    Wait:       Yes

    DoMenuItem Action Parameters

    --------------------------

    Menu Bar:  Database

    Menu Name: View

    Command:   Modules

    SendKeys Action Parameters

    --------------------------

    KeyStrokes: %N

    Wait:       Yes

    DoMenuItem Action Parameters

    --------------------------

    Menu Bar:  Module

    Menu Name: View

    Command:   Immediate Window

6. Save and then close the macro. If the macro is not already called

   AutoKeys, save it with that name.

From this point on, you can press CTRL+I to activate the Immediate

window. Follow these steps for an example of how this works:

1. Open any form in design mode.

2. Press CTRL+I.

   After some screen activity, a prompt appears asking if the

   Immediate window is already on the screen. If you do not see the

   Immediate window on the screen, choose No. Doing so causes

   the macro to execute one extra step that would otherwise not be

   necessary.

   Note that a small module window appears at the upper right-hand side

   of the screen.

   The Immediate window is now available to use.

3. Click once on the form design window or on the Database window.

   The Immediate window disappears.

4. Click once on the module window mentioned in step 2.

   The Immediate window reappears.

You should only need to use CTRL+I once to make the Immediate window

and the shrunken module window appear. Every subsequent request for the

Immediate window can be made by clicking once on the module window. If

the module window is closed, press CTRL+I to bring up the Immediate

window again.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Make Welcome to MS Access Opening Screen Display

Article ID: Q90170

UifOthr


INF: How to Minimize, Maximize, and Restore Microsoft Access

Article ID: Q89597

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Use Microsoft Windows API calls in Microsoft Access modules to maximize,

minimize, and restore Microsoft Access. Microsoft Access does not

provide a function to perform these actions in a module or macro.

MORE INFORMATION

================

Once the following sample functions are defined in a module they can be

used in macros as RunCode actions. Define the functions with these steps:

1. From the File menu, choose New, then Module. In the

   Declarations section add both of the following declarations:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Option Explicit

      Declare Function GetActiveWindow% Lib "User" ()

      Declare Function ShowWindow% Lib "User" (ByVal hWnd%,_

                                               ByVal nCmdShow%)

2. Create the function MaximizeAccess():

      Function MaximizeAccess ()

         Dim ActiveWnd%, Maxit%

         ActiveWnd% = GetActiveWindow()

         Maxit% = ShowWindow(ActiveWnd%, 3)

      End Function

3. Create the function MinimizeAccess():

      Function MinimizeAccess ()

         Dim ActiveWnd%, Minit%

         ActiveWnd% = GetActiveWindow()

         Minit% = ShowWindow(ActiveWnd%,2)

      End Function

4. Create the function RestoreAccess():

      Function RestoreAccess ()

         Dim ActiveWnd%, Restoreit%

         ActiveWnd% = GetActiveWindow()

         Restoreit% = ShowWindow(ActiveWnd%, 1)

      End Function

5. The following sample macro action will minimize the Microsoft

   Access window:

      Action       FunctionName

      -----------------------------

      RunCode      MinimizeAccess()

REFERENCES

==========

"Microsoft Windows Software Development Kit," Microsoft Press, 1992

"Programming Windows: the Microsoft Guide to Writing Applications for

Windows 3," Charles Petzold. Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to

Programming Reference" Volumes 1-6, Microsoft Press, 1992

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: PgmApi


INF: How to Not Display the Form Name in the Caption Bar

Article ID: Q100142

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

Microsoft Access will display the name of the form in the caption bar

by default.

To alter the form so that it does not display a caption, type a single

space in the Caption property of the form.

Additional reference words: 1.00 1.10 2.00 Forms

KBCategory:

KBSubcategory: FmsEvnt


INF: How to Open UTILITY.MDA

Article ID: Q93929

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If you try to open the UTILITY.MDA file, you receive the following

error message:

   The database "UTILITY.MDA" is already open as a library database.

To open the UTILITY.MDA file, you must create a copy of UTILITY.MDA,

rename the copy, and then open it in Microsoft Access.

MORE INFORMATION

================

Use the following steps to open the UTILITY.MDA file.

NOTE: UTILITY.MDA is a collection of tables, forms, and modules used by

Microsoft Access. You should always have a backup copy of UTILITY.MDA; this

is a vital database to Microsoft Access and any changes in it may result in

unexpected behavior.

1. Copy UTILITY.MDA to UTILITY.SAV.

2. In Microsoft Access, open UTILITY.SAV by choosing Open from the

   File menu.

3. Choose OK when the following error message is displayed:

      Tried to load module with duplicate procedure definition:

        <procedure name>

After you make any changes to the copy of UTILITY.MDA, you can rename the

original UTILITY.MDA file and substitute the edited copy of the UTILITY.MDA

file for the one that Microsoft Access uses when the application is opened.

Additional reference words: 1.00 1.10 2.00 errmsg utility

KBCategory:

KBSubcategory: GnlOthr


INF: How to Optimize Microsoft Access Version 2.0 Performance

Article ID: Q112117

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article contains tips for optimizing the performance of Microsoft

Access version 2.0. Much of this information is taken from the Microsoft

Access 2.0 Help file.

Note that the optimal setting for each item may vary with the type of

computer on which you run Microsoft Access. It is usually best to change

only one setting at a time and then monitor database performance for

improvement.

MORE INFORMATION

================

To optimize the general performance of Microsoft Access version 2.0:

 - Use the Add-in Manager to uninstall library databases that contain

   Microsoft Access Wizards, builders, and other add-ins you do not want.

   This reduces Microsoft Access memory consumption and load time.

 - Make more memory available by closing applications and terminate-

   and-stay-resident (TSR) programs that you are not using. Usually,

   these applications are loaded from the AUTOEXEC.BAT and

   CONFIG.SYS files.

 - Make sure your Microsoft Windows virtual memory (swap file)

   setting is large enough, and of type "permanent" rather than

   "temporary." In general, the virtual memory setting plus available

   RAM should be no less than 25 MB. It should be more if you will be

   running several memory-intensive applications simultaneously.

   To check or change the virtual memory setting, start Microsoft

   Windows Control Panel. Double-click the 386 Enhanced icon, then

   choose Virtual Memory. To change the setting, choose Change. Make

   sure to select Permanent in the Type box. Choose OK to save your

   changes. Please see the Microsoft Windows "User's Guide" for more

   detailed information on virtual memory settings.

 - Periodically run a disk defragmentation utility such as MS-DOS

   version 6.0 Defrag to keep files in contiguous clusters on your hard

   disk, making file access quicker in general. If you do not

   defragment your hard disk, the time it takes for MS-DOS to retrieve

   your files may increase since it may have to go to several physical

   locations on the disk to retrieve the entire file.

 - Use 32-bit disk access, and 32-bit file access in Windows 3.11 and

   later. In Windows Control Panel, double-click the 386 Enhanced icon,

   choose the Virtual Memory button, then choose the Change button.

   Make sure the Use 32-Bit Disk Access check box is selected. Also select

   the Use 32-Bit File Access option, if it is available in your version

   of Windows.

 - Increase the RAM on your computer. Microsoft Access requires a minimum

   of 6 MB, but additional RAM improves performance.

 - Make the WinCacheSize parameter for SMARTDrive (or similar settings

   for other disk caches) in your CONFIG.SYS file no larger than

   necessary for effective caching. For computers with limited RAM,

   try completely disabling software caching such as SMARTDrive.

 - Do not use any of your RAM for a RAM disk.

 - Set the Buffers parameter in your CONFIG.SYS file to at least 40.

 - When you are opening databases that are not in a multiuser environment,

   select the Exclusive check box in the Open Database dialog box.

 - When you are using databases that other users do not need to share,

   install Microsoft Access and all your databases on your local hard disk

   rather than on a network server.

 - Create only as many indexes as necessary. Although indexes can speed

   access to data, it is possible to "over index" a table so that it is

   slow adding, deleting, and updating records.

 - Create indexes for joined fields.

 - In a multiple-field index, use only as many fields in the index as

   necessary.

 - Use Rushmore query optimization in your queries whenever possible. For

   detailed information on how to do this, search for "Rushmore technology"

   then "Optimizing Queries with Rushmore Technology" using the Microsoft

   Access Help menu.

 - If you have a wallpaper (full-screen background) bitmap on your Windows

   desktop, replace it with a solid color or pattern bitmap, or no bitmap

   at all. For a standard VGA display, this can free about 256K of RAM. For

   a 1024 x 768 pixel display with 256 colors, this can free about 750K of

   RAM. (Your actual RAM savings depends on your video display.)

REFERENCES

==========

For more information about optimizing Microsoft Access performance,

search for "optimizing performance" using the Microsoft Access Help menu.

Additional reference words: 2.00 General Speeding Improving

KBCategory:

KBSubcategory: GnlOthr


INF: How to Optimize Microsoft Access Version 2.0 Queries

Article ID: Q112112

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article contains tips you can use to help you optimize your Microsoft

Access version 2.0 query performance.

MORE INFORMATION

================

This article assumes that all the tables in your application are local. If

your application uses attached tables the information in this article still

applies, but there are additional performance issues that pertain to

attached tables that can impact query performance. For more information

about improving performance using remotely attached tables, query on the

following words here in the Microsoft Knowledge Base:

   ODBC and Optimizing and Tables

The Query Optimizer

-------------------

The Microsoft Jet database engine contains several components, but the most

important to queries (and the most complex) is the Optimizer. The Optimizer

is "cost-based," meaning that it assigns a time cost to each query task and

then chooses the least expensive list of tasks to perform that generates

the desired result set. The longer a task takes to perform, the more costly

or expensive it is considered to be.

To decide which query strategy to use, the Optimizer uses statistics. These

statistics are based on the number of records in a table, the number of

data pages in a table, the location of the table, whether or not indexes

are used, and so on. Based on these statistics, the Optimizer chooses the

best internal query strategy for dealing with a particular query.

Statistics calculations are done whenever a query is compiled. A query is

compiled whenever you save any changes made to it or to any of the tables

underlying the query. If you have added a significant number of rows to

your table since a query was last compiled, you should open and save the

query to cause it to recompile and thus update the statistics.

You can improve the statistics and thereby reduce overhead search time and

enable the Optimizer to make your queries run faster by using the tips

described below.

Tips to Impove Query Performance

--------------------------------

 - Compact your database. To do this, choose Compact Database from the File

   menu when no database is open. Compaction can speed up queries because

   it writes all the data in a table into contiguous pages on the hard

   disk. Scanning sequential pages is much faster than scanning fragmented

   pages.

 - Avoid expressions in query output. Exressions in query output can cause

   query optimization problems if the query is used as the input to another

   query. In the example below, query Q1 is used as the input for query Q2:

      Q1: SELECT IIF([MyColumn]="H","Hello","Goodbye") AS X

          FROM MyTable;

      Q2: SELECT *

          FROM Q1 WHERE X="HELLO";

   Since the IIF() expression in Q1 cannot be optimized, Q2 also cannot be

   optimized. If an expression gets buried deeply enough in a query tree,

   you can forget that it is there. As a result, your entire string of

   queries cannot be optimized.

   A better way to write the example query above is:

      Q1: SELECT *

          FROM MyTable WHERE MyColumn = "H";

   If expressions are necessary in the output, try to place them in a

   control on a form or report.

 - Place GROUP BY clauses in the same table as aggregates. This is an issue

   when you are joining two tables. For example, if you join two tables on

   the Customer Name field and then run a query that performs a GROUP BY

   operation on the Customer Name field, make sure that both the GROUP BY

   field (Customer Name) and the field that is in the aggregate (Sum,

   Count, and so on) come from the same table.

 - When you are creating a "totals" query, use the GROUP BY clause on as

   few fields as possible. The more fields in the GROUP BY clause, the

   longer the query takes to execute.

 - If possible, place a GROUP BY clause on a table and then join it to

   another table, rather than joining the two tables and doing the GROUP BY

   in the same query as the join. For example, instead of this query:

     Q1: SELECT Orders.[Company ID], Count(Orders.[Order ID]) AS

         [CountOfOrder ID]

         FROM Customers INNER JOIN Orders ON Customers.[Customer ID] =

         Orders.[Customer ID]

         GROUP BY Orders.[Company Name];

   Break the query into two separate queries, such as:

      Q1: SELECT Customers.[Company ID]

          FROM Customers

          GROUP BY Customers.[Company ID];

      Q2: SELECT Orders.[Customer ID], Count(Orders.[Order ID]) AS

          [CountOfOrder ID]

          FROM Q1 INNER JOIN Orders ON Q1.[Customer ID] =

          Orders.[Customer ID]

          GROUP BY Orders.[Customer ID];

 - When you are joining tables, try to index the fields on both sides of a

   join. This can speed query execution by allowing the query optimizer to

   use more sophisticated internal join strategy.

 - Index fields as much as possible. If a database is not updated

   frequently, then an index should be placed on all fields that are used

   in a join or in a restriction. With the use of Rushmore query

   optimization technology in Microsoft Access version 2.0, the Microsoft

   Jet database engine is able to take advantage of multiple indexes on a

   single table, which makes indexing multiple fields advantageous.

 - Try to construct your queries so that Rushmore technology can be used to

   help optimize them. Rushmore is a data-access technology that permits

   sets of records to be queried very efficiently. With Rushmore, when you

   use certain types of expressions in query criteria, your query will run

   much faster.

   Rushmore does not automatically speed up all of your queries. You must

   construct your queries in a certain way for Rushmore to be able to

   improve them. For more information about how to optimize queries with

   Rushmore technology, search for "Rushmore technology" then "Optimizing

   Queries with Rushmore Technology" using the Microsoft Access Help menu.

 - Use COUNT(*) rather than COUNT([Column Name]) to determine the number of

   records in a table. This is because there are special optimizations in

   the Microsoft Jet database engine that allow COUNT(*) to be executed

   much faster than COUNT([Column Name]).

REFERENCES

==========

For more information about optimizing Microsoft Access performance in

general, search for "optimizing performance" then "Optimizing Microsoft

Access Performance" using the Microsoft Access Help menu.

Additional reference words: 2.00 General Speeding Improving

KBCategory:

KBSubcategory: GnlOthr


INF: How to Optimize MS Access Using ODBC Data Sources

Article ID: Q113551

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes several tips for improving performance when you are

accessing data from an ODBC data source.

MORE INFORMATION

================

Try these tips to improve performance with ODBC data sources:

 - Restrict the amount of data that you request from the server. Do

   not ask for more data than you need. Use queries to select only

   the fields and rows that you need.

 - Use only the functionality you need. Snapshots are less powerful than

   dynasets and are not updateable, but may be faster, particularly for

   small recordsets without Memo or OLE Object fields.

 - Use attached tables to access server data. Do not use "direct" server

   access (that is, opening remote databases and executing queries against

   them). Instead, attach tables and use the attachments, or use pass-

   through queries.

 - Use list and combo boxes wisely. On a form, each list box, combo box,

   subform, and control containing a total requires a separate query.

   Against local data, performance may be adequate. Against remote data,

   however, long delays may occur when you open a form since each query

   must be sent to the server and a response returned before the form can

   open.

 - Avoid large combo boxes. Including a combo box with hundreds, or even

   thousands, of choices based on a local table may yield acceptable

   response time, especially if you define an appropriate index on the

   local table. Against a remote table, however, such a combo box will

   yield sluggish performance as it drains server and network resources as

   it fetches data to fill the list. It is best to limit the number of rows

   returned to the combo box when you are working with remote data. You can

   also break up the data into smaller combo boxes (bearing the tip above

   in mind).

 - Use the Find command only on smaller recordsets. The Microsoft Jet

   database engine optimizes the Find command to work well against local

   recordsets of almost any size, and against remote recordsets of

   reasonable size. However, when you are working with large remote

   recordsets (thousands of records or more), you should instead use a

   filter or query and be careful to use restrictions that your server can

   process.

 - Make sure that queries are sent to the server for processing. The most

   important factor in query performance against remote data is ensuring

   that your server executes as much of the query as possible. The

   Microsoft Jet database engine attempts to send the entire query to your

   server, but evaluates locally any query clauses and expressions that are

   not generally supported by servers or by your particular server.

   Functionality not supported by servers in general includes:

    - Operations that cannot be expressed in a single SQL statement. This

      can occur when you use a query as an input to another query, or when

      your query's FROM clause contains a Totals query or DISTINCT query.

      Often, you can rearrange your queries to calculate totals after all

      other operations.

    - Operations that are Microsoft Jet database engine-specific extensions

      to SQL, such as crosstab queries, TOP queries, and reports with

      multiple levels of grouping and totals. Note that simple crosstab

      queries can be sent to servers.

    - Expressions that contain Microsoft Access-specific operators or

      functions. The Microsoft Access financial functions and statistical

      aggregates have no server equivalents.

    - User-defined Access Basic functions that take remote columns as

      arguments. These functions do not exist on the server, but must

      process remote column data. However, if a user-defined function

      returns a single value and does not reference a remote column, the

      function is evaluated locally and its value is sent to the server

      for processing.

    - Mixing text and numeric data types in operators or UNION query

      outputs. Most servers lack the data-type leniency in Microsoft

      Access. Because of this, use explicit conversion functions where

      appropriate.

    - Heterogeneous joins between local tables and remote tables, or

      between remote tables in different ODBC data sources. Joins between

      small local tables and large remote tables, where the join column is

      indexed, may result in a remote index join. In a remote index join,

      one query for each row in the local table is sent to the server and

      only the joining rows are returned.

    - Non-remotable expressions, or expressions that cannot be sent

      remotely, because they cannot be evaluated by your server. Non-

      remoteable output expressions (those in the SELECT clause) do not

      force local evaluation of your query unless they occur in a Totals

      query, a DISTINCT query, or a UNION query. Non-remoteable expressions

      in other clauses (WHERE, ORDER BY, GROUP BY, HAVING, and so on) force

      at least part of your query to be evaluated locally.

 - Servers differ in some areas of supported functionality. When you attach

   a remote table, the Microsoft Jet database engine queries the ODBC

   driver for its capabilities. If the required functionality is supported

   by the driver and the server, the Microsoft Jet database engine sends

   the operation to the server for processing. If not, the Microsoft Jet

   database engine performs the operation locally. Areas of differing

   support include (but are not limited to) the following:

    - Outer joins. Note that the Microsoft Jet database engine does not

      send multiple outer joins to a server, although many inner joins may

      accompany a single outer join.

    - Numeric, string, and date/time functions (such as Log(), Mid$(),

      DatePart(), and so on).

    - Conversion functions (such as CInt(), CStr(), CVDate(), and so on).

Additional reference words: 2.00 Attaching ODBC

KBCategory:

KBSubcategory: IntpOthr


INF: How to Order Data in a Graph

Article ID: Q99934

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to order data in a graph more easily by changing

the graph's RowSource property to a query name, rather than using the SQL

statement that Microsoft Access generates.

MORE INFORMATION

================

The following steps demonstrate how to create a graph that will show all

the orders with values over $10,000, in descending order, in the Orders

table in the sample database NWIND.MDB:

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Orders table, and save

   the query as GraphQuery:

      Query: GraphQuery

      ------------------------

      Field name: Ship Name

         Show: True

      Field name: Order Amount

         Sort: Descending

         Show: True

         Criteria: >10000

3. Use the GraphWizard to create a new form based on GraphQuery.

   Select both fields for the graph.

4. Switch to Form view. Note that the orders are sorted by the Ship

   Name field.

5. From the View menu, choose Form Design. Select the graph. From the

   View menu, choose Properties to show the property sheet.

6. Change the RowSource property of the object frame, as shown below:

      Object: Object Frame

      -----------------------------

      ControlName: Embedded0

         RowSourceType: Table/Query

         RowSource: GraphQuery

7. Switch to Form view. The orders are now sorted in descending order.

Additional reference words: 1.00 1.10 2.00 queries graph wizards

KBCategory:

KBSubcategory: IntpGrph


INF: How to Pass an Array As an Argument to a Procedure

Article ID: Q116140

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In order to pass an array as an argument to an Access Basic procedure, you

must include the array name followed by opening and closing parentheses. If

you do not include the parentheses, the error message "Parameter type

mismatch" will result.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

The following example demonstrates the correct syntax for procedure calls

with an array:

   Result = YourFunctionName(YourArrayName())

   YourSubName YourArrayName()

The procedure you are calling must fully declare the argument and include

the opening and closing parentheses.

The following example demonstrates the correct syntax for procedure

declarations with an array:

   Function YourFunctionName (InArray() As String) As Integer

   Sub YourSubName (InArray() As String)

The following example demonstrates a sample user-defined function that

loads an array with string values:

1. Create a new module and enter the following code:

   NOTE: In the following sample code, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this code in Access Basic.

      '---------------------------------------------------------------

      'GLOBAL DECLARATIONS SECTION

      '---------------------------------------------------------------

      Option Explicit

      '---------------------------------------------------------------

      'The function LoadArray() loads an array called MyArray

      'with string values. After loading the array, the function

      'calls a procedure that displays all array elements to the

      'Immediate window.

      '---------------------------------------------------------------

      Function LoadArray()

         Dim i as Integer

         ReDim MyArray(10) As String

         For i = 1 to 10

            MyArray(i) = "Test Value: " & i

         Next i

         DisplayArray MyArray()

      End Function

      '---------------------------------------------------------------

      'LoadArray() Sub Procedure

      '---------------------------------------------------------------

      Sub DisplayArray (InArray() As String)

         Dim i as Integer

         For i = 1 to UBound(InArray)

            Debug.Print InArray(i)

         Next i

      End Sub

2. From the View menu, choose Immediate Window.

3. In the Immediate window, type the following line and then press ENTER:

      ? LoadArray()

REFERENCES

===========

Microsoft Access "Introduction to Programming," version 1.0, Chapters 2

and 5

Microsoft Access "Building Applications," version 2.0, Chapters 5 and 6

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: MdlOthr


INF: How to Play .WAV Sounds on Events in Microsoft Access

Article ID: Q95647

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not have a built-in function to play sound files

on events, such as when a form is opened or closed. However, you can

use the Microsoft Windows 3.1 application program interface (API)

through Access Basic code to create a user-defined function to play

sound files.

This article assumes you are familiar with Access Basic and Windows

APIs. In this article, the use of error trapping has been omitted to

keep the information as clear and concise as possible.

MORE INFORMATION

================

Follow these steps to create a user-defined function to play sound

files:

1. Create a new module with a single function named PlaySound().

   Note: In the following sample code, an underscore (_) is used as

   a line-continuation character. Remove the underscore when

   re-creating this code in Access Basic.

   '*****************************************************************

   'Declarations section of the module.

   '*****************************************************************

   Option Explicit

   Declare Function sndplaysound% Lib "mmsystem" (ByVal filename$,_

                                                  ByVal snd_async%)

   '==================================================================

   ' The following function PlaySound calls the Windows API function

   '==================================================================

      Function PlaySound (msound)

         Dim XX%

         XX% = sndplaysound(msound, 1)' play mmwave sound

         If XX% = 0 Then MsgBox "The Sound Did Not Play!"

      End Function

2. Save the module as Play It Sam.

   The following steps use a command button to trigger the sound, but

   you can use other events to trigger the sound.

3. Add a command button to a form you want to play the sound from.

   Object: Command Button

   -------------------------------------------

   ControlName: Push_Button_1

   Caption: Play Chimes

   OnPush: =PlaySound("C:\WINDOWS\CHIMES.WAV")

   (Where C:\WINDOWS\ is the location of the sound file and CHIMES.WAV

   is the sound file.)

When the form is open in Form view, the sound is ready to play by

clicking the command button. You can assign this function to the

form's OnOpen property if you want chimes to play when you open a form.

NOTE: This example does not have error trapping. Unexpected results

may occur if the sound file is not in the location specified or does

not exist.

If the sound (.WAV file) is in the table as an OLE field, the sound can be

added to the form out of the field list. You can then use a macro that

does a GoToControl [olefield], DoMenuItem form-edit-object-<verb>. You can

run this from a button on the form. It will go to the OLE field and edit

the object (the default edit is play for a sound).

REFERENCES

==========

Microsoft Access "Introduction to Programming," Chapters 1-5

"Microsoft Windows Software Development Kit," Microsoft Press, 1992

"Programming Windows: the Microsoft Guide to Writing Applications for

Windows 3", Charles Petzold. Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to

Programming Reference," Volumes 1 - 6, Microsoft Press, 1992

Additional reference words: 1.00 1.10 2.00 sound

KBCategory:

KBSubcategory: PgmApi


INF: How to Position Microsoft Access on the Screen

Article ID: Q95934

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To position Microsoft Access on the screen, you need to call the

SetWindowPos() Windows API function. The article gives a brief

demonstration of how to position Microsoft Access on the screen.

MORE INFORMATION

================

To position Microsoft Access on the screen, you will need to use the

SetWindowPos() application programming interface (API) function included

in the USER.EXE dynamic link library (DLL) included with Windows.

Implement this function as follows:

1. Open or create a new module in Microsoft Access.

2. Within the Declarations section, add the following declares,

   constants, and comments.

   NOTE: In the following sample code, an underscore (_) is used as a

   line continuation character. Remove the underscore when re-creating

   this code in Access Basic.

   '====================================

   ' Global Declarations

   '====================================

   Option Compare Database

   Option Explicit

   Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,_

                       ByVal lpCaption As Any)

   Declare Sub SetWindowPos Lib "User" (ByVal hWnd%,_

                       ByVal hWndInsertAfter%, ByVal X%, ByVal Y%,_

                       ByVal cx%, ByVal cy%, ByVal wFlags%)

   'Inserts the window to precede the position window in the Z-Order.

   'This parameter must be a window handle or one of the following

   'constants.

   Global Const HWND_TOP = 0

   'values for wFlags%

   Global Const SWP_NOZORDER = &H4      'Ignores the hWndInsertAfter

3. Include the following function:

      Function SizeAccess ()

         Dim cX%, cY%, cHeight%, cWidth%, h%

         'get handle to Microsoft Access

         h% = FindWindow("Omain", 0&)

         cX% = 0

         cY% = 0

         cWidth% = 640

         cHeight% = 480

         'position Microsoft Access

         SetWindowPos h%, HWND_TOP, cX%, cY%, cWidth%, cHeight%,_

         SWP_NOZORDER

      End Function

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: How to Print a Conditional Page Header in a Report

Article ID: Q105516

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to print a conditional page header using an

example that forces the page header, which contains the column header

labels, to print on consecutive pages of the report if a data group spans

more than one page.

The technique described in this article works for Microsoft Access versions

1.x and 2.0. However, an alternative method for version 2.0 is described in

the Solutions sample application. See the "References" section of this

article for a complete reference to this method.

MORE INFORMATION

================

Reports print group header information once per group, even if the

group of data spans more than one page. In reports, a common layout is

to place the grouping value in the group header along with the column

labels. However, since this data is not repeated when a group spans

more than one page, the column header labels are not repeated on the

subsequent page(s).

To create conditional headers, you must create a new page before each

group of data and set a flag from the group header to determine when

the page header should print. Then, from the group footer, set the

flag back so that the page header does not print at the beginning of

the next group.

The following steps illustrate this procedure in the sample database

NWIND.MDB:

1. Create a new form called FlagForm. This form is used to store a

   global variable.

2. Create one unbound control and set the following property:

      Name: Flag

   NOTE: In Microsoft Access version 1.x, the Name property is called

   the ControlName property.

3. Create the following new macro, and name it Test:

      Macro Name        Condition                       Action

      --------------------------------------------------------------

      SetFlag                                            SetValue

      ShrinkPageH        Forms![FlagForm]![Flag]=1       CancelEvent

      FlagOn                                             SetValue

      FlagOff                                            SetValue

      Test actions

      ---------------------------------

      SetFlag

         Item:  Forms![FlagForm]![Flag]

         Expression: 1

      CancelEvent: no arguments

      FlagOn

         Item:  Forms![FlagForm]![Flag]

         Expression: 0

      FlagOff

         Item:  Forms![FlagForm]![Flag]

         Expression: 1

4. Create a new blank report called PrintHeaders based on the Products

   table:

   a. Set the following report header properties:

         OnFormat: Test.SetFlag

         Height: 0

   b. Set the page header property:

         OnFormat: Test.ShrinkPageH

   c. Create a label in the page header section with the following

      property:

         Caption: Continued from Previous Page...

   d. Create a grouping for the Category ID with following properties:

         Group Header: Yes

         Group Footer: Yes

   e. Set the following group header properties:

         OnFormat: Test.FlagOn

         ForceNewPage: Before Section

   f. Create a control in the group header section bound to the Category

      Id field.

   g. Create a text box control bound to the Product Name field in the

      detail section.

   h. Set the height property for the detail section to 2 inches.

      (This is to create groups of data that span more than one page.)

   i. Set the group footer property to:

         OnFormat: Test.FlagOff

5. View the FlagForm form in Datasheet view.

6. Preview the PrintHeaders report.

7. Scroll through the report. Note the page headers for the groups.

REFERENCES

==========

You can find information, instructions, and examples in the Solutions

sample application (SOLUTION.MDB) included with Microsoft Access version

2.0. For more information about printing a conditional page header, open

the SOLUTION.MDB database usually located in the ACCESS\SAMPAPPS directory.

Select "Control what you print on reports" in the Select A Category Of

Examples box, then "Repeat a group name at the top of a column or page" in

the Select An Example box.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptProp


INF: How to Print a Single Record from a Form in a Report

Article ID: Q98801

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to select a single record on a form and

print it in a report.

MORE INFORMATION

================

The following procedure explains how to print only the record you

select from the Customers form in the sample database NWIND.MDB:

1. Create a report called PrintRecordReport based on the Customers

   table.

2. Create the following macro:

      Macro: PrintRecordMacro

      -----------------------------------------------------------------

      OpenReport

         ReportName: PrintRecordReport

         View: Print Preview

         Where Condition: [Customer ID]=Forms![Customers]![Customer ID]

3. Add a command button to the Customers form and set the following

   button properties:

      Command Button

      ------------------------

      ControlName: PrintRecord

      Caption: Print Record

      OnPush: PrintRecordMacro

When you choose the command button on the form, the report opens and runs

the underlying query. The query references the form for the Customer ID and

synchronizes that Customer ID to the Customer ID on the report.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsOthr


INF: How to Print Duplicate Mailing Labels for Each Record

Article ID: Q100146

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to print multiple labels for each customer

record. The example that follows uses the Customers table in the

sample NWIND.MDB database.

MORE INFORMATION

================

The following example generates 10 labels for each customer record:

1. In the sample database NWIND.MDB, create a new table called Label Count

   with one number field. Use the default properties and do not create a

   primary key. Enter a 1 in the first record, 2 for the second record, and

   so on.

      Table: Label Count

      ------------------

      FieldName: Count

         DataType: Number

2. Create a new query based on the Label Count and Customers tables:

      Query: LabelQuery

      ---------------------------------

      Type: Select Query

      Tables: Label Count and Customers

      Join: None

3. From the View menu, choose Totals so that all fields are set to

   Group By, as follows:

      Field: Company Name

         Table: Customers

         Total: Group By

      Field: Contact Name

         Table: Customers

         Total: Group By

      Field: Address

         Table: Customers

         Total: Group By

      Field: City

         Table: Customers

         Total: Group By

      Field: Region

         Table: Customers

         Total: Group By

      Field: Postal Code

         Table: Customers

         Total: Group By

     Field: Count

         Table: Label Count

         Total: Group By

         Criteria: <= [Enter Number of Labels to Print for Each

                   Customer]

   NOTE: The Count field in the Label Count table can have an optional

   parameter value specified in the Criteria field to enter the number of

   labels to print for each record in the Customers table. If this query is

   used without a parameter value, 10 identical labels are printed for each

   record in the Customers table.

4. Using the Microsoft Access ReportWizard, create a new mailing label

   report based on the LabelQuery query. If you specify a parameter value,

   you are prompted to enter the number of labels to print for each

   customer record.

Additional reference words: 1.00 1.10 2.00 multiple many labels

KBCategory:

KBSubcategory: RptLabel


INF: How to Print Odd or Even Pages of a Report

Article ID: Q101075

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to print separately the odd and even pages

of a report for duplex printing or to print reports with different

margins for binder storage.

MORE INFORMATION

================

The best way to print separately odd and even pages of report is to

set up a form that prompts you for the pages to print (odd or even)

and then calls a macro to print the report. (Page 559 of the 1.0

"User's Guide" shows a sample form that prompts the user to fill in

values on the form before a macro prints the report.) The form in the

example below contains a text box control to hold the value "odd" or

"even" and a command button to print the report.

NOTE: When you use the following steps to print even pages, all the

odd pages generate blank pages (and vice versa). Whenever you

implement this routine, your report generates blank pages between each

printed page.

1. Create a new form called Print Odd Even Pages:

   a. Locate an unbound text box with ControlName = PrintPages.

   b. Locate a command button with Caption = Print Report. From the

      OnPush property, call the following OddEven.Print macro group.

2. Create a new macro called OddEven with the following macro groups:

   NOTE: In the following example, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this

   example.

      Macro Group Name      Condition                        Action

      -----------------------------------------------------------------

      Print                                                  OpenReport

      TestOddEven           Forms![Print Odd Even Pages] _

                            ![PrintPages]="Even" And _

                            Page Mod 2=1                     CancelEvent

                            Forms![Print Odd Even Pages] _

                            ![PrintPages]="Odd" And _

                            Page Mod 2=0                     CancelEvent

      OpenReport Actions

      ------------------------------------

      Report Name: Customer Mailing Labels

      View: Print Preview

3. From each report section that is printing data, call the macro

   group OddEven.TestOddEven from the OnPrint event.

   For example, in the NWIND.MDB sample database report Customer Mailing

   Labels, the only section that is printing is the detail section. The

   page header and page footer in this report do not print any values.

   For the detail section, set the OnPrint event to:

      OddEven.TestOddEven

4. With the form open, enter Odd or Even in the text box. When you

   choose the Print Report command button, the Customer Mailing Labels

   report opens. Press OK for all countries. The report then runs its

   OnPrint events, which call the macro group OddEven.TestOddEven to

   print only the odd or even pages.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 23, "Using Macros to

Print Reports or Transfer Data," pages 556-560

Microsoft Access "User's Guide," version 2.0, Chapter 26, "Using Macros to

Print Reports or Transfer Data"

Additional reference words: 1.00 1.10 2.00 every other page left right

KBCategory:

KBSubcategory: RptLayou


INF: How to Print Text to Default Printer with Access Basic

Article ID: Q105662

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access, there is no standard way of sending text to the

default printer without printing a form or report. This article

demonstrates a method of using Windows API functions to send text to the

printer.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0. This article

also assumes that you are familiar with programming in the Windows

environment. For more information on programming in the Windows environment

using API functions, please refer to the Microsoft Windows Software

Development Kit manuals.

MORE INFORMATION

================

Unlike Microsoft Visual Basic, Microsoft Access does not have a printer

object for sending text to the printer. The following example demonstrates

how to use Windows API functions to send text to the printer.

Notes

-----

 - This article does not describe the API function arguments. For details

   on the API functions, please refer to the Microsoft Windows Software

   Development Kit manuals.

 - You may have some Microsoft Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code. You

   should also alias any API function declarations. For more information on

   using aliases, search for "alias" then "declare statement" using the

   Microsoft Access Help menu.

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

'-------------------------------------------------------------------

'Declaration Section

'-------------------------------------------------------------------

Option Compare Database   'Use database order for string comparisons

Option Explicit

Type DOCINFO

    cbSize As Integer

    lpszDocname As Long

    lpszOutPut As Long

End Type

Declare Function GetProfileString% Lib "Kernel" (ByVal lpAppName$, _

                    ByVal lpkeyname$, ByVal lpDefault$, _

                    ByVal lpReturnedString$, ByVal nsize%)

Declare Function CreateDC% Lib "GDI" (ByVal lpDriverName$, _

                    ByVal lpDeviceName$, ByVal lpOutput$, _

                    lpInitData As Any)

Declare Function DeleteDC% Lib "GDI" (ByVal hDC%)

Declare Function TextOut% Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%, _

                    ByVal lpString$, ByVal nCount%)

Declare Function Mylstrcpy& Lib "Kernel" Alias "lstrcpy" ( _

                    ByVal lpString1 As Any, ByVal lpString2 As Any)

Declare Function StartDoc% Lib "GDI" (ByVal hDC%, lpdi As DOCINFO)

Declare Function StartPage% Lib "GDI" (ByVal hDC%)

Declare Function EndPage% Lib "GDI" (ByVal hDC%)

Declare Function EndDocAPI% Lib "GDI" Alias "EndDoc" (ByVal hDC%)

Declare Function Rectangle% Lib "GDI" (ByVal hDC%, ByVal X1%, _

                    ByVal Y1%, ByVal X2%, ByVal Y2%)

'-------------------------------------------------------------------

'Start of Function

'-------------------------------------------------------------------

Function Printer ()

   Dim lpReturnedString$

   Dim MyDoc As DOCINFO

   Dim MyDocumentname$

   Dim nPrinter, nDriver, nDevice

   Dim szDevice, szDriver, szOutPut

   Dim hDC%, X%, MyString$

   MyDocumentname$ = "My Document"

   '------------------------------------------

   ' Retrieve the currently selected printer as

   ' establish with the Control panel.

   ' Sample string as returned by lpReturnedString$:

   '

   '    HP LaserJet IIISi PostScript,pscript,LPT1:

   '------------------------------------------

   lpReturnedString$ = Space$(128)

   nPrinter = GetProfileString("windows", "device", ",,,", _

                 lpReturnedString$, Len(lpReturnedString$))

   '-----------------------------------------

   ' Parse the string of its three components

   '-----------------------------------------

   nDevice = InStr(lpReturnedString$, ",")

   nDriver = InStr(nDevice + 2, lpReturnedString$, ",")

   szDevice = Mid$(lpReturnedString$, 1, nDevice - 1)

   szDriver = Mid$(lpReturnedString$, nDevice + 1, nDriver - nDevice _

               - 1)

   szOutPut = Mid$(lpReturnedString$, nDriver + 1)

   '------------------------------------------

   ' Create the DOCINFO structure for StartDoc()

   '  - lpszDocname is name displayed in PRINTMAN

   '  - lpszOutPut is not used and set to NULL

   '------------------------------------------

   MyDoc.cbSize = Len(MyDoc)

   MyDoc.lpszDocname = Mylstrcpy(MyDocumentname$, MyDocumentname$)

   MyDoc.lpszOutPut = 0&

   '------------------------------------------

   ' Create the device context

   '------------------------------------------

   hDC% = CreateDC(szDriver, szDevice, szOutPut, 0&)

   X% = StartDoc(hDC%, MyDoc)

      X% = StartPage(hDC%)

      '------------------------------------------

      ' Rectangle arguments are X, Y, cX, cY

      '------------------------------------------

      X% = Rectangle(hDC%, 10, 10, 1000, 150)

      MyString$ = "Derek and Robyn are brother and sister!"

      '------------------------------------------

      ' Second and third arguments are the X and Y

      ' coordinates on paper.

      '------------------------------------------

      X% = TextOut(hDC%, 30, 20, MyString$, Len(MyString$))

      X% = EndPage(hDC%)

   X% = EndDocAPI(hDC%)

   '------------------------------------------

   ' Release the device context when done

   '------------------------------------------

   hDC% = DeleteDC(hDC%)

End Function

'-------------------------------------------------------------------

'End of Function

'-------------------------------------------------------------------

REFERENCES

==========

Microsoft Windows Software Development Kit "Guide to Programming,"

version 3.1, page 254-255

Microsoft Windows Software Development Kit "Programmer's Reference

Volume 2: Functions," version 3.1

Additional reference words: 1.00 1.10 2.00 ADK

KBCategory:

KBSubcategory: PtrOthr


INF: How to Programmatically Embed or Link an Object in a Form

Article ID: Q114214

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to programmatically embed or link an object in

an OLE object field on a form using the new object frame properties in

Microsoft Access version 2.0.

MORE INFORMATION

================

You can set the object frame Action property at run time to perform a

number of operations on an object frame. These operations include the

ability to embed and link objects in an object frame, as well as other

operations for programmatic access to OLE functionality.

There are other object frame properties that need to be set as

prerequisites to setting the Action property. The properties that need to

be set are determined by the type of OLE object you are working with and

the type of action, using the Action property, you want to perform.

NOTE: The constants for use by the Action property are defined in the file

CONSTANT.TXT, which is included with Microsoft Access. To use the constants

in your code, you must either declare them yourself or copy them from the

CONSTANT.TXT file and paste them into the Declarations section of your

Access Basic module.

Linking an OLE Object

---------------------

To link an object in an object frame on a form, first set the following

properties:

 - OLETypeAllowed: Set to OLE_LINKED to indicate the OLE field

   will contain a linked object.

 - SourceDoc: Set to the path and filename of the file to be linked.

 - SourceItem: Indicates the data in the source document to link to. This

   could be a cell or cell range in a Microsoft Excel spreadsheet, or a

   bookmark in a Microsoft Word for Windows document. This property setting

   is optional.

Once you set these properties, you can set the Action property to

OLE_CREATE_LINK to link the object in the object frame.

The following sample code demonstrates how to programmatically link a range

of cells from a Microsoft Excel spreadsheet to an OLE object field named

Sales Totals bound to an object frame with the same name on a form:

   ' Specify what kind of object can appear in the field.

   [Sales Totals].OLETypeAllowed = OLE_LINKED

   ' Specify the file to be linked.

   [Sales Totals].SourceDoc = "C:\EXCEL\SALES.XLS"

   ' Specify the (optional) cell range to link to.

   [Sales Totals].SourceItem = "R1C1:R5C5"

   ' Create the linked object.

   [Sales Totals].Action = OLE_CREATE_LINK

Embedding an OLE Object

-----------------------

To embed an object in an object frame on a form, first set the following

properties:

 - OLETypeAllowed: Set to OLE_EMBEDDED to indicate the OLE field

   will contain an embedded object.

 - SourceDoc: Set to the path and filename of the file containing the

   information to embed.

Once you set these properties, you can set the Action property to

OLE_CREATE_EMBED to create an embedded object with a copy of the

information in the source document file.

The following sample code demonstrates how to embed a Word for Windows

document in an OLE object field named Word Documents bound to an object

frame with the same name on a form:

   ' Specify what kind of object can appear in the field.

   [Word Documents].OLETypeAllowed = OLE_EMBEDDED

   ' Specify the file containing the information to embed.

   [Word Documents].SourceDoc = "C:\WINWORD\JONES.DOC"

   ' Create the embedded object.

   [Word Documents].Action = OLE_CREATE_EMBED

Creating an Empty Embedded Object

---------------------------------

To create an empty embedded object in an object frame, first set the

following properties:

 - Class: Set to the type of object you want to create. For a Microsoft

   Excel worksheet, use Excel.Sheet. For a Word for Windows document, use

   Word.Document.

 - OLETypeAllowed: Set to OLE_EMBEDDED to indicate the OLE field

   will contain an embedded object.

Once you set these properties, you can set the Action property to

OLE_CREATE_EMBED to create an empty embedded object of the type specified

in the Class property. Then, set the Action property again to invoke the

application for that object.

The following sample code demonstrates how to programmatically create new

Word for Windows documents in an OLE object field named Word Documents

bound to an object frame with the same name on a form:

   ' Specify what kind of object can appear in the field.

   [Word Documents].Class = "Word.Document"

   ' Specify what kind of object can appear in the field.

   [Word Documents].OLETypeAllowed = OLE_EMBEDDED

   ' Create the embedded object.

   [Word Documents].Action = OLE_CREATE_EMBED

   ' Invoke Word for Windows to edit the empty embedded object.

   [Word Documents].Action = OLE_ACTIVATE

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 13,

"Communication With Other Applications," pages 295-297

For more information about the Action property, search for "Action" then

"Action Property" using the Microsoft Access Help menu.

Additional reference words: 2.00 automation

KBCategory:

KBSubcategory: IntpOle


INF: How to Query an Oracle Table Without Attaching It

Article ID: Q109824

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use the SQL IN clause to query an Oracle

database without attaching it.

In Microsoft Access version 2.0, this can be accomplished more easily by

using a SQL pass-through query. See the "References" section of this

article for a reference on this method.

MORE INFORMATION

================

You can use the IN clause to query only one external database at a time.

The IN clause requires two arguments: database name and connect string.

When you attach Oracle tables, specify an empty string for the database

name.

The connect string consists of the following items:

 - Data Source Name (DSN): The name of the ODBC data source.

 - Database Name (DATABASE): The Oracle connect string to the server.

   The Oracle connect string consists of a prefix and a server name.

   (For TCP/IP users, there may be a prefix, a server name, and an SID.)

   The prefix is based on the network protocol. The following are the

   prefixes for networks that support SQL*Net for Windows:

      t:      for TCP/IP

      x:      for IPX/SPX

      p:      for Named Pipes

 - Workstation ID (WSID): The name of the workstation from which the

   connection is being made (optional).

 - User ID (UID): The login ID (optional). If not present, the user will

   be prompted for the login ID the first time the macro is run.

 - Password (PWD): The login password (optional). If not present, the

   user will be prompted for the login password the first time the macro

   is run.

The following is a sample connect string to Oracle. Note that it starts

with "ODBC," indicating to the system that it should use the ODBC driver

(as opposed to using an installable ISAM driver):

NOTE: In the following sample connect string, an underscore (_) is used

as a line-continuation character. Remove the underscore when re-creating

this connect string.

   ODBC;DSN=DataSourceName;Database=x:SrvrName;WSID=Wrk1;USID=JaneDoe;_

   PWD=ABC123

The following example demonstrates how to use the SQL IN clause in a

query to query an Oracle database without attaching it. Note that this

example assumes that the ODBC Driver Manager and Oracle ODBC driver is

installed, that a data source called Corp was set up using the ODBC

Driver Manager, and that the table called Employees on the server called

Payroll can be successfully attached using the Attach command on the File

menu:

1. Open the sample database NWIND.MDB.

2. Create a new, unbound query.

3. From the View menu, choose SQL.

4. Type the following query in the SQL window, and then choose OK:

      Select *

      FROM Employees

      IN "" "ODBC;dsn=Corp;database=p:Payroll;uid=JSmith;pwd=KL3d";

5. Save and then close the query. Note that if you return to the SQL

   window after saving the query, Microsoft Access may place additional

   characters in the IN clause that you will have to remove in order to

   avoid a syntax error.

REFERENCES

==========

For more information on the SQL IN clause, search for "In clause (SQL)"

then "IN Clause (SQL)" using the Microsoft Access Help menu.

Microsoft Access "Language Reference," version 1.1, Appendix B,

"Microsoft Access SQL," page 513

Microsoft Access "User's Guide," version 2.0, pages 273 and 276

Additional reference words: 1.00 1.10 2.00 attach remote data source

KBCategory:

KBSubcategory: ObcOthr


INF: How to Query SQL Server Tables Without Attaching

Article ID: Q101375

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use the SQL IN clause to query a SQL

Server table without attaching it.

MORE INFORMATION

================

You can use IN to query only one external database at a time.

The IN clause requires two arguments: database name and connect

string. When you attach SQL Server tables, you must specify an

empty string for the database name. The connect string consists of the

following items:

   Data Source Name (DSN)        The name of the SQL Server computer

   Database Name (DATABASE)      The name of the SQL Server database

   Workstation ID (WSID)         The name of the workstation that is

                                 making the connection (optional)

   User ID (UID)                 The login id*

   Password (PWD)                The user password*

* This item is optional within the connect string. If it is not

  present, the system prompts the user with a dialog box to enter this

  information the first time the macro is executed each session.

The following is a sample connect string to SQL Server. Note that it

starts with "ODBC," which tells the system that it uses the ODBC

driver (as opposed to an installable ISAM driver).

   ODBC;DSN=ServerName;Database=Pubs;WSID=Wrk1;USID=JaneDoe;PWD=ABC123

The following example assumes that the ODBC driver manager and SQL

Server driver are installed, that a data source called "Corp" was set

up using the ODBC driver manager, and that the table "Employees" can

be successfully attached using the Attach command on the File menu.

1. Open the sample database NWIND.MDB.

2. Create a new query.

3. From the View menu, choose SQL.

4. Enter the following query:

      Select *

      FROM Employees

      IN "" "ODBC;dsn=Corp;database=Payroll;uid=JSmith;pwd=KL3d";

5. Choose OK to exit the SQL dialog box and close and save the query.

NOTE: If you return to the View SQL window after saving the query,

Microsoft Access may place additional characters in the IN clause that you

must remove to avoid a syntax error.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.1, Appendix B, "Microsoft

Access SQL," page 513

For more information about the IN clause, search for "IN (SQL)" then "IN

Clause (SQL)" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 attach remote data source

KBCategory:

KBSubcategory: ObcOthr


INF: How to Remove Attached Tables with a Macro

Article ID: Q93297

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The TransferDatabase action is the macro equivalent of the Attach Tables

command on the File menu. However, there is no action to detach a table. To

remove an attached table from the Database window, select the table in the

Database window and press the DELETE key. You can also create a macro to

detach a table or you can call the action from an Access Basic module using

the DoCmd statement.

MORE INFORMATION

================

To detach a table in Microsoft Access version 1.x, create the following

macro:

   Macro Name    Action

   --------------------------

   RemoveTable   SelectObject

                 DoMenuItem

   RemoveTable Actions

   ---------------------------

   SelectObject

      Object Type: Table

      Object Name: <tablename>

      In Database Window: Yes

   DoMenuItem

      Menu Bar: Database

      Menu Name: Edit

      Command: Delete

To detach a table in Microsoft Access version 2.0, create the following

macro:

   Macro Name    Action

   --------------------------

   RemoveTable   DeleteObject

   RemoveTable Action

   ---------------------------

   DeleteObject

      Object Type: Table

      Object Name: <tablename>

In Access Basic, use a DoCmd statement to run the RemoveTable macro.

Additional reference words: 1.00 1.10 2.00 unattach

KBCategory:

KBSubcategory: IntpOthr


INF: How to Remove the Menu Bar from a Form

Article ID: Q100143

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To remove the menu bar from a form, enter =1 (or any Access Basic

function that evaluates to a numeric result) in the OnMenu property of

the form in Microsoft Access version 1.x, or in the MenuBar property in

Microsoft Access version 2.0.

MORE INFORMATION

================

Entering =1 causes Microsoft Access to evaluate the property. Because

there is nothing to place in the menu bar, the menu bar is not displayed.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 339-340

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsEvnt


INF: How to Repair a Damaged Database

Article ID: Q109953

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Repair and Compact utilities in Microsoft Access are useful tools for

recovering and optimizing Microsoft Access database files.

However, these utilities affect only tables, queries, and indexes. They

cannot affect forms, reports, macros, or modules.

MORE INFORMATION

================

The Repair Utility

------------------

You can use the Repair utility to help fix databases with certain types

of damage. The Repair utility will attempt to repair only the tables,

queries, and indexes in the database. The Repair utility will not attempt

to repair damaged forms, reports, macros, or modules, but will simply

copy them to the new repaired database.

Compact Utility

---------------

The Compact utility eliminates empty space in an existing database. It does

so by creating a temporary database, exporting all the objects from the

original database into the temporary database, removing the original

database, and then renaming the temporary database to the original

database's name. You also have the option to name the temporary database to

some other name so that you can retain the original database.

Recovering a Damaged Database

-----------------------------

The following steps outline a general method for attempting to repair a

damaged database:

1. Back up the damaged database (.MDB) file.

2. If the damage is in a table, query, or index, run the Repair utility as

   follows:

   a. Close all open databases.

   b. From the File menu, choose Repair.

   c. In the File Name box, select the damaged database and choose OK.

   If the repair is successful, you will receive the message:

      Repair of database '<path><database name>' completed

      successfully.

   If the repair does not succeed you will receive a message stating so.

   This means either that the damage to a table, query, or index is so

   severe that it cannot be corrected, or that the damage is in an object

   that the Repair utility cannot affect.

3. If the damage is in a form or report, the damage can be either in the

   form or report itself, or in one or more controls on the form or report.

   - If the damage is in the form or report itself, the best approach is

     to create a new form or report and then copy the controls from the

     original form or report.

   - If the damage is in a control on the form or report, create a new form

     or report and then re-create the controls on the new form or report.

     It is best to re-create all the controls, since there is no way to

     tell which controls are damaged.

4. If the damage is in a macro or module, the damage can be in the macro

   or module itself, or in the contents of the macro or module.

   - If the damage is in the macro or module itself, create a new macro

     or module and then copy the contents of the original macro or module.

   - If the damage is in the contents of the macro or module, you must

     create a new macro or module and then re-create the contents of the

     original macro or module.

If you cannot repair the database with these steps, the database is

probably damaged beyond repair. If this is the case, you should restore

your last backup database, or re-create the database.

REFERENCES

==========

Microsoft Access "User's Guide," pages 636-639

Additional reference words: 1.00 1.10 2.00 Repairing Compacting Fixing

KBCategory:

KBSubcategory: GnlCmp


INF: How to Replace a String with Another String

Article ID: Q109330

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates a sample function you can use to replace one

string with another string.

MORE INFORMATION

================

The following sample function can be used to replace one string with

another. This function accepts three parameters that specify:

 - the string that contains the string you want to replace

 - the specific string to be replaced

 - the value of the replacement string

The following steps demonstrate how to create and use the sample function

Replace():

1. Create a new module.

2. Enter the Access Basic code below.

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      '=============================================================

      ' Declarations section of the module

      '=============================================================

      Option Explicit

      Function Replace(Valuein, WhatToReplace, Replacevalue)

         Dim Temp as String, P

         Temp = Valuein

         P = Instr(Valuein, WhatToReplace)

         Do While P > 0

            Temp=Left(Valuein,P-1) & Replacevalue &_

                Mid(Valuein,P+Len(WhatToReplace))

            P = Instr(P + Len(WhatToReplace),Valuein, WhatToReplace,1)

         Loop

         Replace = Temp

      End Function

3. To replace the string "Sample" with the string "Test" in the string

   "This is a Sample," use the following parameters for the Replace()

   function:

      Valuein: "This is a Sample"

      WhatToReplace: "Sample"

      ReplaceValue: "Test"

The function Replace("This is a Sample","Sample","Test") will return:

   This is a Test

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 276-277 and

page 303

Additional reference words: 1.00 1.10 2.00 substitute

KBCategory:

KBSubcategory: PgmOthr


INF: How to Retrieve Information from the Clipboard

Article ID: Q94162

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

There is no command in Microsoft Access to retrieve information from the

Clipboard. To retrieve information from the Clipboard, you need to define

an Access Basic function that calls several Windows API functions. This

article defines a function that retrieves text from the Clipboard.

MORE INFORMATION

================

Add the code defined below to an Access Basic module. Make sure that the

declare functions are all listed on one line and that the MsgBox procedure

is also defined on one line. Since you may have some of the Windows API

functions defined in an underlying library, some of them might not be

needed. If this is the case, remove or comment the declarations from your

code.

To call the function you can make a string assignment to the returned

value, such as:

   ReturnString$ = ClipBoard_GetData ()

Sample Code

-----------

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Option Explicit

   Declare Function OpenClipBoard% Lib "User" (ByVal hwnd%)

   Declare Function GetClipboardData% Lib "User" (ByVal wFormat%)

   Declare Function GlobalAlloc% Lib "Kernel" (_

      ByVal wFlags%, ByVal dwBytes&)

   Declare Function GlobalLock& Lib "Kernel" (ByVal hMem%)

   Declare Function lstrcpy& Lib "Kernel" (_

      ByVal lpString1 As Any, ByVal lpString2 As Any)

   Declare Function GlobalUnlock% Lib "Kernel" (ByVal hMem%)

   Declare Function CloseClipBoard% Lib "User" ()

   Declare Function GlobalSize& Lib "Kernel" (ByVal hMem%)

   Global Const GHND = &H42

   Global Const CF_TEXT = 1

   Global Const MAXSIZE = 4096

   Function ClipBoard_GetData()

      Dim hClipMemory%

      Dim lpClipMemory&

      Dim MyString$

      Dim Junk&

      Dim X%

      If OpenClipBoard(0&) = 0 Then

         MsgBox "Could not open the Clipboard. Another _

            application could have it open"

         Exit Function

      End If

      '-------------------------------------------

      ' Obtain the handle to the global memory

      ' block that is referencing the text.

      '-------------------------------------------

      hClipMemory% = GetClipboardData(CF_TEXT)

      If IsNull(hClipMemory%) Then

         MsgBox "Could not allocate memory"

         GoTo OutOfHere

      End If

      '-------------------------------------------

      ' Lock Clipboard memory so we can reference

      ' the actual data string

      '-------------------------------------------

      lpClipMemory& = GlobalLock(hClipMemory)

      If Not IsNull(lpClipMemory&) Then

         MyString$ = Space$(MAXSIZE)

         Junk& = lstrcpy(MyString$, lpClipMemory)

         X% = GlobalUnlock(hClipMemory)

         'peel off the null terminating character

         MyString$ = Mid(MyString$, 1, InStr(MyString$, Chr$(0)) - 1)

      Else

         MsgBox "Could not lock memory to copy string from."

      End If

   OutOfHere:

      X% = CloseClipBoard()

      ClipBoard_GetData = MyString$

   End Function

REFERENCES

==========

"Programming Windows by Charles Petzold," Second Edition, pages 780-781

Additional reference words: 1.00 1.10 2.00 windows API checkpage

KBCategory:

KBSubcategory: PgmApi


INF: How to Retrieve the Path of an Attached MS Access Table

Article ID: Q116146

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined Access Basic function that you

can use to retrieve the path and filename of the originating database for

an attached Microsoft Access table. The function uses the attached table's

Connect property to get this information.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

The following example demonstrates how to create and use the sample

GetAttachedDBName() function:

1. Open the sample database NWIND.MDB.

2. Attach the Examples table from the sample database SOLUTIONS.MDB. (The

   SOLUTIONS.MDB database file is usually in the SAMPAPPS subdirectory.)

3. Create a new module and enter the following code.

   NOTE: In the following sample code, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this code in Access Basic.

      '***************************************************************

      ' Declarations section of the module.

      '***************************************************************

      Option Explicit

      '===============================================================

      ' The GetAttachedDBName() function requires the name of an

      ' attached Microsoft Access table, in quotation marks, as an

      ' argument. The function returns the full path of the originating

      ' database if successful, or returns 0 if unsuccessful.

      '===============================================================

      Function GetAttachedDBName (TableName As String)

         Dim db As Database, Ret

         On Error GoTo DBNameErr

         Set db = DBEngine.Workspaces(0).Databases(0)

         Ret = db.TableDefs(TableName).Connect

         GetAttachedDBName = Right(Ret, Len(Ret) - (InStr_

            (1, Ret, "DATABASE=") + 8))

         Exit Function

      DBNameErr:

         GetAttachedDBName = 0

      End Function

4. From the View menu, choose Immediate Window.

5. In the Immediate window, type the following line and then press ENTER:

      ? GetAttachedDBName("Examples")

The path of the attached table's originating database will be displayed in

the Immediate window.

REFERENCES

==========

For more information about the Connect property, search for "Connect" then

"Connect Property (Data Access)" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IsmIea


INF: How to Retrieve Windows For Workgroups User Information

Article ID: Q101676

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Using the Microsoft Windows for Workgroups API, you can retrieve

information, such as user name, workgroup, domain, and computer name,

about the currently running computer.

MORE INFORMATION

================

Windows for Workgroups comes with a function called NetWkstaGetInfo()

that returns information about a computer. This function is especially

useful for multiuser applications.

The following procedure explains how to use Access Basic and several

Windows API calls to access the NetWkstaGetInfo() function:

1. Create a new module containing the following declarations and

   functions:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

   NOTE: You may have some Microsoft Windows API functions defined in an

   existing Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code.

   NOTE: Make sure to choose the Compile All command from the Run menu to

   verify that you do not receive any compilation errors.

      Option Explicit

      Declare Function NetWkstaGetInfo% Lib "NetAPI" (ByVal lServer&, _

         ByVal sLevel%, ByVal pbBuffer&, ByVal cbBuffer%, pcbTotalAvail%)

      Declare Function GlobalAlloc% Lib "Kernel" (ByVal fFlags%,_

         ByVal nSize&)

      Declare Function GlobalLock& Lib "Kernel" (ByVal hMem%)

      Declare Function GlobalUnlock% Lib "Kernel" (ByVal hMem%)

      Declare Function GlobalFree% Lib "Kernel" (ByVal hMem%)

      Declare Sub lstrcpy Lib "Kernel" (ByVal dest As Any,_

         ByVal src As Any)

      Declare Sub hmemcpy Lib "Kernel" (ByVal dest As Any,_

         ByVal src As Any, ByVal size As Long)

      Function GetBinInt (sobj As String, off As Integer)

         If (Asc(Mid$(sobj, off + 1, 1)) < 128) Then

            GetBinInt = Asc(Mid$(sobj, off, 1)) +_

                            Asc(Mid$(sobj, off + 1, 1)) * 256

         Else

            GetBinInt = ((&HFF - Asc(Mid$(sobj, off + 1, 1))) * 256) - _

                          Asc(Mid$(sobj, off, 1))

         End If

      End Function

      Function GetWorkstationInfo (sComputer As String,_

         sUserName As String, sWorkgroup As String, sLogonDomain As String)

         Dim nRetSize As Integer, nStruct, ret As Integer, dummy As Integer

         Dim hMem As Integer, lpMem As Long, sTemp As String

         ' Get the size of the return structure.

         ret = NetWkstaGetInfo(0&, 10, 0&, 0, nRetSize)

         If (ret <> 0) And (ret <> 2123) Then

            GetWorkstationInfo = False

            Exit Function

         End If

         ' Allocate memory for the structure.

         hMem = GlobalAlloc(0, CLng(nRetSize))

         nStruct = nRetSize

         If (hMem <> 0) Then

            lpMem = GlobalLock(hMem)

            ' Read workstation information into structure.

            ret = NetWkstaGetInfo(0&, 10, lpMem, nRetSize, nRetSize)

            If (ret = 0) Then

               sTemp = Space(100)

               hmemcpy sTemp, lpMem, nStruct

               ' Retrieve the computer name.

               sComputer = Space(100)

               lpMem = CLng(GetBinInt(sTemp, 1)) +_

                           (CLng(GetBinInt(sTemp, 3)) * CLng(&H10000))

               lstrcpy sComputer, lpMem

               sComputer = Mid(sComputer, 1, InStr(sComputer, Chr(0)) - 1)

               ' Retrieve the user name.

               sUserName = Space(100)

               lpMem = CLng(GetBinInt(sTemp, 5)) +_

                           (CLng(GetBinInt(sTemp, 7)) * &H10000)

               lstrcpy sUserName, lpMem

               sUserName = Mid(sUserName, 1, InStr(sUserName, Chr(0)) - 1)

               ' Retrieve the workgroup name.

               sWorkgroup = Space(100)

               lpMem = CLng(GetBinInt(sTemp, 9)) +_

                           (CLng(GetBinInt(sTemp, 11)) * &H10000)

               lstrcpy sWorkgroup, lpMem

               sWorkgroup = Mid(sWorkgroup, 1, InStr(sWorkgroup,_

                                                     Chr(0)) - 1)

               ' Retrieve the logon domain name.

               sLogonDomain = Space(100)

               lpMem = CLng(GetBinInt(sTemp, 15)) +_

                           (CLng(GetBinInt(sTemp, 17)) * &H10000)

               lstrcpy sLogonDomain, lpMem

               sLogonDomain = Mid(sLogonDomain, 1, InStr(sLogonDomain,_

                                  Chr(0)) - 1)

            End If

            ' Free the memory allocated.

            dummy = GlobalUnlock(hMem)

            dummy = GlobalFree(hMem)

         Else

            ret = -1

         End If

         GetWorkstationInfo = IIf(ret = 0, True, False)

      End Function

2. Test this function by creating the following Access Basic function:

      Sub ShowInfo ()

         Dim a$, b$, c$, d$

         If GetWorkstationInfo(a$, b$, c$, d$) Then

            MsgBox a$ & " " & b$ & " " & c$ & " " & d$

         Else

            MsgBox "Unable to get information."

         End If

      End Sub

3. In the Immediate window, type the following, and the press ENTER:

      ShowInfo

Either a dialog box displaying information about the computer, or, if you

are running this function on a non-Windows for Workgroups computer, an

error message stating "Unable to get information" will be displayed.

Additional reference words: 1.00 1.10 2.00 user name multi-user networks

KBCategory:

KBSubcategory: PgmApi


INF: How to Return Records in a Many-to-Many Relationship

Article ID: Q106287

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The article demonstrates how to design a query to return the records from

one table in a many-to-many relationship where each of the records returned

is related to two records in the other table in the relationship. Note that

the many-to-many relationship between the two tables is broken into two

one-to-many relationships with a third (junction) table.

MORE INFORMATION

================

The following steps demonstrate how to create a sample query to return

records from one table in a many-to-many relationship as mentioned above:

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Order Details table:

      Query: Test

      ---------------------

      FieldName: Order ID

         Total: Group By

      FieldName: Product ID

         Total: Count

         Criteria: >1

      FieldName: Product ID

         Total: Where

         Show: False

         Criteria: 14 Or 21

Note that the use of the "14 or 21" query with a "Where" total on the

Product ID field returns only those order IDs that contain either one or

both of the products. The use of the ">1" query with a "Count" total on the

same field returns only records with both products.

Additional reference words: 1.00 1.10 2.00 ADK

KBCategory:

KBSubcategory: GnlApp


INF: How to Run Access Basic Functions with DDE

Article ID: Q109397

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not have any facility for running Access Basic

functions as a dynamic data exchange (DDE) server. However, Access Basic

functions can be run from a DDE client application if they are contained in

an SQL statement used to initiate a DDE conversation with Microsoft Access

using the SQL topic.

This article describes how to run Access Basic functions from a DDE client

application.

MORE INFORMATION

================

A DDE client application such as Microsoft Excel or Microsoft Word for

Windows can use DDE to run commands in Microsoft Access as a DDE server.

When it is used as a DDE server, Microsoft Access recognizes any of the

following as a valid command:

 - The name of a macro in the currently open database

 - Any action that you can run in Access Basic using the DoCmd statement

 - The OpenDatabase and CloseDatabase commands, which are used only for

   DDE operations

Note that Microsoft Access does not have DDE server functionality for

running Access Basic functions.

How to run Access Basic functions from a DDE client application

---------------------------------------------------------------

The following examples demonstrate how to run Access Basic functions from

DDE client applications. In both examples below, the MyFunct() function is

run against the None table in the sample database NWIND.MDB (note that the

MyFunct() function and the None table do not exist in the NWIND database;

they are simply names used for illustration):

This is the DDE command issued from Microsoft Excel:

   chan=INITIATE("MSACCESS","NWIND;SQL SELECT MyFunct() FROM None;")

This is the DDE command issued from Word for Windows:

   chan=DDEInitiate("MSACCESS", "NWIND;SQL SELECT MyFunct() FROM None;")

Note that you can name any table that exists in the database in the From

clause.

The following example demonstrates how to add a new customer to the

Customers table in the NWIND database by running an Access Basic function

from a DDE client application:

1. Open the sample database NWIND.MDB and create a new table called

   None with one field of any data type.

2. Open or create a module and enter the following sample Access Basic

   function:

      'Declarations section

      Option Explicit

      Function AddNewCust$ (CustomerID$, CompanyName$)

         Dim MyDB As Database, MyTable As Table

         Set MyDB = CurrentDB()

         Set MyTable = MyDB.OpenTable("Customers")  ' Open the table

         MyTable.AddNew             ' Prepare new record

         MyTable("Customer ID") = CustomerID$    ' Set record key

         MyTable("Company Name") = CompanyName$  ' Set company name

         MyTable.Update                          ' Save changes

         MyTable.Close                           ' Close the table

      End Function

3. In the DDE client application, initiate a DDE conversation with

   MSACCESS as the application and an SQL statement that calls the

   AddNewCust() function you created in step 2 as the topic.

The following example demonstrates how to run the AddNewCust() function

from Microsoft Excel:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   AddNewCustomer

   chan=INITIATE("MSACCESS","NWIND.MDB;SQL SELECT _

        AddNewCust$(""JOHNJ"",""John's Place"") FROM None;")

   =TERMINATE(chan)

   =RETURN()

The following example demonstrates how to run the AddNewCust() function

from Word for Windows:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Sub MAIN

      DDETerminateAll

      qt$ = Chr$(34)

      Funct$ = "AddNewCust$(" + qt$ + "JOHNJ" + qt$ + "," + qt$ + _

         "John's Place" + qt$ + ")"

      Chan = DDEInitiate("MSACCESS", _

         "NWIND;SQL SELECT " + Funct$ + "FROM None;")

      DDETerminate Chan

   End Sub

REFERENCES

==========

For more information on using Microsoft Access as a DDE server, search for

"DDE" then "Using Microsoft Access As a DDE Server" using the Microsoft

Access Help menu.

Microsoft Access "Language Reference," version 1.0, pages 118-124

README.TXT file in Microsoft Access version 1.0

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory:  IntpDde


INF: How to Search for Characters or Strings in Records

Article ID: Q100135

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates three methods of searching for and identifying

records containing a particular character or string. In the example below,

we search for an asterisk (*) character.

MORE INFORMATION

================

Say, for example, you have a table of names. Some of the names have

an asterisk character embedded in them, and you would like a list of

all the names containing asterisks.

First Method--Using the InStr() Function

----------------------------------------

One solution is to use the InStr() function. The InStr() function

returns the position of the first occurrence of a string within

another string. The example below uses the InStr() function to

determine whether or not the asterisk character exists in the names in

the table. If it does, it becomes a member of the query's dynaset.

1. Start Microsoft Access, open a database, and create a new table

   called Nametest.

2. Create a text field called Names and enter the following data into

   the table:

      Names

      -----

      *Pat

      Pat*

      Tom

      Ri*ck

      Harry

3. Create a new query based on the Nametest table.

4. Drag the Names field from the field list box into the query grid.

5. In the Field row of the query grid, next to the Names column, type

   in the expression:

      NewField: InStr(1,[Names],"*")

6. In the Criteria row of the same column, enter:

      >0

7. Uncheck the Show check box of that column.

8. Run the query by choosing Run from the Query menu.

You should get the results:

   *Pat

   Pat*

   Ri*ck

This method can be used to obtain a dynaset containing any sequence

of characters -- just change the asterisk in the expression above

to match the string or character you want to search for.

Second Method--Using the Like Operator

--------------------------------------

The Like Operator returns a dynaset that matches a pattern. The example

below uses the Like Operator to determine whether or not the asterisk

character exists in the names in the table. If it does, it becomes a member

of the query's dynaset.

1. Start Microsoft Access, open a database, and create a new table

   called Nametest.

2. Create a text field called Names and enter the following data into

   the table:

      Names

      -----

      *Pat

      Pat*

      Tom

      Ri*ck

      Harry

3. Create a new query based on the Nametest table.

4. Drag the Names field from the field list box onto the query grid.

5. In the Criteria row of the same column, enter:

      Like "*[*]*"

   The first and last * are wildcards, much like the MS-DOS asterisk

   wildcard. The [*] tells Microsoft Access to look for the character

   asterisk  and not to use it as a wildcard.

6. Run the query. You should get the results:

   *Pat

   Pat*

   Ri*ck

This is another method that can be used to obtain a dynaset containing

any sequence of characters -- just change the [*] in the criteria

above to match the string or character you want to search for.

If you are searching for a character that Microsoft Access interprets as a

wildcard, such as *#?[]!-, it must be inside square brackets. For example:

   * should be entered as [*]

   # should be entered as [#]

   ? should be entered as [?]

   [ should be entered as [[]

   ] should be entered as []]

   ! should be entered as [!]

   - should be entered as [-]

Third Method--Using the Find Command

------------------------------------

The Find command searches for the data you specify in the current

table or dynaset. The find command is available in the Datasheet view

of a table, query, or form and in the Form view of a form. The find

dialog box remains open after each search. This enables you to find as

many occurrences as you want without having to choose the find command

repeatedly. This method finds each name with an asterisk one at a

time.

1. Start Microsoft Access, open a database, and create a new table

   called Nametest.

2. Create a text field called Names and enter the following data into

   the table:

      Names

      -----

      *Pat

      Pat*

      Tom

      Ri*ck

      Harry

3. Choose the Edit menu and the Find option.

4. Type in [*]and choose Any Part of Field for Where:.

5. Choose the Find First button and you should get the result:

     *Pat

6. Choose the Find Next button and you should get the result:

     Pat*

7. Choose the Find Next button again and you should get the result:

     Ri*ck

This method can also be used to find any sequence of characters --

just change the [*] in the Find What: to match the string or character

you want to search for. Please see method two regarding searching for

a character that Microsoft Access interprets as a wildcard, such

as *#?[]!-.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 259, 279-280

Microsoft Access "User's Guide," version 1.0, Chapter 15, "Finding and

Sorting Data," pages 370-375

Microsoft Access "User's Guide," version 1.1, Chapter 15, "Finding and

Sorting Data," pages 374-379

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryOthr


INF: How to Search the CompuServe Knowledge Base

Article ID: Q103134

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to access the Microsoft Knowledge Base

(MSKB) forum on the CompuServe Information Service (CIS).

MORE INFORMATION

================

The MSKB is completely menu driven. Articles are broken up into three

different groups: INF, PRB, and PRACC articles. INF articles are those

that provide "how to" procedures or advanced tips and tricks. PRB

articles contain perceived problems that are actually associated with

either incorrect use of the product or "by-design" characteristics of

the product. PRACC articles document known problems with Microsoft

Access or other products that may cause problems with Microsoft

Access, such as video drivers.

The text below is a sample script in which a user is searching for all

articles that are associated with PRACC articles. The >> symbol is

used in this article to point out user input.

------------------------------

 Start of sample script

------------------------------

   >>GO MSKB

   One moment please...

   Knowledge Base+

   Welcome to The Microsoft Knowledge Base

   Copyright (c) 1993 Microsoft Corporation

    1 What's New in the Knowledge Base

    2 Description of Database

    3 Online User's Guide

    4 Search the Knowledge Base

    5 Search using Expert Mode

    6 Quick Search - By Document Id Number

    7 Microsoft Software Library

   >>4

   Knowledge Base+

   Current selection: 33378 record(s)

   SELECT SEARCH CRITERIA:

    1 Product Name            [  ]

    2 Product Version         [  ]

    3 Publication Date        [  ]

    4 Operating Environment   [  ]

    5 Document Type           [  ]

    6 Document Text           [  ]

    7 Title Text              [  ]

    8 Display Results

    9 Begin a New Search

   >>7

   You may enter up to 3 words/phrases, one at each prompt.

   Only records indexed under all specified words/phrases will be

   located.

      Words/phrases:

           1: >>PRACC

      and  2:

   Knowledge Base+

   Current selection: 79 record(s)

   SELECT SEARCH CRITERIA:

    1 Product Name            [  ]

    2 Product Version         [  ]

    3 Publication Date        [  ]

    4 Operating Environment   [  ]

    5 Document Type           [  ]

    6 Document Text           [  ]

    7 Title Text              [ PRACC ]

    8 Display Results

    9 Begin a New Search

   >>8

   Knowledge Base+

   Search Results: 7 records

   Enter "/DOWN" to download document

    1 PRACC9301: Wrong RowSourceType for combo box Causes GP Fault

    2 PRACC9302: Importing Delimited Text Files Strips Off Decimals

    3 PRACC9303: Screen Redraw Problems When Reordering Groups

    4 PRACC9303: Error: Not Enough System Resources in Access

    5 PRACC9303: Setting OLE Object Property May Cause GP Fault

    6 PRACC9303: Orders Form Does not Print/Preview SubTotal & Total

    7 PRACC9210: '#' Appears in Attached Table Name in Error Message

------------------------------

 End of sample script

------------------------------

NOTE: CIS is a service independent of Microsoft; we make no warranty,

implied or otherwise, regarding its performance or reliability.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlOthr


INF: How to Select Controls on Subforms with SetFocus Method

Article ID: Q113548

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use the new SetFocus method for forms and form controls in

Microsoft Access version 2.0 to select a field or control on an open form,

form datasheet, table datasheet, or query dynaset, or to select other

forms.

This article describes how to use the SetFocus method to select controls on

subforms and nested subforms, and how to select controls on a main form

from a control on a subform.

MORE INFORMATION

================

How to Select a Control on a Subform from a Main Form

-----------------------------------------------------

To select a control on a subform from a main form, do the following:

1. Select the subform control.

2. Select the appropriate control on the subform.

The following example demonstrates how to select a control on a subform

from a main form:

1. Open the sample database NWIND.MDB.

2. Create a new, blank form based on the Customers table.

3. From the View menu, choose Field List to display the field list.

   Drag the Company Name and Contact Name fields to the detail section

   of the form.

4. Drag the Orders form from the Database window onto the detail

   section of the new form. Microsoft Access will embed the Orders form

   as a subform, linking the Orders form to the new form on the Customer

   ID field. Note that the Orders form contains its own subform to show

   order details.

5. Create a command button on the form with the following properties:

      Name: GotoEmployeeID

      Caption: Employee ID

      OnClick: [Event Procedure]

   To create the event procedure, choose the Build button and then select

   the Code Builder. Add the following code to the form module, and then

   close the module:

      ' Select the Orders subform control.

      Me![Orders].SetFocus

      ' Select the Employee ID control on the Orders subform.

      Me![Orders].Form![Employee ID].SetFocus

6. Save the new form with the name Customer Orders.

7. View the form in Form view, and then choose the Employee ID button.

How to Select a Control on a Nested Subform from a Main Form

------------------------------------------------------------

To select a control on a nested subform (a subform of a subform), do the

following:

1. Select the subform control.

2. Select the nested subform control.

3. Select the appropriate control on the nested subform.

The following example demonstrates how to select a control on a nested

subform from a main form:

1. Continuing the example above, add the following command button

   to the Customer Orders form:

      Name: GotoQuantity

      Caption: Quantity

      OnClick: [Event Procedure]

   Create the following code for the OnClick event procedure:

      ' Select the Orders subform control.

      Me![Orders].SetFocus

      ' Select the nested Orders Subform subform control.

      Me![Orders].Form![Orders Subform].SetFocus

      ' Select the Quantity field on the nested subform.

      Me![Orders].Form![Orders Subform].Form![Quantity].SetFocus

2. View the form in Form view, and then choose the Quantity button.

How to Select a Control on a Main Form from a Subform

-----------------------------------------------------

To select a control on a main form from a subform, do the following:

1. Select the main form.

2. Select the appropriate control on the main form.

The following example demonstrates how to select a control on a main form

from a subform:

1. Continuing the example above, open the Orders form in Design view. Add

   the following new command button to the form:

      Name: GotoContact

      Caption: Contact

      OnClick: [Event Procedure]

   Create the following code for the OnClick event procedure:

      ' Select the main form.

      Forms![Customer Orders].SetFocus

      ' Select the Contact Name control on the main form.

      Forms![Customer Orders]![Contact Name].SetFocus

2. Save and then close the Orders form.

3. Open the Customer Orders form in Form view.

4. Choose the Contact button on the Orders subform.

How to Select a Control on a Subform from a Nested Subform

----------------------------------------------------------

To select a control on a subform from a nested subform, do the following:

1. Select the main form.

2. Select the subform control.

3. Select the appropriate control on the subform.

The following example demonstrates how to select a control on a subform

from a nested subform:

1. Continuing the example above, open the Orders Subform form in

   Design view.

2. Modify the Discount field's OnExit property to be:

      OnExit: [Event Procedure]

   Create the following code for the OnExit event procedure:

      ' Select the main form.

      Forms![Customer Orders].SetFocus

      ' Select the Orders subform control.

      Forms![Customer Orders]![Orders].SetFocus

      ' Select the Employee ID control on the Orders subform.

      Forms![Customer Orders]![Orders].Form![Employee ID].SetFocus

2. Save and close the Orders Subform form.

3. Open the Customer Orders form in Form view. Use the mouse to

   select the Discount field in the nested Orders Subform subform.

   Press TAB to exit the Discount field.

REFERENCES

==========

For more information about the SetFocus method, search for "SetFocus" then

"SetFocus Method" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsOthr


INF: How to Select More Than One Item from a List Box

Article ID: Q97518

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a pair of list boxes to imitate the

multiple selection behavior used in AccessWizards.

MORE INFORMATION

================

The example below demonstrates how to create a new form that contains two

list boxes and three command buttons. You can add items to or delete

items from the list using the command buttons or the properties of the

list boxes:

1. Create the following new table:

      Table: Table1

      -----------------------------------------------

      Field Name: List (primary key)

         DataType: Text

         Field Size: 15

         Caption: Items that will be provided in list

      Field Name: Selected

         DataType: Text

         Field Size: 5

         Caption: Indicates if the item has been selected

2. View the table in Datasheet view. Add five records to the table. For

   each record, type any text in the List field (for example a list of

   colors or cities), and type "YES" (without quotation marks) in the

   Selected field.

3. Create the following two new queries based on Table1:

      Query: Select Yes

      -------------------------------

      Field Name: List

         Show: Yes

         Criteria: [selected] = "YES"

      Query: Select No

      ------------------------------

      Field Name: List

         Show: Yes

         Criteria: [selected] = "NO"

4. Enter the following three sample functions in a new or existing

   module:

      '=======================================================

      'The following function opens the table and changes the

      'selected value from YES to NO, and then executes the

      'query for the two list boxes so that they will display

      'the updated values.

      '=======================================================

      Function ADD ()

         Dim MyDB As Database

         Dim MyTable As Table

         Dim y As Control

         Set MyDB = CurrentDB()

         Set MyTable = MyDB.OpenTable("Table1")

         Set y = forms!SelectList.field0

         MyTable.index = "PrimaryKey"

         MyTable.Seek "=", y

         MyTable.Edit

         MyTable.[selected] = "no"

         MyTable.Update

         MyTable.Close

         DoCmd Requery "field0"

         DoCmd Requery "field1"

      End Function

      '=======================================================

      'The following function opens the table and changes the

      'selected value from NO to YES, and then executes the

      'query for the two list boxes so that they will display

      'the updated values.

      '=======================================================

      Function Del ()

         Dim MyDB As Database

         Dim MyTable As Table

         Dim y As Control

         Set MyDB = CurrentDB()

         Set MyTable = MyDB.OpenTable("Table1")

         Set y = forms!SelectList.field1

         MyTable.index = "primarykey"

         MyTable.Seek "=", y

         MyTable.Edit

         MyTable.[selected] = "yes"

         MyTable.Update

         MyTable.Close

         DoCmd Requery "field0"

         DoCmd Requery "field1"

      End Function

      '=======================================================

      'The following function sets all values in the Selected

      'field to YES, and then executes the query for the two

      'list boxes so that they will display the updated

      'values.

      '=======================================================

      Function Clear ()

         Dim MyDB As Database

         Dim MyTable As Table

         Set MyDB = CurrentDB()

         Set MyTable = MyDB.OpenTable("Table1")

         On Error GoTo erhandle

         MyTable.MoveFirst

         Do Until MyTable.EOF

            MyTable.Edit

            MyTable.[selected] = "yes"

            MyTable.Update

            MyTable.MoveNext

         Loop

      erhandle:

         Resume Next

         DoCmd Requery "field0"

         DoCmd Requery "field1"

      End Function

5. Create the following new, unbound form, and then save it as

   SelectList:

      Object: list box

      -----------------------------

      ControlName: field0

         ControlSource:

         RowSourceType: Table/Query

         RowSource: Select Yes

         OnDblClick: =ADD()

      Object: list box

      -----------------------------

      ControlName: field1

         ControlSource:

         RowSourceType: Table/Query

         RowSource: Select No

         OnDblClick: =Del()

      Object: command button

      -----------------------

      ControlName: Button One

         Caption: Clear

         OnPush: =Clear()

      Object: command button

      -----------------------

      ControlName: Button Two

         Caption: Add item

         OnPush: =Add()

      Object: command button

      -------------------------

      ControlName: Button Three

         Caption: Delete item

         OnPush: =Del()

The first list box, Field0, displays the items to be selected. The second

list box, Field1, displays the items that are selected.

Additional reference words: 1.00 1.10 2.00 listbox combo multiple fill

function

KBCategory:

KBSubcategory: FmsCmbo


INF: How to Send Information to the Clipboard

Article ID: Q96900

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

There is no Microsoft Access command to send information to the

Clipboard. To post information to the Clipboard, you need to define an

Access Basic function that calls several Windows API functions. This

article defines a function that copies text to the Clipboard.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

NOTE: In version 2.0, you can use the OLE_COPY action to copy an OLE field

to the clipboard. This article does not address this case.

MORE INFORMATION

================

Notes

-----

 - In the following sample code, an underscore (_) is used as a line

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

 - You may have some Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive the duplicate procedure name error, remove

   or comment the Declare statement from your code.

To call the function, you can make a string assignment to the returned

value, such as:

   X = ClipBoard_SetData("This string will go to the Clipboard!")

'=================================================================

' General Declarations

'=================================================================

Option Compare Database   'Use database order for string comparisons

Option Explicit

Declare Function kb_OpenClipBoard% Lib "User"_

                    Alias "OpenClipBoard" (_

                    ByVal hwnd%)

Declare Function kb_GlobalAlloc% Lib "Kernel" _

                    Alias "GlobalAlloc" (ByVal wFlags%, ByVal wBytes&)

Declare Function kb_GlobalLock& Lib "Kernel" _

                    Alias "GlobalLock" (ByVal hMem%)

Declare Function kb_lstrcpy& Lib "Kernel" _

                    Alias "lstrcpy" (ByVal lpString1 As Any, _

                    ByVal lpString2 As Any)

Declare Function kb_GlobalUnLock% Lib "Kernel" _

                    Alias "GlobalUnLock" (ByVal hMem%)

Declare Function kb_CloseClipBoard% Lib "User" Alias"CloseClipBoard"()

Declare Function kb_EmptyClipBoard% Lib "USER" _

                    Alias "EmptyClipBoard" ()

Declare Function kb_SetClipboardData% Lib "User" _

                    Alias "SetClipboardData" (ByVal wFormat%, _

                    ByVal hMem%)

Global Const GHND = &H42

Global Const CF_TEXT = 1

Global Const MAXSIZE = 4096

Function ClipBoard_SetData (MyString$)

   Dim hGlobalMemory%, lpGlobalMemory&, hClipMemory%, X%

   '-------------------------------------------

   ' Allocate moveable global memory.

   '-------------------------------------------

   hGlobalMemory% = kb_GlobalAlloc(GHND, Len(MyString$) + 1)

   '-------------------------------------------

   ' Lock the block to get a far pointer

   ' to this memory.

   '-------------------------------------------

   lpGlobalMemory& = kb_GlobalLock(hGlobalMemory%)

   '-------------------------------------------

   ' Copy the string to this global memory.

   '-------------------------------------------

   lpGlobalMemory& = kb_lstrcpy(lpGlobalMemory&, MyString$)

   '-------------------------------------------

   ' Unlock the memory.

   '-------------------------------------------

   If kb_GlobalUnLock(hGlobalMemory%) <> 0 Then

      MsgBox "Could not unlock memory location. Copy aborted."

      GoTo OutOfHere2

   End If

   '-------------------------------------------

   ' Open the Clipboard to copy data to.

   '-------------------------------------------

   If kb_OpenClipBoard(0&) = 0 Then

      MsgBox "Could not open the Clipboard. Copy aborted."

      Exit Function

   End If

   '-------------------------------------------

   ' Clear the Clipboard.

   '-------------------------------------------

   X% = kb_EmptyClipBoard()

   '-------------------------------------------

   ' Copy the data to the Clipboard.

   '-------------------------------------------

   hClipMemory% = kb_SetClipboardData(CF_TEXT, hGlobalMemory%)

OutOfHere2:

   If kb_CloseClipBoard() = 0 Then

      MsgBox "Could not close Clipboard."

   End If

End Function

REFERENCES

==========

For more information on how to retrieve information from the Clipboard,

query on the following words here in the Microsoft Knowledge Base:

   ClipBoard_GetData and GetClipboardData

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: PgmApi


INF: How to Shell to a Windowed MS-DOS Application

Article ID: Q116384

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use the Shell() function to launch a Microsoft Windows or MS-DOS

application from within Microsoft Access. The function accepts a

windowstyle argument that specifies the style of window the application

will run in. The windowstyle argument applies only to Microsoft Windows

applications. To launch an MS-DOS application in a window, create a program

information file (PIF), and specify the PIF filename for the Shell()

function's commandstring argument.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The following example demonstrates how to use the Shell() function to

launch the MS-DOS EDIT.COM editor in a window from Microsoft Access:

1. In Program Manager, start PIF Editor. From the File menu, choose New.

2. In the Program Filename box, type "C:\DOS\EDIT.COM" (without quotation

   marks). If your copy of EDIT.COM is in a directory other than C:\DOS,

   substitute the appropriate directory name.

3. In the Start-up Directory box, type "C:\DOS" (without quotation marks).

4. In the Display Usage area, select the Windowed option button.

5. From the File menu, choose Save As. In the File Name box, type

   "C:\DOS\EDIT.PIF" (without quotation marks).

6. Start Microsoft Access and open any database. Create a new, blank form.

7. Add a command button to the form.

8. Set the command button's OnClick property to the following event

   procedure:

      Dim Ret

      Ret = Shell("C:\DOS\EDIT.PIF", 1)

9. View the form in Form view, and then click the command button.

REFERENCES

==========

Microsoft Access "Language Reference," version 2.0, page 568

Additional reference words: 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Skip Used Mailing Labels and Print Duplicates

Article ID: Q95806

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to print multiple copies of the same mailing

label, and how to use a partially used page where only some of the labels

are available.

To make use of this article, you need to be familiar with Access Basic and

know how to design Microsoft Access reports.

MORE INFORMATION

================

Printing Multiple Copies of the Same Label

------------------------------------------

When you choose Print from the File menu, you can choose to print multiple

copies of the same report. But when you try to print a single mailing

label 20 times, Microsoft Access prints one label on each of 20 pages.

On a dot matrix printer, using single column labels, you can work around

this problem by defining each label as a separate page. However, you

cannot use this method for laser printers or multiple-column labels. To

solve this problem, use the step-by-step procedure described below.

Using Labels that Would Otherwise Be Wasted

-------------------------------------------

After printing labels, you usually end up with a partially used last page.

There is no built-in mechanism in Microsoft Access to use the remaining

labels on a partially used page. Microsoft Access always starts on a new

page. On a dot matrix printer, you can adjust the top of form manually. But

you cannot do that on laser printers. To solve this problem, use the

step-by-step procedure described below.

Step-by-Step Procedure to Solve Both Problems

---------------------------------------------

The Microsoft Access report generator provides powerful hooks that allow

control over the finished product. By calling a function from the OnFormat

property of the report's detail section, you can alter the MoveLayout,

NextRecord, and PrintSection properties to leave blank spaces or print

multiple copies on the same page.

The code listed below is generic. You can attach it to any Mailing Label

report to print multiple copies and to skip used labels if needed. To use

the example, you need to have a mailing label report called MyLabels.

1. Create a new module, and place the following lines in the declaration

   section:

   '*********************************************************

      'Declarations section of the module.

   '**********************************************************

   Option Compare Database

   Option Explicit

   Dim LabelBlanks&

   Dim LabelCopies&

   Dim BlankCount&

   Dim CopyCount&

   '==========================================================

      ' The following function will cause an inputbox to

      ' display when the report is run that prompts the user

      ' for the number of used labels to skip and how many

      ' copies of each label should be printed.

   '===========================================================

   Function LabelSetup ()

      LabelBlanks& = Val(InputBox$("Enter Number of blank labels to skip"))

      LabelCopies& = Val(InputBox$("Enter Number of Copies to Print"))

      If LabelBlanks& < 0 Then LabelBlanks& = 0

      If LabelCopies& < 1 Then LabelCopies& = 1

   End Function

   '===========================================================

      ' The following function sets the variables to a zero

   '===========================================================

   Function LabelInitialize ()

      BlankCount& = 0

      CopyCount& = 0

   End Function

   '===========================================================

      ' The following function is the main part of this code

      ' that allows the labels to print as the user desires.

   '===========================================================

   Function LabelLayout (R As Report)

      If BlankCount& < LabelBlanks& Then

         R.NextRecord = False

         R.PrintSection = False

         BlankCount& = BlankCount& + 1

      Else

         If CopyCount& < (LabelCopies& - 1) Then

            R.NextRecord = False

            CopyCount& = CopyCount& + 1

         Else

            CopyCount& = 0

         End If

      End If

   End Function

2. Open the report named MyLabels in Design view and add the following line

   to the OnFormat property of the Detail section:

      OnFormat: =LabelLayout(Reports![MyLabels])

3. Add the following line to the OnOpen property of the MyLabels Report:

      OnOpen: =LabelSetup()

4. Although typically labels do not have a report header, choose Report

   Hdr/Ftr from the Layout menu to add a report header and footer. Then

   Add the following line to the OnFormat property of the report header:

      OnFormat: =LabelInitialize()

5. Set the Height property for both the report header and report footer

   to 0.

When you print the report, the report calls the LabelSetup() function,

which first asks you to enter the number of used labels to skip on the

first page (BlankCount) and then asks how many of each label you want

printed (CopyCount).

When the report header is formatted, it calls the LabelInitialize()

function, so when you switch from preview to print, the BlankCount and

CopyCount fields are set to zero. As each label is formatted, the

LabelLayout() function adjusts the NextRecord and MoveLayout properties

to skip used labels and print the desired duplicates.

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: RptLabel


INF: How to Specify a Custom Starting Page Number for a Report

Article ID: Q100156

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access reports, page numbering always starts with the

number 1. However, you may want your report to have page numbering

that starts with some number other than 1. This article describes two

methods of defining custom starting page numbers. Both methods provide

custom page numbers; however, the second method uses Access Basic and

can therefore include error checking. This method is more complex, but

avoids the possibility that a nonnumeric value will be entered when

you are prompted for a starting number.

MORE INFORMATION

================

Method 1

--------

In Design view of any report with page numbering, change the

ControlSource property of the text box for page numbering from "=Page"

to "=Page + [Enter a Starting Page Number] -1". This will cause

Microsoft Access to prompt you to enter a starting page number each

time the report is previewed or printed.

For example, in the sample database NWIND.MDB, open the "Alphabetical

List of Products" report in Design view. On the right side of the page

footer, there is a text box with a ControlSource property of "=Page".

Change this property of the text box to "=Page + [Enter a Starting Page

Number] -1".

Method 2

--------

This method assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

1. Open a new module or a previously created module and enter the

   following code:

      '******************************************************

      'Declarations Section of Module

      '******************************************************

      Option Explicit

      Global PageChoice As Integer

      '===========================================================

      'Create the following GetPageChoice() function in the Module

      '===========================================================

      'This function is called in the OnOpen property of the Report.

      Function GetPageChoice ()

         Dim choice As String

         Do

            choice = InputBox("Enter a Starting Page Number:","_

                          Number Report", "1")

            If Not (IsNumeric(choice)) Then

               MsgBox "Value Entered is not a Number."

            End If

         Loop While Not (IsNumeric(choice))

         PageChoice = CInt(choice)

      End Function

      '==============================================================

      'Create the following ReturnPageChoice() function in the Module

      '==============================================================

      'This function is called by the text box that will contain the

      ' pagenumber.

      Function ReturnPageChoice (pgnumber As Integer)

         ReturnPageChoice = PageChoice + pgnumber - 1

      End Function

2. Open your report in Design view.

3. From the Edit menu choose Select Report, then from the View menu

   choose Properties to display the property sheet. Change the OnOpen

   property to:

      OnOpen: =GetPageChoice()

4. In the page footer of the report create a text box with the

   following properties:

      Text Box:      Text1

      ----------------------------------------------------------

      Name: PageNumber (in version 1.x, ControlName: PageNumber)

      ControlSource: =ReturnPageChoice(Page)

When you preview or print the report, you will be prompted for a

starting page number. Each page will be numbered consecutively

starting with this number.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 18, "Designing

Reports," pages 422-424 and 440-444, and Chapter 23, "Using Macros to Print

Reports or Transfer Data," pages 571-572

Microsoft Access "Language Reference," version 1.0, page 364

Microsoft Access "User's Guide," version 2.0, Chapter 26, "Using Macros to

Print Reports or Transfer Data"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptOthr


INF: How to Speed Up Iterative Processes in Access Basic

Article ID: Q112724

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

To speed up iterative (looping) processes through large numbers of rows

using Access Basic, declare all field references explicitly.

MORE INFORMATION

================

The following is an example of Access Basic code that does not iterate

efficiently:

   Sub Slow()

      Dim d As Database

      Dim r As Recordset

      Set d = DBEngine.Workspaces(0).Databases(0)

      Set r = d.OpenRecordset("Order Details")

      While Not r.EOF

         r.Edit

         r.Fields("Price") = r.Fields("Qty") * r.Fields("UnitCost")

         r.Update

         r.MoveNext

      Wend

      r.Close

   End Sub

In the example above, the field variable "lookup" (that is, where Access

Basic equates variable names with database fields) for the three field

variables Price, Qty, and UnitCost is performed in the same While loop

where the calculations are performed. In this configuration, both

calculations and lookups must be performed inside the While loop, which is

not an efficient design.

The following is an example of Access Basic code that is more efficient:

   Sub Faster()

      Dim d As Database

      Dim r As Recordset

      Dim Price As Field, Qty As Field, UnitCost As Field

      Set d = DBEngine.Workspaces(0).Databases(0)

      Set r = d.OpenRecordset("Order Detail")

      Set Price = r.Fields("Price")

      Set Qty = r.Fields("Qty")

      Set UnitCost = r.Fields("UnitCost")

      While Not r.EOF

         r.Edit

         Price = Qty * UnitCost

         r.Update

         r.MoveNext

      Wend

      r.Close

    End Sub

This example runs faster because Access Basic performs the field lookup

only once for each field and completes it before executing the loop. A

direct reference to each of the three fields is then stored in the three

field variables Price, Qty, and UnitCost. As a result, no lookup is

required in the While loop, and the field values are accessed and

manipulated directly.

NOTE: The code examples above are only for illustrative purposes. In some

cases, an Update query can be a faster way to accomplish the task. An

example of such a case would be when you need to modify one field based on

another field (or fields). Also, speed differences may be slight for small

numbers of records.

Performance can also be optimized by using the transaction processing

features of Access Basic (BeginTrans, CommitTrans, and Rollback). These

features allow Microsoft Access to cache the information and reduce disk

I/O.

REFERENCES

==========

For more information about transaction processing, search for

"Transactions" then "BeginTrans, CommitTrans, Rollback Methods" using the

Microsoft Access Help menu.

Additional reference words: 2.00 Queries Programming AB

KBCategory:

KBSubcategory: PgmOthr


INF: How to Start the AutoDialer Without the Toolbar Button

Article ID: Q114218

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to invoke the AutoDialer without choosing the

AutoDialer button on the toolbar.

MORE INFORMATION

================

You can add the AutoDialer button to a toolbar to automatically dial a

telephone number using your computer's modem. To invoke the AutoDialer

without using the AutoDialer button, call the wlib_AutoDial() function,

supplying the function with the telephone number as an argument.

For a form with a field called Phone that holds a telephone number, you

could call the wlib_AutoDial() function from a command button by setting

the button's OnClick property to:

   =wlib_AutoDial([Phone])

You can also call the wlib_AutoDial() function in any module's Immediate

window. For example, to dial the phone number 555-1212, type the following

in the Immediate window:

   ? wlib_AutoDial("555-1212")

REFERENCES

==========

For more information about the AutoDialer, search for "AutoDialer" then

"AutoDialer" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Start the Mail Merge Wizard Without the Toolbar

Article ID: Q118871

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to start the Mail Merge Wizard without using the

Merge It button on the toolbar.

MORE INFORMATION

================

The Mail Merge Wizard helps you merge data from a Microsoft Access table or

query with a form letter or other document in Microsoft Word version 6.0

for Windows. You can start the Mail Merge Wizard by clicking the Merge It

button on the toolbar.

To start the Mail Merge Wizard without using the Merge It button, call the

PM_Entry() function from within your application. Make sure to supply the

function with a valid table or query name as an argument. For example, to

merge the data in the Customers table with a Word 6.0 document by clicking

a command button on a form, you would specify the following setting for the

command button's OnClick property:

   =PM_Entry("Customers")

NOTE: WZLIB.MDA must be loaded in the [Libraries] section of your

MSACC20.INI file for this function to be available. If WZLIB.MDA is not

loaded as a library, you cannot run the PM_Entry() function.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Appendix D, "Using Other

Windows-Based Applications with Microsoft Access," page 739

Additional reference words: 2.00 interoperability

KBCategory:

KBSubcategory: MdlOthr


INF: How to Synchronize Two Combo Boxes on a Form

Article ID: Q97624

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create two combo boxes so that making a

selection in the first combo box limits the list of available items in

the second combo box.

MORE INFORMATION

================

The following example uses the sample database NWIND.MDB. The first combo

box will list the available product categories, and the second combo box

will list the available products for the category selected in the first

combo box:

1. Create a new, unbound form with the following combo boxes, and then

   save the form as Categories And Products.

      Combo Box 1

      -------------------------------

      ControlName:   Categories

      RowSourceType: Table/Query

      RowSource:     Categories

      ColumnCount:   1

      BoundColumn:   1

      After Update:  Refresh Products

      Combo Box 2

      -----------------------------------

      ControlName:   Products

      RowSourceType: Table/Query

      RowSource:     Category Combo Query

      ColumnCount:   2

      ColumnWidth:   0

      BoundColumn:   1

2. Create the following new query based on the Products table, and then

   save the query as Category Combo Query:

      Query: Category Combo Query

      ---------------------------------------------------------

      Table: Products

      Type: Select Query

      Field: Product ID

         Sort: Ascending

         Show: Yes

      Field: Product Name

         Table: Products

         Show: Yes

      Field: Category ID

         Show: No

         Criteria: Forms![Categories and Products]![Categories]

3. Create the following new macro, and then save it as Refresh Products:

      Requery

         ControlName: Products

4. View the Categories And Products form in Form view. When you select

   a category in the first combo box, the second combo box will be

   updated to list only the available products for the selected

   category.

Notes

-----

In the above example, the second combo box is filled with the results of

the Category Combo Query query. This query finds all the products that

have a Category ID that matches the category selected in the first combo

box.

Whenever a category is selected in the first combo box, the AfterUpdate

property runs the Refresh Products macro, which forces the second combo

box to run the Category Combo Query query again. This refreshes the list

of available products in the second combo box. Without this macro, you

would have to force the second combo box to refresh itself by pressing

the F9 key.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsCmbo


INF: How to Take a Control Out of the Tab Order

Article ID: Q92640

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 has a TabStop property that you can use to

remove a control from the tab order. Microsoft Access version 1.x does not

have this property, but you can use one of the methods described below to

remove a control from the tab order.

MORE INFORMATION

================

Method 1

--------

Place the control in the form header or footer. Each section on a form has

its own tab order, so the form user would have to explicitly move from the

detail section to the header or footer to use the control.

Method 2

--------

Place an unbound, hidden text box in the tab order before the control. Set

the text box's OnEnter property to a macro that selects the first control

on the form.

This solution is one that FormWizards also use. Put all of your regular

controls in the detail section of the form first in the tab order, then

place an unbound, hidden text box on the form, and finally place any

buttons on the form. In the OnEnter property of the hidden text box, use a

macro to set focus to the first of your regular controls.

REFERENCES

==========

For more information, search for "tab order" then "Tab Order Command (Edit

Menu)" or "Setting Tab Order" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: FmsProp


INF: How to Trap Keystrokes that Leave a Control on a Form

Article ID: Q113547

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to trap the ENTER, TAB, SHIFT+TAB, PAGE UP, and

PAGE DOWN keys when they are pressed in a form, and then either replace the

key's action with another action, or disable the action.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The example below demonstrates how to use the GetKeyState() Windows

application programming interface (API) call to detect which key or key

combination is used to exit a control on a form. This technique can be used

to prevent a user from exiting a control, or to remap the key or key

combination to a different action:

NOTE: In the following sample code, an underscore (_) at the end of a line

is used as a line-continuation character. Remove the underscore from the

end of the line when re-creating this code in Access Basic.

1. Enter the following Declarations and function in an Access Basic module:

      ' **** Declarations Section ******************************

      Option Explicit

      Global Const VK_CONTROL = &H11

      Global Const VK_SHIFT = &H10

      Global Const VK_TAB = &H9

      Global Const VK_RETURN = &HD

      Global Const VK_PRIOR = &H21  ' PGUP

      Global Const VK_NEXT = &H22   ' PGDN

      Declare Function GetKeyState% Lib "user.exe" (ByVal nKey%)

      ' ********************************************************

      Function CheckKey ()

         Dim sControl As String

         Dim sShift As String

         ' Was the CTRL or SHIFT key used?

         If GetKeyState(VK_CONTROL) < 0 Then sControl = "Ctrl+"

         If GetKeyState(VK_SHIFT) < 0 Then sShift = "Shift+"

         ' Was the TAB key used?

         If GetKeyState(VK_TAB) < 0 Then

            MsgBox "You pressed " & sControl & sShift & "TAB!"

         End If

         ' Was the ENTER or RETURN key used?

         If GetKeyState(VK_RETURN) < 0 Then

            MsgBox "You pressed " & sControl & sShift & "ENTER!"

         End If

         ' Was the PAGE DOWN key used?

         If GetKeyState(VK_NEXT) < 0 Then

            MsgBox "You pressed " & sControl & sShift & "PGDN!"

         End If

         ' Was the PAGE UP key used?

         If GetKeyState(VK_PRIOR) < 0 Then

            MsgBox "You pressed " & sControl & sShift & "PGUP!"

         End If

      End Function

2. Open any form in Design view, and set any control's OnExit property to:

      =CheckKey()

3. View the form in Form view, select the control you modified in step

   2, and then try to exit the control.

The next example demonstrates how to use the GetKeyState() Windows API call

to modify the ENTER key's action so that it adds lines to a text box,

rather than moving to the next control in the tab order:

1. In version 1.x, create the following sample Access Basic function in

   a module:

      Option Explicit

      Global Const VK_RETURN = &HD

      Declare Function GetKeyState% Lib "user.exe" (ByVal nKey%)

      Function MakeEnterAddLines()

         If GetKeyState(VK_RETURN) < 0 Then

            DoCmd CancelEvent

            SendKeys "^{ENTER}"

         End If

      End Function

    -OR-

   In version 2.0 set the EnterKeyBehavior property to:

      New Line In Field

2. Set the OnExit property of any text box control on any form to:

      =MakeEnterAddLines()

3. View the form in Form view, move to the control you modified, and then

   press ENTER.

The next example demonstrates how to use the GetKeyState() Windows API call

to disable the PAGE UP and PAGE DOWN keys in a form:

1. Create the following sample Access Basic function in a module:

      Option Explicit

      Global Const VK_PRIOR = &H21  ' PGUP

      Global Const VK_NEXT = &H22   ' PGDN

      Declare Function GetKeyState% Lib "user.exe" (ByVal nKey%)

      Function DisablePGUP_PGDN()

         If GetKeyState(VK_PRIOR) < 0 Or GetKeyState(VK_NEXT) < 0 Then

            DoCmd CancelEvent

         End If

      End Function

2. Set the OnExit properties of all the controls where the PAGE UP and

   PAGE DOWN keys are to be disabled, on any form, to:

      =DisablePGUP_PGDN()

The next example demonstrates how to use the GetKeyState() Windows API

call to cause the TAB key, when it is pressed in the last control in the

last record in a subform, to navigate to the next control on the main

form:

1. Create the following sample Access Basic function in a module:

      Option Explicit

      Global Const VK_TAB = &H9

      Global Const VK_SHIFT = &H10

      Declare Function GetKeyState% Lib "user.exe" (ByVal nKey%)

      Function TABtoMainForm(F As Form)

         Dim DS As Dynaset

         On Error Goto Bye_TABtoMainForm

         ' Move to last record in form dynaset

         Set DS = F.Dynaset

         DS.MoveLast

         ' See if the form record is the last record

         If DS.Bookmark = F.Bookmark Then

            If GetKeyState(VK_TAB) < 0 And Not _

            (GetKeyState(VK_SHIFT) < 0) Then

               DoCmd CancelEvent

            SendKeys "^{TAB}"

         End If

      End If

      Bye_TABtoMainForm:

      End Function

2. Set the OnExit property of the last control in the subform to:

      =TABtoMainForm(Form)

REFERENCES

==========

For more information about using the GetKeyState() call, query on the

following word here in the Microsoft Knowledge Base:

   GetKeyState

For more information about other ways to disable the PAGE UP and PAGE DOWN

keys, query on the following words here in the Microsoft Knowledge Base:

   pgup and pgdn

Additional reference words: 1.00 1.10 2.00 trapping

KBCategory:

KBSubcategory: FmsEvnt


INF: How to Uninstall Microsoft Access Version 2.0

Article ID: Q112138

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 includes commands to uninstall, or remove,

many but not all of its components. This article describes how to remove a

typical, single-user installation of Microsoft Access 2.0 from your hard

disk.

MORE INFORMATION

================

Before you uninstall Microsoft Access, you should back up any databases

(any .MDB or .MDA files) created in Microsoft Access 2.0. If you

implemented any security in your Microsoft Access 2.0 database system, make

sure to back up the SYSTEM.MDA file.

You might also want to save your data tables in another format, such as

Microsoft Access version 1.x, dBASE IV, or text delimited. The steps for

saving Microsoft Access 2.0 tables in version 1.x format are described

below. For more information on exporting data to other formats, search on

"exporting data: basics" using the Microsoft Access Help menu.

Saving Microsoft Access 2.0 tables in 1.x Format

------------------------------------------------

1. In Microsoft Access 2.0, choose Export from the File menu.

2. In the Data Destination box, select Microsoft Access.

3. Select the table to export, then choose OK.

4. Select a Microsoft Access 1.x database to export the table to.

5. Repeat steps 3 and 4 for each of your tables.

Uninstalling Microsoft Access 2.0

---------------------------------

1. Run Microsoft Access Setup by double-clicking the MS Access Setup icon

   in your Microsoft Access 2.0 program group in Program manager, or by

   running SETUP.EXE from the ACCESS\SETUP directory in File Manager.

2. Choose Remove All. When you are prompted "Are you sure you want to

   remove this application?" choose Yes.

3. If you are prompted to remove shared components for Microsoft Graph

   and MSInfo, choose Keep if you have other applications, such as

   Microsoft Word for Windows or Microsoft Excel, that share these

   applications.

4. After the uninstall process is completed, use File Manager to remove

   your Microsoft Access 2.0 directory and any files it contains.

5. Use File Manager to remove these files from the Windows directory:

      CCARD200.EXE

      MSACC20.INI

6. Use File Manager to remove these files from the WINDOWS\SYSTEM

   directory:

   CAUTION: Many of these files are shared with other Windows applications.

   Do not delete these files if you have other applications, such as

   Microsoft Visual Basic 3.0, Microsoft Excel 5.0, or Microsoft Word 6.0

   for Windows, that share these files with Microsoft Access 2.0.

      BTRV200.DLL

      CCAPI200.DLL

      DAO2016.DLL

      DBNMP3.DLL

      DRVACC2.HLP

      DRVSSRVR.HLP

      MSABC200.DLL

      MSAEXP20.DLL

      MSAJT200.DLL

      MSJETERR.DLL

      MSJETINT.DLL

      OLE2.DLL

      OLE2.REG

      OLE2CONV.DLL

      OLE2DISP.DLL

      OLE2NLS.DLL

      OLE2PROX.DLL

      PDX200.DLL

      SQLSRVR.DLL

      SQORA.DLL

      STORAGE.DLL

      TYPELIB.DLL

      XBS200.DLL

7. Use File Manager to remove these ODBC files from your Windows directory:

   CAUTION: Do not remove ODBC files if other applications, such as

   Microsoft Visual Basic 3.0, Microsoft Excel 5.0, or Microsoft Word 6.0

   for Windows, that share these ODBC files with Microsoft Access 2.0 are

   installed on your computer.

      ODBC.INI

      ODBCINST.INI

8. Use File Manager to remove these ODBC files from the WINDOWS\SYSTEM

   directory:

   CAUTION: Do not remove ODBC files if other applications, such as

   Microsoft Visual Basic 3.0, Microsoft Excel 5.0, or Microsoft Word 6.0

   for Windows, that share these ODBC files with Microsoft Access 2.0 are

   installed on your computer.

      ODBC.DLL

      ODBCADM.EXE

      ODBCADM.HLP

      ODBCINST.DLL

      ODBCINST.HLP

      ODBCJT16.DLL

      ODBCTL16.DLL

9. Remove the ODBC icon from the Windows Control Panel as follows:

   a. Open the CONTROL.INI file located in the Windows directory with

      a text editor such as Windows Notepad.

   b. Under the [MMCPL] section, change the NumApps entry to one less

      than the current number.

   c. Also under the [MMCPL] section, delete the ODBC= line.

   d. Save the CONTROL.INI file and close it.

Additional reference words: 2.00 un-install

KBCategory:

KBSubcategory: StpOthr


INF: How to Update a Table Based on Values in a Second Table

Article ID: Q93690

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To transfer data between two tables, create an additional field in

one of the tables to store the common data, then create an update

query to accomplish the transfer.

MORE INFORMATION

================

This process can be illustrated using the sample database NWIND.MDB.

The following example adds a Product Name field to the Order Details

table, then copies the Product Name field from the Products table

based on the Product ID field.

NOTE: Normally you would not duplicate the Product Name field, since

duplicate data is not good database design.

1. Open the Order Details table in Design view.

2. Add a Product Name field with the default Text data type.

3. Save and then close the table.

4. Create a new query based on the Order Details and Products tables.

   NOTE: These tables are automatically joined on the Product ID

   field because a relationship has already been defined. If your

   tables are not joined, join them on the original linked field.

5. From the Query menu, choose Update.

6. From the View menu, choose Table Names. Drag the Product Name field

   from the Order Details table to the first cell in the Field row of

   the query grid.

7. In the Update To row, type:

      [Products]![Product Name]

8. From the Query menu, choose Run. Close the query.

REFERENCES

==========

For more information about using an update query with two tables, query on

the following words here in the Microsoft Knowledge Base:

   update and counter and query

Microsoft Access "User's Guide," version 1.0, Chapter 7

Additional reference words: 1.00 1.10 2.00 link join transfer cascade

KBCategory:

KBSubcategory: QryMktbl


INF: How to Use a Query to Filter Unique Data

Article ID: Q90809

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you want to filter a table to eliminate duplicate data, you need

to use a query that uses one of the aggregate functions--First(),

Last(), Min(), or Max()--in the fields that do not contain the

duplicate data. The fields that contain the duplicate data should

contain the GroupBy() function.

MORE INFORMATION

================

For example, suppose you import an inventory table from an application

and discover that the data has duplicates in it. Your goal is to get

the data back down to a baseline, such as one record per product, so

you can then reinventory and have a correct and complete set of data.

You can use a query to filter the data.

Your table might look like this:

   ProdID   Description   Cost   MarkUp    Quantity

   ------------------------------------------------

   1        A Product     $1.50  0.5      10

   2        B Product     $2.50  0.7      100

   3        C Product     $1.59  0.9      25

   2        D Product     $4.59  0.8      30

   5        E Product     $1.99  0.7      40

   6        F Product     $2.69  0.4      60

   9        G Product     $4.95  0.8      20

   8        H Product     $6.79  0.9      32

   9        I Product     $6.89  0.7      0

   1        J Product     $2.99  0.5      11

If you want to filter the table down to the point where it has a

unique ProdID code and take the first entry from each of the other

fields, you can create a query to do this, as follows:

1. Create a new query based on the original table by selecting it from

   the table list and clicking the New Query button on the toolbar.

2. Drag all the fields from the Field list to the query grid.

3. From the View menu, choose Totals.

4. Set the Total line of the query grid to First() for every field

   except ProdID, which is set to Group By().

5. From the View menu, choose Datasheet.

The data you see should be a list of unique ProdID data with the first

value that is encountered for that product in each of the other

fields. If you use this procedure on the above data your result should

be:

   ProdID   Description   Cost   MarkUp   Quantity

   -----------------------------------------------

   1        A Product     $1.50  0.5      10

   2        B Product     $2.50  0.7      100

   3        C Product     $1.59  0.9      25

   5        E Product     $1.99  0.7      40

   6        F Product     $2.69  0.4      60

   8        H Product     $6.79  0.9      32

   9        G Product     $4.95  0.8      20

To obtain different results, you can use Max(), Min(), or Last()

instead of First().

To generate a unique table from this query, you could change the query

to a make-table query during the query design.

NOTE: This query will return the unique data. To find duplicate records,

use the Find Duplicates Query Wizard in Microsoft Access version 2.0. For

more information on finding duplicates using Microsoft Access version 1.x,

query on the following words here in the Microsoft Knowledge Base:

   find and duplicates

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 139-144

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryTotal


INF: How to Use a Toggle Button to Hide and Display a Subform

Article ID: Q89622

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use a toggle button to hide and show a subform. This article

describes how to use a toggle button to hide and show the Quarterly Orders

subform in the Quartely Orders form in the sample database NWIND.MDB.

MORE INFORMATION

================

The following steps demonstrate how to use a toggle button to hide and show

a form:

1. Open the NWIND.MDB database.

2. Create the following new macro, and then save it as Toggle Macro:

       Action: SetValue

       Arguments:

          Item: [Quarterly Orders Subform].Visible

          Expression: Not [Quarterly Orders Subform].Visible

3. Open the Quarterly Orders form in Design view.

4. Set the form's DefaultEditing property to Allow Edits.

5. Add a toggle button to any open area on the form.

6. Set the toggle button's properties as follows:

      Caption: Toggle Subform

      After Update: Toggle Macro

      Width: 1 in

7. View the form in Form view. When you choose the toggle button, the

   Quarterly Orders subform will be hidden or shown.

Additional reference words: 1.00 1.10 2.00 togglebutton checkpage

KBCategory:

KBSubcategory: FmsEvnt


INF: How to Use Aggregate Functions in a Query

Article ID: Q103189

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The error message "Can't group on fields selected with '*'" occurs when

you have set the following query property:

   Version                 Property                     Value

   ----------------------------------------------------------

   Microsoft Access 2.0    Output All Fields            Yes

   Microsoft Access 1.x    Restrict Available Fields    No

MORE INFORMATION

================

This error message occurs when you are attempting to use aggregate

functions without setting the Output All Fields query property to No for

version 2.0, or without selecting the Restrict Available Fields property

for version 1.x.

The following procedure shows how to correctly set this property

for your query with aggregate functions:

1. Open the query in Design view.

2. In version 2.0, make sure that the Properties command on the View

   menu has a check mark, so that the property sheet is being displayed.

   Click anywhere in the Query window outside of the query grid. Set the

   Output All Fields property to No.

   In version 1.x, from the View menu, choose Query Properties. Then,

   select the Restrict Available Fields option.

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Run the Daily Order Totals query, which uses the aggregate

   functions Count() and Sum(), to confirm that it works correctly.

3. View the Daily Order Totals query in Design view.

4. In version 2.0, set the Output All Fields property to Yes.

   In version 1.x, clear the Restrict Available Fields check box.

5. Run the query.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.x, Chapter 6

Microsoft Access "User's Guide", version 2.0, Chapter 10

For more information, search for "Setting Query Properties" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryTotal


INF: How to Use Command Line Switches

Article ID: Q105128

UifOthr


INF: How to Use Criteria Queries Without Join Lines

Article ID: Q109959

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Join lines between tables are used to clarify relationships among data in

the joined tables, and to sort and order the data. However, there are some

situations where it is not necessary to have join lines between tables.

This article demonstrates a situation where it is not necessary to have a

join line between tables.

MORE INFORMATION

================

The sample database NWIND.MDB contains a table called Orders that has a

column called Order Date. To see all the orders placed from January 1,

1991, to February 1, 1991, you would have to use a query, since there are

no join properties for unequal (greater than or less than) comparisons.

One way to see the orders from January 1, 1991, to February 1, 1991, is to

create a table that holds the beginning and ending dates of the period you

want to see, then create a query comparing the fields in that table against

the Order Date column in the Orders table. The following example

demonstrates how to do this:

1. Open the sample database NWIND.MDB.

2. Create the following new table:

      Table: Date Range

      ----------------------

      FieldName: Start Date

         DataType: Date/Time

      FieldName: End Date

         DataType: Date/Time

3. Enter the following data in the Date Range table:

      Start Date: 01-Jan-91

      End Date: 01-Feb-91

4. Create a new query based on the Orders and Date Range tables.

5. Drag all the fields from the Orders table to the query grid.

6. Enter the following in the Criteria row of the Order Date column:

      >=[Date Range].[Start Date] And <=[Date Range].[End Date]

7. Run the query.

The query will result in a dynaset containing 34 records.

There are other ways of accomplishing this task. One other way is to run a

parameter query, so that you are prompted for the beginning and ending date

each time you run the query. The drawback to this method is that the

beginning and ending dates are not saved, and must be entered each time you

run the query. However, you can work around this drawback by using a form

to prompt for the beginning and ending date, and then storing the values in

the Date Range table. The next time you open the form the values last used

will be displayed, and can be changed if necessary.

REFERENCES

==========

For more information on passing values from a form to a parameter query,

query on the following words here in the Microsoft Knowledge Base:

   passing and value and form and parameter and query

Additional reference words: 1.00 1.10 2.00 Queries

KBCategory:

KBSubcategory: DcmNwd


INF: How to Use DAO to Assign or View Permissions

Article ID: Q112106

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access version 2.0, programmers can assign permissions to

database objects programmatically using data access objects (DAO). Securing

a database involves several steps, including:

1. Creating group accounts.

2. Creating user accounts.

3. Assigning users to groups.

4. Assigning permissions on database objects to users and groups.

5. Encrypting the database, if desired.

This article demonstrates the fourth step, assigning permissions on

database objects to users and groups.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual, Chapter 3, "Introducing Access

Basic."

MORE INFORMATION

================

To assign permissions for an object, you must reference the UserName and

Permissions properties of the objects document. All database objects can

be treated as documents in a container. For example, given the DB variable

assignment

   Dim DB As Database

   Set DB = DBEngine.Workspaces(0).Databases(0)

a table called Table1 can be referred to using DAO as follows:

   DB.Containers("Tables").Documents("Table1")

However, it is usually easier to assign and work with object variables:

   Dim DB as Database, DOC as Document

   Set DB = DBEngine.Workspaces(0).Databases(0)

   Set DOC = DB.Containers("Tables").Documents("Table1")

You can directly reference the UserName and Permissions properties

of the Table1 document like this:

   UserNameVariable = DOC.UserName

   PermissionsVariable = DOC.Permissions

   -or-

   DOC.UserName = "MyUser"

   DOC.Permissions = DB_SEC_FULLACCESS

Reading Permissions Information

-------------------------------

To read the permissions that a given user has on an object, simply set

the UserName property of the document to the name of the user or group

you want to inquire on, and then read the value of the Permissions

property.

The following example shows how to read the permissions for the user John

on form MyMainForm:

   Dim DB as Database, DOC as Document, HisPermissions as Long

   Set DB = DBEngine.Workspaces(0).Databases(0)

   Set DOC = DB.Containers("Forms").Documents("MyMainForm")

   DOC.UserName = "John"

   HisPermissions = DOC.Permissions

This example shows how to read the permissions for the group Supervisors on

the report SalarySummary:

   Dim DB as Database, DOC as Document, GroupPermissions as Long

   Set DB = DBEngine.Workspaces(0).Databases(0)

   Set DOC = DB.Containers("Reports").Documents("SalarySummary")

   DOC.UserName = "Supervisors"

   GroupPermissions = DOC.Permissions

Note that whether you are inquiring on a group or a user, you still set the

UserName property. There is no GroupName property for a document.

Assigning Permissions Information

---------------------------------

To assign permissions for a user on an object, set the UserName property

of the document to the name of the user or group, and then set the

Permissions property of the document to the appropriate value.

Generally, you should use the predefined constants when you are assigning

permissions. For a complete list of the predefined constants, search for

"Security: Constants" using the Microsoft Access Help menu.

The following example shows how to assign Full permissions for the user

Martha on the table Employees:

   Dim DB as Database, DOC as Document

   Set DB = DBEngine.Workspaces(0).Databases(0)

   Set DOC = DB.Containers("Tables").Documents("Employees")

   DOC.UserName = "Martha"

   DOC.Permissions = DB_SEC_FULLACCESS

The next example shows how to assign Open/Run and Modify Design permissions

for the group Developers on the form Customers:

   Dim DB as Database, DOC as Document

   Set DB = DBEngine.Workspaces(0).Databases(0)

   Set DOC = DB.Containers("Forms").Documents("Customers")

   DOC.UserName = "Developers"

   DOC.Permissions = DB_SEC_FRMRPT_EXECUTE+DB_SEC_FRMRPT_WRITEDEF

Methods to Programmatically View and Assign Permissions

-------------------------------------------------------

Method 1:

This method uses a sample subroutine called AssignPerms to update all the

objects in a database. To assign permissions for a user on all the objects

in a database, you can move through all the documents in all the

collections in the database. The following sample subroutine demonstrates

one way of moving through all the documents in a database and changing the

permissions on them:

   Sub AssignPerms (GrpUsrName as String, NewPerm as Long)

      Dim DB as Database, I as Integer, J as Integer

      Set DB = DBEngine.Workspaces(0).Databases(0)

      For I = 0 to DB.Containers.Count - 1

         For J = 0 to DB.Containers(I).Documents.Count - 1

            DB.Containers(I).Documents(J).UserName = GrpUsrName

            DB.Containers(I).Documents(J).Permissions = NewPerm

         Next J

      Next I

  End Sub

You could call this subroutine from within Access Basic code, passing

the group or user name and the Permissions value you want to assign.

For example, to revoke all permissions on all objects from the Guests

group, call AssignPerms as follows:

   AssignPerms "Guests", DB_SEC_NOACCESS

To assign full permissions on all objects to the Managers account,

call AssignPerms like this:

   AssignPerms "Managers", DB_SEC_FULLACCESS

Method 2:

This method uses two sample functions, GetPermissions() and

SetPermissions(), to display and assign the permissions for a user or

group on the database object you specify.

To create the sample functions, first enter the following text in the

Declarations section of a module:

   Option Compare Database

   Option Explicit

   Global Const SUCCESS_SUCCESS = 0

Then enter the following code in the module:

   ' ****************************************

   ' FUNCTION: GetPermissions()

   '

   ' Inputs:  UserGrpName - name of a user or group account

   '          ObjClass    - name of an object container

   '          ObjName     - name of an object document

   '

   ' Returns: Value of Permissions property or error number

   '          that was generated.

   ' ****************************************

   Function GetPermissions& (UserGrpName$, ObjClass$, ObjName$)

      On Error GoTo Err_GetPermissions

      ' Set DB to the current database, and set the DOC variable

      ' .. to the object specified in the arguments.

      Dim DB As Database, DOC As Document

      Set DB = DBEngine.Workspaces(0).Databases(0)

      Set DOC = DB.Containers(ObjClass).Documents(ObjName)

      ' Set the UserName property of the document to the

      ' .. user or group you want to obtain the permissions for.

      DOC.UserName = UserGrpName

      ' Get the permissions value.

      GetPermissions = DOC.Permissions

   Bye_GetPermissions:

      Exit Function

   Err_GetPermissions:

      ' If an error occurs, display the message and terminate the

      ' .. function, returning the error number.

      MsgBox Err & " " & Error$

      GetPermissions = Err

      Resume Bye_GetPermissions

   End Function

   ' ****************************************

   ' FUNCTION: SetPermissions()

   '

   ' Inputs:  UserGrpName - name of a user or group account

   '          ObjClass    - name of an object container

   '          ObjName     - name of an object document

   '          NewPerm     - new Permissions value

   '

   ' NewPerm will typically be set by adding together the constants

   ' predefined for the security options. For a list of the

   ' constants search Help on "Permissions Property."

   '

   ' Returns: SUCCESS_SUCCESS or the error number that was generated.

   ' ****************************************

   Function SetPermissions& (UserGrpName$, ObjClass$, ObjName$,_

      NewPerm&)

      On Error Goto Err_SetPermissions

      ' Set DB to the current database, and set the DOC variable

      ' to the object specified in the arguments.

      Dim DB As Database, DOC As Document

      Set DB = DBEngine.Workspaces(0).Databases(0)

      Set DOC = DB.Containers(ObjClass).Documents(ObjName)

      ' Set the UserName property of the document to the

      ' .. user or group you want to assign the permissions for.

      DOC.UserName = UserGrpName

      ' Set the permissions property to the value passed as

      ' .. an argument to the function.

      DOC.Permissions = NewPerm

      SetPermissions = SUCCESS_SUCCESS

   Bye_SetPermissions:

      Exit Function

   Err_SetPermissions:

      ' If an error occurs, display the message and terminate the

      ' .. function, returning the error number.

      MsgBox Err & " " & Error$

      SetPermissions = Err

      Resume Bye_SetPermissions

   End Function

These functions can be called anywhere you can use an expression in

Microsoft Access, including from within Access Basic code, in the

Field, Criteria, or Update To row of a query, or the ControlSource

property of a form or report control.

The following example shows how to call the GetPermissions() function from

another Access Basic function:

   Dim ObjProp as Long

   ObjProp = GetPermissions("User1","Tables","Table1")

This function call would return the permissions value for User1 on the

table object Table1.

The next example shows how to call the GetPermissions() function from the

ControlSource property of a control on a form or report with controls that

contain the user name, object class, and object name that you want to list

the permissions for:

   ControlName: ObjProp

   ControlSource: =GetPermissions(Me!UsrName, Me!ObjClass, Me!ObjName)

To assign full permissions for the Admins group to a table called

MyTable, you could call the SetPermissions() function as follows:

   Dim RETVAL as Long

   RETVAL = SetPermissions("Admins","Tables","MyTable", DB_SEC_FULLACCESS)

REFERENCES

==========

For more information about using DAO to create group and user accounts, and

about how to assign users to group accounts, query on the following words

here in the Microsoft Knowledge Base:

   DAO and Security and CreateGroup or CreateUser

Additional reference words: 2.00

KBCategory:

KBSubcategory: ScrtOthr


INF: How to Use DataPerfect Data in Microsoft Access

Article ID: Q100153

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to import data into Microsoft Access from

WordPerfect DataPerfect.

MORE INFORMATION

================

To use DataPerfect data in Microsoft Access, the information must first be

saved from DataPerfect in DOS Delimited Text format. Once this is done,

Microsoft Access can import the data using the Import command's "Text

(Delimited)" option.

Problems with Multiple-Line Field Entries

-----------------------------------------

DataPerfect allows you to create multiple-line entries by pressing ENTER

inside fields (creating a carriage return character). For example, in the

Customer Information panel of the CLIENT1 database supplied with

DataPerfect, the Address and Comment fields in some records contain two-

line entries.

NOTE: In DataPerfect, a "panel" is equivalent to a Microsoft Access

table.

DataPerfect's DOS Delimited Text files use a carriage return to mark the

end of each record, so carriage returns cannot be included in field data.

However, DataPerfect does not account for this condition when it saves the

data in DOS Delimited Text format. When carriage returns are included in

field data, DataPerfect generates a file that cannot be successfully

imported into Microsoft Access. You must remove the carriage returns before

importing the data into Microsoft Access.

The following instructions explain how to:

 - Export the Customer Information panel supplied with DataPerfect.

 - Use Microsoft Write, the word processor supplied with Microsoft

   Windows, to delete the extra carriage returns.

 - Import the resulting data into Microsoft Access.

How to Export the Panel from DataPerfect

----------------------------------------

1. Start DataPerfect.

2. From the list of databases, select CLIENT1 and press ENTER.

3. From the list of panels, select Customer Information and press

   ENTER.

4. Press SHIFT+F7 to display the report list. Select Built-In Short

   Reports from the list and then press ENTER to access the Built-In

   Report/Export menu.

5. Press 2 to select Disk File On/Off, and then press 1 to select

   Create File. Type "CUST.TXT" (without the quotation marks), and

   press ENTER.

6. Press 8 to select Report/Export Format options. Press 6 to select

   Export DOS Delimited Text.

7. Press ENTER to accept the pipe symbol (|) as the Field Delimiter.

   Press SPACEBAR to overwrite the tilde (~) character as the Record

   Delimiter, leaving the <CR><LF> in place.

8. Press SHIFT+F7 to begin the export, then press any key to return to

   the list of reports.

9. Press F1, then F7 twice, then 0 to exit DataPerfect.

How to Remove the Extra Carriage Returns

----------------------------------------

1. Start Microsoft Write.

2. From the File menu, choose Open.

3. From the list of files, select CUST.TXT (you may first have to select

   your DataPerfect directory, which is usually called DATA). Type "*.TXT"

   (without the quotation marks) and press ENTER to display a list of .TXT

   files.

4. Choose No Conversion when you are asked to convert the text file. The

   document will open on the screen with each field separated by a pipe

   symbol and each record ended with a carriage return. Lengthy records

   will wrap to the next line.

5. Lines that begin with the following text have an extra carriage

   return that incorrectly continues the record to the next line:

      1|Burnett

      26|Corrales, Jr.

      7|Frame

      19|Rhoton

      22|Tolman

   Move to the end of each of these lines, and press DEL to make the line

   flush with the line above it.

6. The second line of the records that begin with the following text

   have extra carriage returns that incorrectly mark the end of the

   record:

    10|Grayson

    21|Sergeant

   Move to the end of the second line of these records and remove

   the extra carriage return by pressing DEL.

7. From the File menu, choose Save.

8. From the File menu, choose Exit.

How to Import the DataPerfect Data into Microsoft Access

--------------------------------------------------------

1. Open the Microsoft Access database into which you want to import

   the data.

2. From the File menu, choose Import.

3. In the Data Source list, select "Text (Delimited)".

4. From the file list choose CUST.TXT (you may first have to select

   your DataPerfect directory, which is usually called DATA), and then

   choose Import.

5. In the Import Text Options box, choose Options.

6. Delete the double quotation mark from the Text Delimiter box.

7. Type the pipe symbol (|) in the Field Separator box.

8. Choose OK to begin the import.

Microsoft Access will report any errors discovered during the import. You

can examine the data in the resulting table and check to see that the

proper data was imported into the proper columns. If you find data from one

record spilling into another record, check for an extra carriage return in

that record in the export text file and then import the data into Microsoft

Access again.

REFERENCES

==========

DataPerfect "User's Guide," pages 339-343

Additional reference words: 1.00 1.10 2.00 WP

KBCategory:

KBSubcategory: IntpOthr


INF: How to Use DDE to Communicate with a Run-Time Application

Article ID: Q101318

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Run-time applications developed with Microsoft Access have the same

dynamic data exchange (DDE) server capabilities as applications in the

retail version of Microsoft Access.

However, in order to communicate with a run-time application using

DDE, you must use the name of the .MDB file, instead of "MSACCESS",

when initiating a DDE conversation.

MORE INFORMATION

================

The following example demonstrates how to communicate with a run-time

application developed with Microsoft Access:

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Choose the Macro button and select the Sample Autoexec macro.

3. From the File menu, choose Rename. In the Macro Name box, type

   "Autoexec" (without the quotation marks) and then press ENTER.

4. Quit Microsoft Access.

5. From the File menu in the Microsoft Windows Program Manager, choose

   Run.

6. Type "c:\access\msarn110.exe nwind.mdb" (without the quotation

   marks), and then press ENTER.

7. Start Microsoft Access, and create or open a database other than

   NWIND.MDB.

8. Create or open a module and add the following Access Basic

   function:

      Option Explicit

         Function DDEWithNWIND ()

             Dim chan

             chan = DDEInitiate("NWIND", "NWIND;TABLE Employees")

             MsgBox DDERequest(chan, "FirstRow")

             DDETerminate chan

         End Function

   Note that the first argument specified in the DDEInitiate command, the

   application name, is "NWIND", which is the name of the .MDB file, and

   not "MSACCESS."

9. From the View menu, choose Immediate Window. Type the following,

   and then press ENTER:

      ? DDEWithNWIND()

A message box will display the first record from the Employees table

in the NWIND.MDB database.

REFERENCES

==========

For more information on using Microsoft Access as a DDE server, query

on the following words here in the Microsoft Knowledge Base:

   DDE and server

Additional reference words: 1.10 2.00 ADK

KBCategory:

KBSubcategory: IntpDde


INF: How to Use DDE to Fill a List Box

Article ID: Q94003

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article contains an example of an Access Basic list function

that uses dynamic data exchange (DDE) to populate a list box.

The example assumes that you are familiar with DDE, how to create

modules in Access Basic, and how to create list boxes on forms.

MORE INFORMATION

================

The function below uses DDE to retrieve a list of countries from

Microsoft Excel. The list will be used to populate a list box bound to

the Country field of the Suppliers table in the sample database NWIND.MDB.

 1. In a new worksheet in Microsoft Excel, enter the following in the first

    column:

       Cell   Value

       ----------------

       A1     Australia

       A2     China

       A3     Scotland

 2. Save the worksheet as COUNTRY.XLS.

 3. Open NWIND.MDB in Microsoft Access and open a new module.

 4. Enter the following in the Declarations section:

       Option Explicit

       Dim Countries(10) As String

       Dim CountryData As String

 5. Create the following subroutine:

      Sub DDEFillCountries ()

         Dim EndString%, i%

         Dim Chan

         EndString% = 0

         i% = 0

         Chan = DDEInitiate("Excel", "COUNTRY.XLS")

         CountryData$ = DDERequest(Chan, "R1C1:R10C1")

         DDETerminate Chan

         EndString% = InStr(1, CountryData, Chr(10))

         Do Until Len(CountryData$) = 0

            Countries(i%) = Left(CountryData, EndString% - 1)

            CountryData$ = Right(CountryData, _

                         Len(CountryData) - EndString% - 1)

            EndString% = InStr(1, CountryData, Chr(10))

            i% = i% + 1

         Loop

      End Sub

 6. Create the following function:

      Function DDEFillList (fld As Control, id, row, col, code)

         Select Case code

            Case 0

               Call DDEFillCountries

               DDEFillList = True

            Case 1

               DDEFillList = id

            Case 3

               DDEFillList = 10

            Case 4

               DDEFillList = 1

            Case 5

               DDEFillList = -1

            Case 6

               DDEFillList = Countries(row)

         End Select

      End Function

 7. Save the module as DDE Fill List Box.

 8. Create a new form based on the Suppliers table.

 9. Add a list box bound to the Country field and set the following

    property:

       RowSourceType: DDEFillList

10. Verify that Microsoft Excel is running and the worksheet COUNTRY.XLS

    is open. Switch to Form view. The list box should now be populated

    with the countries that you entered in Microsoft Excel.

NOTE: This article demonstrates a simple example and is not a complete

and robust function. If you intend to use this with a form, there are

several things that you may want to add to your code, including:

 - Error checking for the DDE portion, to handle cases where Microsoft

   Excel is not running or is busy.

 - The form may need to be refreshed to show updated data.

REFERENCES

==========

For more information about filling a list box, search for "filling list

boxes/combo boxes" and then view any of the topics using the Microsoft

Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsCmbo


INF: How to Use DDE to Pass Information to MS Access v. 2.0

Article ID: Q113300

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access, you cannot poke data into a table using a dynamic data

exchange (DDE) channel. However, you can pass information to an Access

Basic function using a function with parameters in a DDE channel to the SQL

topic. The data can then be processed by the function and added to a table.

MORE INFORMATION

================

The following example demonstrates how to add a new customer to the

Customers table in the sample database NWIND.MDB using data from Microsoft

Excel and Microsoft Word for Windows:

1. Create a table called None with one field of any data type, with

   one record.

2. Open a module and create a function with the parameters that

   you want to pass. The following Access Basic function will create

   a new record in the Customers table, and accepts an argument for

   the Customer ID field and an argument for the Company Name field:

      Declarations Section

         Option Explicit

      Function AddNewCust (CustomerID$, CompanyName$)

         Dim MyDB As Database, MyTable As Recordset

         Set MyDB = DBEngine.Workspaces(0).Databases(0)

         ' Trap any error that might occur.

         On Error Resume Next

         ' Open table.

         Set MyTable = MyDB.OpenRecordset("Customers", DB_OPEN_TABLE)

         MyTable.AddNew                             ' Prepare new record.

         MyTable("Customer ID") = CustomerID$       ' Set record key.

         MyTable("Company Name") = CompanyName$     ' Set company name.

         MyTable.Update                             ' Save changes.

         MyTable.Close                              ' Close table.

         ' Return the error code.

         AddNewCust = Err

      End Function

   This function will return 0 if successful, otherwise a Microsoft Access

   error number will be returned. If a record in the Customers table

   already exists with the specified Customer ID, error number 3022 will be

   returned. This error would return the following error message if it

   were not trapped:

      Duplicate value in index, primary key, or relationship.

      Changes were unsuccessful.

3. In the DDE client application, initiate a DDE link using MSACCESS

   as the application and a SQL select query as the topic. The topic

   should be of the form:

      DatabaseName;SQL Select FunctionName(args) From None;

   In the sample topic above, None is the name of the empty table, and

   FunctionName(args) is the call to the Access Basic function that

   processes the arguments (args) passed to it.

   For example, the following Microsoft Excel macro will insert a new

   record with "JOHNJ" as the Customer ID and "John's Place" as the Company

   Name into the Customers table:

   NOTE: In the following sample code, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this code.

      AddNewCustomer

      chan=INITIATE("MSACCESS","NWIND;SQL SELECT _

         AddNewCust(""JOHNJ"",""John's Place"") FROM None;")

      =ALERT(REQUEST(chan,"FirstRow"))

      =TERMINATE(chan)

      =RETURN()

   The following is the equivalent Microsoft Excel Visual Basic

   function:

      Function AddNewCustomer()

         Chan = DDEInitiate("MSACCESS", "NWIND;SQL SELECT _

            AddNewCust(""TADO"",""Tad's Place"") FROM None;")

         Result = DDERequest(Chan, "FirstRow")

         MsgBox Result(1)

         DDETerminate Chan

      End Function

   The following is the equivalent Microsoft Word for Windows Word

   Basic macro:

      Sub MAIN

         qt$ = Chr$(34) ' create the quote character

         Funct$ = "AddNewCust(" + qt$ + "JOHNJ" + qt$ + "," + qt$ + _

            "John's Place" + qt$ + ")"

         Chan = DDEInitiate("MSACCESS", "NWIND;SQL SELECT " + Funct$ + _

            " FROM None;")

         Result$ = DDERequest$(Chan, "FirstRow")

         MsgBox Result$

         DDETerminate Chan

      End Sub

How the SQL Initiate Technique Works

------------------------------------

When you initiate a DDE link with Microsoft Access using an SQL statement,

each function in the SELECT statement will run one time for each record in

the table the query selects from.

In the examples above, the None table has only one record to query against.

Since the table has only one record, the AddNewCust() function runs only

one time. If the None table had two records, the AddNewCust() function

would run twice, trying to add the same record two times.

The query's result will return the results of the function being called in

the SELECT statement. The AddNewCust() function returns the error code if

an error occurs. This is useful so that the DDE client, such as Microsoft

Excel, Word, or Visual Basic, can know whether the function ran

successfully or not.

REFERENCES

==========

For more information, search for "DDE" then "Using Microsoft Access as a

DDE Server" using the Microsoft Access Help menu.

Additional reference words: ddepoke

KBCategory:

KBSubcategory: IntpOthr


INF: How to Use Get, WritePrivateProfileString

Article ID: Q90988

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not have a function to store or access settings in

user-created applications (that is, a log of users, window position

settings, and so on). However, you can use the Microsoft Windows 3.1

Application Program Interface (API) through Access Basic to create user-

defined functions to store and access settings in a file outside the

database.

MORE INFORMATION

================

Definition Of Variables Used

----------------------------

Variables Required By GetPrivateProfileString and

WritePrivateProfileString:

   lpfilename$        - Filename looked for in Windows directory by

                        default

   lpapplicationname$ - Section title in square brackets in the .INI

                        file

   lpkeyname$         - The section in the .INI file where the

                        information is located

   lpDefault$         - What information to give if there is no value

   lpreturnedstring$  - Information asked for from the .INI file

   nSize%             - Maximum number of characters the buffer holds of

                        information returned

   lpString$          - The information saved in the .INI file

User-Defined Variables

----------------------

   GotInfo  - Information retrieved from the level requested

   GetInfo$ - Used to pass the lpkeyname$ to function GetInfo

   Where$   - Used to pass the lpkeyname$ to function WriteIni

   Info$    - Used to pass the lpString$ to function WriteIni

How to Create the Functions

---------------------------

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

1. Create a new module.

2. Type the following declarations in the Global Declarations section:

      Option Explicit

      Declare Function GetPrivateProfileString% Lib "Kernel"_

                              (ByVal lpapplicationname$,_

                               ByVal lpkeyname$,_

                               ByVal lpDefault$,_

                               ByVal lpreturnedstring$,_

                               ByVal nSize%, ByVal lpfilename$)

      Declare Function WritePrivateProfileString% Lib "Kernel"_

                              (ByVal lpapplicationname$,_

                               ByVal lpkeyname$,_

                               ByVal lpString$,_

                               ByVal lpfilename$)

      Dim GotInfo As String

3. Type the following functions in the module:

      Function GetIni (GetInfo$)

      Dim lpfilename$, lpapplicationname$, lpkeyname$, lpDefault$, _

                                       lpreturnedstring$

      Dim nSize%

         lpfilename$ = "<YOUR.INI>"

         lpapplicationname$ = "<Your Section>"

         lpkeyname$ = GetInfo$

         lpDefault$ = "No Value"

         lpreturnedstring$ = Space$(255)

         nSize% = Len(lpreturnedstring$)

         GetIni = GetPrivateProfileString(lpapplicationname$,_

                                       lpkeyname$, lpDefault$,_

                                       lpreturnedstring$, nSize%,_

                                       lpfilename$)

         GotInfo = lpreturnedstring$

      End Function

      Function WriteIni (Where$, Info$)

      Dim lpapplicationname$, lpkeyname$, lpString$, lpfilename$

         lpapplicationname$ = "<Your Section>"

         lpkeyname$ = Where$

         lpString$ = Info$

         lpfilename$ = "<YOUR.INI>"

         WriteIni = WritePrivateProfileString(lpapplicationname$,_

                                       Where$, Info$, lpfilename$)

      End Function

How to Use the Functions

------------------------

1. When used in a macro, the function WriteIni() creates the entry

   First=<TIME> in the file <YOUR.INI> in the [<Your Section>] section.

   The following line calls the function:

      =WriteIni("First","<TIME>")

   In the file <YOUR.INI> the entry looks like the following:

      [<Your Section>]

      First=<TIME>

2. Use the function GetIni() in a macro to return <TIME> in the variable

   GotInfo as follows:

      =GetIni("First")

   The variable GotInfo now holds the value <TIME> and can be used anywhere

   needed in the application.

NOTE: This example does not have error trapping. Unexpected results

may occur if the declarations and the variable types are not correct

or your file is not in the location specified or does not exist.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, chapters 1-5

Microsoft Access "Language Reference," version 1.0, Part 1

"Microsoft Windows Software Development Kit," Microsoft Press, 1992

"Programming Windows: the Microsoft Guide to Writing Applications for

Windows 3," Charles Petzold, Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to

Programming Reference," Volumes 1-6, Microsoft Press, 1992

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: PgmApi


INF: How to Use Graphic Images as Wallpaper for Forms

Article ID: Q103428

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use graphic images as "wallpaper," or background, for your forms to

make them more attractive.

MORE INFORMATION

================

The following example demonstrates how to add wallpaper to a form:

1. Start the Microsoft Windows Paintbrush program (or any graphics program

   of your choice) and open the WINLOGO.BMP bitmap file (or any bitmap file

   of your choice).

2. Select the graphics image. If you are using Paintbrush, choose the Pick

   tool (a pair of open scissors below a dotted rectangle) from the

   toolbox. Select the bitmap image by using the mouse to place the

   crosshairs in the upper-left corner of the bitmap, then click and hold

   down the left mouse button and drag the rectangle to the lower-right

   corner to encompass the entire image.

3. From the Edit menu, choose Copy. This places a copy of the bitmap image

   on the Windows Clipboard.

4. Start Microsoft Access, and open the sample database NWIND.MDB.

5. Open the Customers form in Design view. Select the form by clicking the

   small, white box in the upper-left corner of the form.

6. From the Edit menu, choose Paste. This pastes the bitmap image to an

   object frame control on the form.

   Note that the graphic image does not cover the entire form, but only the

   upper-left corner of it. This is because this particular graphic image

   is too small for the form. To cover the entire form, either use a larger

   graphic image, or use a different graphics program to alter the

   graphic's size.

7. From the Layout menu, choose Send To Back. This puts the graphic image

   in the background.

8. On this form, the BackStyle property for all the label controls is set

   to Clear. In order to make the labels more readable against the new

   background, change the labels' BackStyle properties to Normal. You can

   also change the BackColor properties, using the Color Palette.

REFERENCES

==========

"Inside Microsoft Access," April 1993, Vol. 1, No. 2, pages 1-5

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlApp


INF: How to Use In-Place Activation with OLE Objects

Article ID: Q112748

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 supports in-place activation of OLE objects in

a form's Form view. In a form or report's Design view, or in a table,

query, or form's Datasheet view, activation of an OLE object will cause the

object's original application to run in the background as a server

application (if the original application is available), so you can edit the

object in Microsoft Access.

MORE INFORMATION

================

In-place activation of an OLE object allows you to edit or otherwise

manipulate the object without switching to the object's original

application. For example, you could edit an embedded document that was

created in Microsoft Word for Windows without having to start Word for

Windows.

When you edit an OLE object in place, the object's border becomes a hatched

frame and the menus and menu options supported by the object's original

application are added to the standard Microsoft Access menus. Tool bars

supported by the object's original application may also be displayed.

The object's original application runs in the background and supplies the

functionality it supports for the object, but the application is not

visible and does not appear in the Windows Task List.

For an OLE object to be activated in place, the following must be true:

 - The object must have been created in an OLE server application

   that supports in-place activation.

 - The object must be displayed in an object frame on a form that

   is open in Form view.

 - The frame's Enabled property must be set to Yes.

If the Locked property is set to Yes, you will be able to edit the object,

but any changes you make will be discarded when the object is deactivated.

If the object is linked, you can activate it in place, but you cannot edit

it in place.

The AutoActivate property controls how an object is activated. The default

value is Double-Click, which allows you to double-click the object to

activate it. If you change this property to GetFocus, the object is

activated as soon as you select or tab to it. If you set the property to

Manual, you have to select the object, choose <object type> from the Edit

menu, and then choose the first verb listed to activate it.

The following is an example of how to create an OLE object that supports in-

place activation:

1. Start Microsoft Access and either create a new database or open one

   of your choosing.

2. Create a new form.

3. Using the Unbound Object Frame tool, create a new frame on the

   form.

4. In the Object Type box, select a server that supports OLE 2.0. For

   this example, choose Microsoft Graph 5.0, and then choose OK.

5. From the Microsoft Graph File menu, choose Exit & Return To Form:

   <Formname>.

6. In Microsoft Access, set the frame's Enabled property to Yes and

   its Locked property to No.

7. View the form in Form view.

8. Double-click the embedded graph. The graph's border will change to

   a hatched frame, and several menus and menu options will change. If

   no Graph 5.0 tool bars are displayed, choose Toolbars from the View

   menu and select one of the tool bar check boxes.

9. Click anywhere in the form outside of the OLE object to deactivate

   the graph.

REFERENCES

==========

For more information on in-place activation and in-place editing search on

"in-place activation" and "in-place editing" using the Microsoft Access

Help menu.

For more information on whether or not a specific object application

supports in-place activation, refer to that application's documentation.

Additional reference words: 2.00 Interoperability OLE Embedding Embed

Linking Link

KBCategory:

KBSubcategory: IntpOle


INF: How to Use OLE Automation to Transfer Data to MS Excel

Article ID: Q114836

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access version 2.0, you can use code to manipulate data in

applications that support OLE Automation, such as Microsoft Word version

6.0 for Windows or Microsoft Excel version 5.0.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

The following example demonstrates how to take data from a text box on a

form and place it in a cell on an existing Microsoft Excel spreadsheet, and

then format the text as bold:

1. Start Microsoft Excel and create a new spreadsheet. Save the

   spreadsheet as C:\ACCESS2\OLE_TEST.XLS.

2. Start Microsoft Access and open any database. Create a new, unbound

   form. Create a new text box on the form. Set the text box's Name

   property to ToExcel.

3. Create a command button on the form, without using the Command Button

   Wizard. If the property sheet is not open, open it by choosing the

   Properties button on the toolbar.

4. Create an OnClick event procedure for the command button by clicking

   in the button's OnClick property field, choosing the Build button to

   the right of the field, selecting Code Builder, and then choosing OK.

5. Insert the following code in the procedure:

      Dim mysheet As Object

      'Set object variable equal to the OLE object.

      Set mysheet = GetObject("c:\access2\ole_test.xls", "excel.sheet")

      'Put the value of the ToExcel text box into the cell on the

      'spreadsheet and make the cell bold.

      mysheet.cells(1, 1).value = Me!ToExcel

      mysheet.cells(1, 1).font.bold = True

      'Set the Visible property of the sheet to True, save the

      'sheet, and quit Microsoft Excel.

      mysheet.application.windows("ole_test.xls").visible = True

      mysheet.application.activeworkbook.save

      mysheet.application.[quit]

      'Clear the object variable.

      Set mysheet = Nothing

   NOTE: The brackets around the word "quit" are necessary to specify that

   this is a Microsoft Excel method, rather than a Microsoft Access method.

6. Close the form module.

7. View the form in Form view. Type any text in the text box, and

   then click the command button.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 13,

"Communicating with Other Applications"

For more information about OLE Automation, search for "OLE Automation" then

"Interoperability with Microsoft Word and Microsoft Excel" using the

Microsoft Access Help menu.

For more information about the syntax used in communicating with an

application via OLE Automation, see the documentation for that application.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IntpOthr


INF: How to Use Seek Method with Multiple-Field Index

Article ID: Q109710

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use the Seek method when your table's primary

key or index includes more than one field. Note that when you use the Seek

method on multiple fields, the Seek fields must be in the same order as the

fields in the underlying table. If they are not, the Seek will fail.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

When you use the Seek method to find a record using the primary key, you

need to supply a value for each field in the primary key. If you cannot

supply values for all the fields in the primary key, use ">" instead of "="

for the Comparison argument.

If you set the Index property in your function, refer to the primary key

field as PrimaryKey, instead of its actual name. With a non-primary index

in Microsoft Access version 1.x, refer to the field as Index1, Index2,

Index3, Index4, or Index5, corresponding to the two-field index created in

the table.

In Microsoft Access version 2.0, you can rename multiple-field indexes to a

custom user-defined name. For example, in version 1.x, a multiple-field

index on the First Name and Last Name fields might be assigned to "Index1."

In version 2.0, you can create your own assigned name by using the Indexes

window in a table's Design view. "Index1" could be changed to "First Name

and Last Name." Microsoft Access version 1.x prohibits custom multiple-

field index names, while version 2.0 permits them. All versions of

Microsoft Access refer to a multiple-field primary key as PrimaryKey.

The following example demonstrates how to use the Seek method on a table

with a multiple-field primary key:

1. Open the sample database NWIND.MDB.

2. Create a new module and enter the following sample function:

      '**************************************************

      'Declarations section of the module

      'This function uses Seek on a two-field PrimaryKey

      '**************************************************

      Option Explicit

      Function SeekTwoField1()

         Dim db As Database, tbl As Table

         Set db = CurrentDB()

         Set tbl = db.OpenTable("Order Details")

         tbl.Index = "PrimaryKey"    'Or "Indexn" on a two-field index in

                                     '1.x or "MyIndex" in 2.0.

         tbl.Seek "=", 10000, 17

         If tbl.NoMatch Then

               MsgBox "Not a record. Try another"

            Else

               MsgBox "The Record is in the table"

         End If

        tbl.Close

      End Function

      '*****************************************************

      'Declarations section of the module

      'This function uses Seek on a two-field PrimaryKey,

      'when only one field is supplied to the function

      '*****************************************************

      Option Explicit

      Function SeekTwoField2()

         Dim db As Database, tbl As Table

         Set db = CurrentDB()

         Set tbl = db.OpenTable("Order Details")

         tbl.Index = "PrimaryKey"    'Or "Indexn" on a two-field index in

                                     '1.x or "MyIndex" in 2.0.

         tbl.Seek ">", 10000

         If tbl.NoMatch Then

               MsgBox "Not a record. Try another"

            Else

               MsgBox "The Record is in the table"

         End If

        tbl.Close

      End Function

3. Type the following in the Immediate window and then press ENTER:

      ? SeekTwoField1()

You will receive the message "The Record is in the table."

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 8,

"Manipulating Data," page 114

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Use SendKeys in a Macro to Change an OLE Link

Article ID: Q94040

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes two methods to automate the changing of a linked

object's source. The first method is to use a macro, and the second method

is to use OLE Automation, which is available in Microsoft Access version

2.0.

MORE INFORMATION

================

Macro Method

------------

The following example demonstrates how to create and use a macro that

will automatically change the source of a linked OLE object based on a

filename stored in a table.

1. Create a new table with the following fields, and then save it as

   Linked References:

      Table: Linked References

      ------------------------

      FieldName: Key

         DataType: Counter

      FieldName: File Name

         DataType: Text

      FieldName: Linked Object

         DataType: OLE Object

2. In Datasheet view, add the following records to the table. Note

   that the bitmaps used in this example are stored in the Microsoft

   Windows directory (by default, C:\WINDOWS). To embed the objects,

   open each bitmap in Microsoft Windows Paintbrush, select the bitmap

   with the selection tool, and then choose Copy from the Edit menu.

   Switch to Microsoft Access, place the cursor in the Linked Object

   field, and choose Paste Link from the Edit menu.

      Key           Filename      Linked Object

      --------------------------------------------------

      (counter)     ARCADE.BMP     Paste Link ARCADE.BMP

      (counter)     ARCHES.BMP     Paste Link ARCHES.BMP

      (counter)     ARGYLE.BMP     Paste Link ARGYLE.BMP

3. Create a new form based on the table Linked References, and add all

   three fields to the form.

4. Save the form as OLE Test.

5. Create a new macro with the following actions:

      In Microsoft Access version 1.x:

         Action           Arguments

         ----------------------------------------------------------

         GoToControl      Control Name: Linked Object

         SendKeys         Keystrokes: %eol

                          Wait: No

         SendKeys         Keystrokes: =Forms![OLE Test]![File Name]

                          Wait: No

         SendKeys         Keystrokes: {ENTER}

                          Wait: No

      In Microsoft Access version 2.0:

         Action           Arguments

         ----------------------------------------------------------

         GoToControl      Control Name: Linked Object

         SendKeys         Keystrokes: %ekl%c

                          Wait: No

         SendKeys         Keystrokes: =Forms![OLE Test]![File Name]

                          Wait: No

         SendKeys         Keystrokes: {ENTER}{ENTER}

                          Wait: No

6. Save the Macro as Update OLE Link.

7. Open the form OLE Test in Design view and select the control File

   Name.

8. Set the AfterUpdate property to the macro Update OLE Link.

9. To test the form, switch to Form view. Change the field File Name

   in the first record to LEAVES.BMP. The OLE object should update to

   display the bitmap LEAVES.BMP.

OLE Automation

--------------

Microsoft Access version 2.0 supports OLE Automation, a feature of the OLE

2.0 standard. You can use OLE Automation to directly access and manipulate

another application's objects from outside that application.

1. Create the following subprocedure in the File Name control's AfterUpdate

   event procedure. The procedure uses the SourceDoc and Action properties

   to change the source of the linked object.

      Sub File_Name_AfterUpdate ()

        Const OLE_LINKED = 0

        Const OLE_CREATE_LINK = 1

        Const OLE_SIZE_ZOOM = 3

        [Linked Object].OLETypeAllowed = OLE_LINKED ' Object type allowed

        [Linked Object].SourceDoc = [File Name]     ' Specify source file

        [Linked Object].Action = OLE_CREATE_LINK    ' Create linked object

        [Linked Object].SizeMode = OLE_SIZE_ZOOM    ' Adjust control size

      End Sub

2. View the Linked References table in Form view.

3. Change the File Name control to REDBRICK.BMP. The OLE object should

   update to display the REDBRICK.BMP bitmap.

REFERENCES

==========

Microsoft Access "User's Guide," versions 1.0 and 1.1, Chapter 13

Microsoft Access "User's Guide," version 2.0, Chapter 19

Microsoft Access "Building Applications," version 2.0, Chapter 13

Additional reference words: 1.00 1.10 2.00 bound

KBCategory:

KBSubcategory: IntpOle


INF: How to Use the Attributes Property for TableDef Objects

Article ID: Q117536

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use the Attributes property of a TableDef object to determine

specific table properties. For example, you can use the Attributes property

to find whether a table is a system table or an attached table.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

MORE INFORMATION

================

The Attributes property of a TableDef object specifies characteristics of

the table represented by the TableDef object. The Attributes property is

stored as a single Long number and is the sum of the following Long

constants:

   Constant            Description

   ----------------------------------------------------------------------

   DB_ATTACHEXCLUSIVE  For databases that use the Microsoft Jet database

                       engine, indicates the table is an attached table

                       opened for exclusive use.

   DB_ATTACHSAVEPWD    For databases that use the Jet database engine,

                       indicates the user ID and password for the

                       attached table should be saved with the connection

                       information.

   DB_SYSTEMOBJECT     Indicates the table is a system table.

   DB_HIDDENOBJECT     Indicates the table is a hidden table (for

                       temporary use).

   DB_ATTACHEDTABLE    Indicates the table is an attached table from a

                       non-Open Database Connectivity (ODBC) database,

                       such as Microsoft Access or Paradox.

   DB_ATTACHEDODBC     Indicates the table is an attached table from an

                       ODBC database, such as Microsoft SQL Server or

                       ORACLE Server.

For a TableDef object, use of the Attributes property depends on the status

of TableDef, as the following table shows:

   TableDef                            Usage

   ----------------------------------------------

   Object not appended to collection   Read/write

   Base table                          Read-only

   Attached table                      Read-only

When checking the setting of this property, you can use the AND operator to

test for a specific attribute. For example, to determine whether a table

object is a system table, perform a logical comparison of the TableDef

Attributes property and the DB_SYSTEMOBJECT constant.

Sample Code

-----------

The following user-defined sample Access Basic function loops through all

the tables in a database and displays a message box listing each table name

and whether or not the table is a system table:

  Option Compare Database   'Use database order for string comparisons.

  Option Explicit

  Function ShowTableAttribs()

     Dim DB As Database

     Dim T As TableDef

     Dim TType As String

     Dim TName As String

     Dim Attrib As String

     Dim I As Integer

     Set DB = DbEngine.Workspaces(0).Databases(0)

     For I = 0 To DB.Tabledefs.Count - 1

        Set T = DB.Tabledefs(I)

        TName = T.Name

        Attrib = (T.Attributes And DB_SYSTEMOBJECT)

        MsgBox TName & iif(Attrib, ": System Table", ": Not System Table")

     Next I

  End Function

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 7, "Objects

and Collections," pages 155-181

For more information about the Attributes property, search for "Attributes"

then "Attributes Property" using the Microsoft Access Help menu.

Additional reference words: 2.00 dao

KBCategory:

KBSubcategory: PgmObj


INF: How to Use the ColumnWidth Property

Article ID: Q111778

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes the ColumnWidth property, which applies to fields,

or columns, in Datasheet view. In Microsoft Access version 1.1, this

property is documented in the "The Secrets of Access Wizards" manual which

is included with the Microsoft Access Distribution Kit. In Microsoft Access

version 2.0, this property is documented in the online Help system.

MORE INFORMATION

================

The ColumnWidth property applies to fields, or columns, in Datasheet view.

It is an integer that represents the column width in twips. You can specify

a width, or use one of the following predefined settings:

   Setting   Description

   -----------------------------------------------------------------

    0        Hides the column

   -1        Sizes the column to the default width (default setting)

   -2        Sizes the column to fit the visible text

Note that you can also set this property by choosing the Column Width

command from the Layout menu in Microsoft Access version 1.x, or from the

Format menu in Microsoft Access version 2.0, in Datasheet view.

If you set a field's ColumnWidth property to 0 to hide the field, that

field's ColumnHidden property will be set to -1. If you set the field's

ColumnHidden property to 0 to show the field, the field's ColumnWidth

property will be restored to the setting it had before the field was

hidden. If you hid the field by setting its ColumnWidth property to 0, the

ColumnWidth property will be set to -1, which is the default width. Note

that the ColumnWidth property for a field is not available when the field's

ColumnHidden property is set to -1.

Microsoft Access evaluates the properties for a table or query in Datasheet

view when the table or query is first opened in Datasheet view. If the

table or query is open in Datasheet view when you change a field's

ColumnWidth property using Access Basic, the changes will not take effect

until you close and then reopen the table or query in Datasheet view.

In Microsoft Access version 1.x, in order to change the ColumnWidth

property of a field on a form, the form must be open in Design view. If the

form is not open in Design view, the property is read-only. In Microsoft

Access version 2.0, the form can be open in any view, and changes to the

ColumnWidth property will take effect immediately.

The following example demonstrates how to set the ColumnWidth property for

the Customers form in Datasheet view. This setting will change the Address

column's width to 1.5 inches (2160 twips):

   Forms![Customers]![Address].ColumnWidth = 2160

REFERENCES

==========

Microsoft Access Distribution Kit, "The Secrets of Access Wizards," version

1.1, page 12

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Use the GetSystemMetrics() API Call

Article ID: Q88922

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In the Windows environment, various display resolutions may cause

screens to appear out of proportion. As a developer, you can obtain

the width and height of various elements of the window display using

the Windows application programming interface (API) function

GetSystemMetrics(). Incorporating this function into a Microsoft Access

application gives the developer more information for designing the user

interface.

This article describes the GetSystemMetrics() API function and discusses

a sample application that uses the function to display various object

sizes in a message box.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The Windows GetSystemMetrics() API function retrieves information about

the system metrics (the width and height of various display elements

of a particular window). The GetSystemMetrics() function can also return

flags that indicate whether a mouse is present or if the meaning of

the left and right mouse buttons have been reversed. System metrics

are dependent upon the system display, and may vary from display to

display.

To use the GetSystemMetrics() functions, do the following:

1. Place the following Declare statement in the global section of the

   Access Basic Code window:

      Declare Function GetSystemMetrics% Lib "user" (ByVal nIndex%)

2. Depending on what window property you want to determine, you must

   define the correct constant to pass to the GetSystemMetrics()

   function. Below are sample declarations of the constants and their

   meaning:

     Const SM_CXSCREEN = 0        ' Width of screen

     Const SM_CYSCREEN = 1        ' Height of screen

     Const SM_CXFULLSCREEN = 16   ' Width of window client area

     Const SM_CYFULLSCREEN = 17   ' Height of window client area

     Const SM_CYMENU = 15         ' Height of menu

     Const SM_CYCAPTION = 4       ' Height of caption or title

     Const SM_CXFRAME = 32        ' Width of window frame

     Const SM_CYFRAME = 33        ' Height of window frame

     Const SM_CXHSCROLL = 21      ' Width of arrow bitmap on

                                  '  horizontal scroll bar

     Const SM_CYHSCROLL = 3       ' Height of arrow bitmap on

                                  '  horizontal scroll bar

     Const SM_CXVSCROLL = 2       ' Width of arrow bitmap on

                                  '  vertical scroll bar

     Const SM_CYVSCROLL = 20      ' Height of arrow bitmap on

                                  '  vertical scroll bar

     Const SM_CXSIZE = 30         ' Width of bitmaps in title bar

     Const SM_CYSIZE = 31         ' Height of bitmaps in title bar

     Const SM_CXCURSOR = 13       ' Width of cursor

     Const SM_CYCURSOR = 14       ' Height of cursor

     Const SM_CXBORDER = 5        ' Width of window frame that cannot

                                  '  be sized

     Const SM_CYBORDER = 6        ' Height of window frame that cannot

                                  '  be sized

     Const SM_CXDOUBLECLICK = 36  ' Width of rectangle around the

                                  '  location of the first click. The

                                  '  second click must occur in the

                                  '  same rectangular location.

     Const SM_CYDOUBLECLICK = 37  ' Height of rectangle around the

                                  '  location of the first click. The

                                  '  second click must occur in the

                                  '  same rectangular location.

     Const SM_CXDLGFRAME = 7      ' Width of dialog frame window

     Const SM_CYDLGFRAME = 8      ' Height of dialog frame window

     Const SM_CXICON = 11         ' Width of icon

     Const SM_CYICON = 12         ' Height of icon

     Const SM_CXICONSPACING = 38  ' Width of rectangles the system

                                  ' uses to position tiled icons

     Const SM_CYICONSPACING = 39  ' Height of rectangles the system

                                  ' uses to position tiled icons

     Const SM_CXMIN = 28          ' Minimum width of window

     Const SM_CYMIN = 29          ' Minimum height of window

     Const SM_CXMINTRACK = 34     ' Minimum tracking width of window

     Const SM_CYMINTRACK = 35     ' Minimum tracking height of window

     Const SM_CXHTHUMB = 10       ' Width of scroll box (thumb) on

                                  '  horizontal scroll bar

     Const SM_CYVTHUMB = 9        ' Width of scroll box (thumb) on

                                  '  vertical scroll bar

     Const SM_DBCSENABLED = 42    ' Returns a non-zero if the current

                                  '  Windows version uses double-byte

                                  '  characters, otherwise returns

                                  '  zero

     Const SM_DEBUG = 22          ' Returns non-zero if the Windows

                                  '  version is a debugging version

     Const SM_MENUDROPALIGNMENT = 40

                                  ' Alignment of popup menus. If zero,

                                  '  left side is aligned with

                                  '  corresponding left side of menu-

                                  '  bar item. If non-zero, left side

                                  '  is aligned with right side of

                                  '  corresponding menu bar item

     Const SM_MOUSEPRESENT = 19   ' Non-zero if mouse hardware is

                                  '  installed

     Const SM_PENWINDOWS = 41     ' Handle of Pen Windows dynamic link

                                  '  library if Pen Windows is

                                  '  installed

     Const SM_SWAPBUTTON = 23     ' Non-zero if the left and right

                                  ' mouse buttons are swapped

The following sample call will return the height of a form's caption

bar:

   HeightY% = GetSystemMetrics(SM_CYCAPTION)

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: How to Use the IIf() (Immediate If) Function

Article ID: Q106288

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You may receive unexpected results when you are using the IIf() (Immediate

If) function to evaluate an expression. Your results will depend on the use

of double quotation marks in the function's arguments.

MORE INFORMATION

================

The following example demonstrates how the use of double quotation marks in

the IIf() function's arguments can affect the results:

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Orders table:

      Query: Test

      ---------------------------------------

      FieldName: Sum(IIf("[Freight]>50",1,0))

         Total: Expression

3. Run the query. The result will be 1078 records, the total number of

   orders, not just those with a freight charge greater than 50.

4. View the query in Design view. Remove the double quotation marks so the

   query matches the following:

      Query: Test

      -------------------------------------

      FieldName: Sum(IIf([Freight]>50,1,0))

         Total: Expression

5. Run the query again. The result will be 447 records, which is the

   number of records with a freight charge greater than 50.

The double quotation marks around the "[Freight] > 50" argument caused

Microsoft Access to evaluate the expression as a string instead of as a

comparison. A string will always evaluate to true, while a comparison will

test for the condition to be met before returning a value.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ExrOthr


INF: How to Use the LIKE Operator in Parameter Queries

Article ID: Q88671

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to search for all the records that begin

with a certain letter.

MORE INFORMATION

================

An easy way to prompt for a character to search for is to create a

parameter query. The LIKE operator can be used with the wildcard symbol (*)

to accomplish this task.

First, create a query for the tables you want, and then place the

following in the criteria for the field:

   LIKE "|[Enter the first char to search by: ]|*"

Note that the Parameters dialog box has a display limited of 37 characters.

When you run this query you will be prompted with the message you specified

in the LIKE statement. To find records that start with a "C", type "c"

(without the quotation marks) and begin the search.

REFERENCES

==========

For more information on parameter queries, search for "parameter query"

then "Creating a Parameter Query" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryParm


INF: How to Use the Parent Property of a Subform

Article ID: Q100025

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use a subform's Parent property to

return the name of its parent form.

MORE INFORMATION

================

The following is the correct syntax for the Parent property in macro

actions called from a subform:

   Forms![Main Form Name]![Subform ControlName].Form.Parent.Formname

   -or-

   Form.Parent.Formname

   -or-

   Parent.Formname

In a Microsoft Access version 2.0 event procedure use:

   Me.Parent.Name

NOTE: In Microsoft Access 2.0, use the Name property instead of FormName.

The following example demonstrates how to use the Parent property in a

macro:

1. Open the sample database NWIND.MDB.

2. Create and save the following macro:

      Macro: Get Parent Name

      ---------------------------------------------------------------

      Action: MsgBox

         Message: =Forms!Orders![Orders Subform].Form.Parent.Formname

         Title: Parent Form Name

2. Open the "Orders Subform" form in Design view. Add the "Get Parent

   Name" macro to the Product ID field:

      Object: Text Box

      ------------------------------

      ControlName: Product ID

         OnDblClick: Get Parent Name

3. Save and close "Orders Subform."

5. Open the Orders form. Double-click the Product ID field in the

   subform. The parent form name, Orders, will display.

6. Close the Orders form. Open the "Orders Subform" form in Design view,

   and remove the macro added in step 2.

Additional reference words: 1.00 1.10 2.00 main mainform sub

KBCategory:

KBSubcategory: FmsSubf


INF: How to Use the Query by Form (QBF) Technique

Article ID: Q95931

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use a form to specify the criteria for a

query in Microsoft Access. This technique is called query by form (QBF).

MORE INFORMATION

================

You use the QBF technique to create a query form in which you enter query

criteria. The query form contains blank text boxes, each representing a

field in a table that you want to query. You make entries in only the

text boxes for which you want to specify search criteria.

The query form is usually very similar to a data entry form, as in the

following sample query form:

   First Name: __________

   Last Name:  __________

   City:       __________

   State:      __________

   Zip Code:   __________

You can enter any combination of search criteria in the form. You can

specify only a City, a City and a State, only a Zip Code, or any other

combination of values. Fields that you leave blank on the form are

ignored (no search criteria are applied to those fields). When you choose

the Search button, a query will be performed using the search criteria

from your form.

The following example demonstrates how to create a query form:

1. Open the sample database NWIND.MDB.

2. Create the following new, unbound form and save it as QBF_Form:

      Form: QBF_Form

      ---------------------------------

      Text box:

         ControlName: What Customer ID?

      Text box:

         ControlName: What Employee ID?

      Command button:

         Caption: Search

         OnPush: QBF_Macro

   NOTE: In Microsoft Access version 2.0, the OnPush property is named

   OnClick.

3. Create the following new macro, and then save it as QBF_Macro:

      Macro: QBF_Macro

      ------------------

      OpenQuery

         Query Name: QBF_Query

         View: Datasheet

         Data Mode: Edit

4. Create the following new query based on the Orders table, and then save

   it as QBF_Query:

   NOTE: In the following sample query, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this query.

      Query: QBF_Query

      ----------------------------------------------------

      Field: Customer ID

         Sort: Ascending

         Criteria: Forms![QBF_Form]![What Customer ID?] Or _

                   Forms![QBF_Form]![What Customer ID?] Is Null

      Field: Employee ID

         Sort: Ascending

         Criteria: Forms![QBF_Form]![What Employee ID?] Or _

                   Forms![QBF_Form]![What Employee ID?] Is Null

      Field: Order ID

      Field: Order Date

5. View the QBF form in Form view. Enter the following combinations of

   criteria, choosing the Search button after each combination:

      Customer ID   Employee ID      Result

      ------------------------------------------------------------

      <blank>       <blank>          All 1078 orders

      AROUT         <blank>          14 orders for AROUT

      AROUT         4                4 AROUT orders for employee 4

      <blank>       4                209 orders for employee 4

After you view the dynaset, or set of results, for each query, close the

Datasheet window before beginning your next search. Each time you choose

the Search button, the parameters in the QBF query filter the data

according to the search criteria specified on the QBF query form.

Notes on the QBF Parameter Criteria

-----------------------------------

The sample QBF query above implements a criterion in the query as

   Forms!FormName!ControlName Or Forms!FormName!ControlName Is Null

to filter the data. This criterion returns all matching records. If a

criterion is null, all the records are returned for the specified field.

You can specify any of the following alternative criteria to return

slightly different results:

NOTE: In the following sample criteria, an underscore (_) is used as a

line- continuation character. Remove the underscore when re-creating these

criteria.

 - Like "|Forms!FormName!ControlName|*" Or _

   Forms!FormName!ControlName Is Null

   This criterion is the same as the QBF sample above, except that you

   can query using a wildcard. For example, if you enter "Jo" in a field

   using this criterion, the query will return everything in the field

   that begins with "Jo", including Johnson, Jones, Johanna, and so on,

   instead of returning only items with an exact match of "Jo".

 - Between Forms!FormName!StartDate And Forms!FormName!EndDate Or _

   Forms!FormName!StartDate Is Null

   You can use this criterion to query a date field, using Start Date

   and End Date text boxes on the query form. Records whose start and

   end dates fall between the values you specify on the query form will

   be returned.

 - Like Forms!FormName!ControlName & "*" Or Is Null

   This criterion returns both records that match the criterion and

   records that are null. If the criterion is null, all the records

   are returned. Note that the asterisk (*) is considered a parameter,

   as it is part of a larger Like expression. Since the asterisk is a

   hard-coded criterion value (for example, Like "*") records with null

   values are returned.

 - Like IIf(IsNull(Forms!FormName![ControlName]), _

   "*",[Forms]![FormName]![ControlName])

   This criterion returns all the records that match the criterion. If

   no criterion is specified in the query form, all records that are NOT

   null are returned.

 - IIf(IsNull(Forms!FormName![ControlName]), _

   [FieldName],[Forms]![FormName]![ControlName])

   This criterion returns all the records that match the criterion. If

   no criterion is specified in the query form, all records that are NOT

   null are returned (the same results as the example above).

REFERENCES

==========

For more information on complex criteria optimization and returning nulls

from parameter queries, query on the following words here in the Microsoft

Knowledge Base:

   parameter query and like criteria

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryParm


INF: How to Use the Quit Macro Action

Article ID: Q100149

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use the Quit macro action to quit

Microsoft Access over a dynamic data exchange (DDE) channel.

MORE INFORMATION

================

The syntax for the Quit action is:

   Quit

There are no parameters for the Quit action.

The following sample Microsoft Excel macro demonstrates the Quit macro

action.

NOTE: This macro will not work with Microsoft Access version 1.0.

1. Open a new macro sheet in Microsoft Excel and enter the following

   macro:

      Cell     Command

      ------------------------------------------------

      A1       QuitDDEExample

      A2

      A3       =APP.MINIMIZE()

      A4       =ERROR(FALSE)

      A5       =APP.ACTIVATE("Microsoft Access",FALSE)

      A6       chan=INITIATE("MSACCESS","system")

      A7       =APP.ACTIVATE("Microsoft Access",FALSE)

      A8       =EXECUTE(chan,"[QUIT]")

      A9       =TERMINATE(chan)

      A10      =APP.ACTIVATE(FALSE)

      A11      =RETURN()

2. Before running this macro, size your Microsoft Access and Microsoft

   Excel windows so that you can view both applications at the same

   time.

3. To run the macro, select cell A3. From the Macro menu, choose Run

   and then choose OK.

REFERENCES

==========

For more information on using macro actions in DDE, query on the

following words here in the Microsoft Knowledge Base:

   access and 1.1 and dde and macro and action

Additional reference words: 1.00 1.10 2.00 OLE/DDE server

KBCategory:

KBSubcategory: IntpOthr


INF: How to Use the Status Bar Progress Meter

Article ID: Q103404

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The SysCmd() function in Microsoft Access can be used to create a

progress meter in the status bar to give a visual representation of

the progress of an operation. When you perform an operation with a

known duration or number of steps, you can use the SysCmd() function to

visually represent the operation's progress.

The following information documents the use of the SysCmd() function

in Microsoft Access to display a progress meter.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

The syntax of the SysCmd() is as follows:

   SysCmd(<action> [, <text>][, <value>])

Where

    - <action> is a numeric expression identifying the type of action

      to take. The expression is one of the following:

         1 - Initialize the progress meter.

         2 - Update the progress meter with the specified value.

         3 - Remove the progress meter.

    - <text> is a string expression identifying the text that will

      appear left-aligned in the status bar to the left of the

      progress meter.

    - <value> is a numeric expression that controls the display of the

      meter. This is required when the action is 1 or 2.

      When the action is 1, the value indicates the maximum number the

      meter should display, with the maximum value for the meter

      indicating 100 percent.

      When the action is 2, the value is used to calculate and update

      the percentage complete in the progress meter.

NOTE: The SysCmd() function returns NULL, which is not used.

Initializing the Progress Meter

-------------------------------

When the <action> argument is 1, the <value> argument is the maximum

value of the meter, or 100 percent. To display a progress meter with a

maximum value of 1000 initialized, type the following in the Immediate

window:

   ? SysCmd(1, "This is my meter!", 1000)

Updating the Progress Meter

---------------------------

When the <action> argument is 2, the <value> argument is used by

SysCmd() to calculate the percentage displayed by the meter. To update

the progress meter to 25 percent complete, type the following in the

Immediate window:

   ? SysCmd(2, 250)

Removing the Progress Meter

---------------------------

When the <action> argument is 3, the progress meter is removed from

the status bar. To remove the meter, type the following in the

Immediate window:

   ? SysCmd(3)

Using SysCmd() in an Access Basic Function

------------------------------------------

The following sample function will open the Customers table in the

sample database NWIND.MDB. The function will display a list of the

contact names in the table. As the names are displayed, a meter will

progress in the status bar indicating the relative progress of the

function.

1. Open the sample database NWIND.MDB.

2. Create a new module called "Meter Test."

3. Place the following statement in the declarations section:

      Option Explicit

4. Create a new function called "Meter ()" as follows:

   Function Meter ()

      Dim MyDB As Database, MyTable As Table

      Dim Count As Long

      Dim Progress_Amount As Integer, RetVal As Variant

      Set MyDB = CurrentDB()

      Set MyTable = MyDB.OpenTable("Customers")

      ' Move to last record of the table to get the total

      ' number of records.

      MyTable.MoveLast

      Count = MyTable.RecordCount

      ' Move back to first record.

      MyTable.MoveFirst

      ' Initialize the progress meter.

      RetVal = SysCmd(1, "Reading Data...", Count)

      ' Enumerate through all the records.

      For Progress_Amount = 1 To Count

         ' Update the progress meter.

         RetVal = SysCmd(2, Progress_Amount)

         ' Print the contact name in the Immediate window.

         Debug.Print MyTable![contact name]

         ' Goto the next record.

         MyTable.MoveNext

      Next Progress_Amount

      ' Remove the progress meter.

      RetVal = SysCmd(3)

      End Function

To run the function, type the following in the Immediate window:

   ? Meter()

REFERENCES

==========

Microsoft Access Distribution Kit, "The Secrets of Access Wizards,"

page 30

Additional reference words: 1.00 1.10 2.00 thermometer statusbar

KBCategory:

KBSubcategory:  PgmOthr


INF: How to Use the Windows OpenFile Dialog Box

Article ID: Q96114

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use the OpenFile dialog box from Access

Basic.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The OpenFile common dialog box can be implemented in Microsoft Access

through the use of the Windows GetOpenFileName() application

programming interface (API) function. Using this function will

simplify programming issues for the developer. This function creates a

system-defined dialog box, familiar throughout Windows, that makes it

possible for the user to select a file to open. This function will

return a valid file to the programmer that is fully qualified with the

path name. The developer can customize how the system will handle

specific situations, such as specifying that the file must exist when

the user wants to save a file through the use of flags.

To use the code below, paste the function and declarations into a

module.

NOTES:

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this

   code in Access Basic.

 - You may have some Microsoft Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code.

'-------------------------------------------------------

' Global Declaration Section

'-------------------------------------------------------

Option Compare Database

Option Explicit

Type tagOPENFILENAME

     lStructSize As Long

     hwndOwner As Integer

     hInstance As Integer

     lpstrFilter As Long

     lpstrCustomFilter As Long

     nMaxCustFilter As Long

     nFilterIndex As Long

     lpstrFile As Long

     nMaxFile As Long

     lpstrFileTitle As Long

     nMaxFileTitle As Long

     lpstrInitialDir As Long

     lpstrTitle As Long

     Flags As Long

     nFileOffset As Integer

     nFileExtension As Integer

     lpstrDefExt As Long

     lCustData As Long

     lpfnHook As Long

     lpTemplateName As Long

End Type

Declare Function GetOpenFileName% Lib "COMMDLG.DLL" (_

                    OPENFILENAME As tagOPENFILENAME)

Declare Function GetSaveFileName% Lib "COMMDLG.DLL" (_

                    OPENFILENAME As tagOPENFILENAME)

Declare Function lstrcpy& Lib "Kernel" (ByVal lpDestString As Any,_

                    ByVal lpSourceString As Any)

Dim OPENFILENAME As tagOPENFILENAME

Global Const OFN_READONLY = &H1

Global Const OFN_OVERWRITEPROMPT = &H2

Global Const OFN_HIDEREADONLY = &H4

Global Const OFN_NOCHANGEDIR = &H8

Global Const OFN_SHOWHELP = &H10

Global Const OFN_ENABLEHOOK = &H20

Global Const OFN_ENABLETEMPLATE = &H40

Global Const OFN_ENABLETEMPLATEHANDLE = &H80

Global Const OFN_NOVALIDATE = &H100

Global Const OFN_ALLOWMULTISELECT = &H200

Global Const OFN_EXTENSIONDIFFERENT = &H400

Global Const OFN_PATHMUSTEXIST = &H800

Global Const OFN_FILEMUSTEXIST = &H1000

Global Const OFN_CREATEPROMPT = &H2000

Global Const OFN_SHAREAWARE = &H4000

Global Const OFN_NOREADONLYRETURN = &H8000

Global Const OFN_NOTESTFILECREATE = &H10000

Global Const OFN_SHAREFALLTHROUGH = 2

Global Const OFN_SHARENOWARN = 1

Global Const OFN_SHAREWARN = 0

'-------------------------------------------------------

' Open Common Dialog Function

'-------------------------------------------------------

Function OpenCommDlg ()

  Dim Message$, Filter$, FileName$, FileTitle$, DefExt$

  Dim Title$, szCurDir$, APIResults%

    '*Define the filter string and allocate space in the "c" string

    Filter$ = "Access(*.mdb)" & Chr$(0) & "*.MDB;*.MDA" & Chr$(0)

    Filter$ = Filter$ & "Text(*.txt)" & Chr$(0) & "*.TXT" & Chr$(0)

    Filter$ = Filter$ & "Batch(*.bat)" & Chr$(0) & "*.BAT" & Chr$(0)

    Filter$ = Filter$ & Chr$(0)

    '* Allocate string space for the returned strings.

    FileName$ = Chr$(0) & Space$(255) & Chr$(0)

    FileTitle$ = Space$(255) & Chr$(0)

    '* Give the dialog a caption title.

    Title$ = "My File Open Dialog" & Chr$(0)

    '* If the user does not specify an extension, append TXT.

    DefExt$ = "TXT" & Chr$(0)

    '* Set up the defualt directory

    szCurDir$ = CurDir$ & Chr$(0)

    '* Set up the data structure before you call the GetOpenFileName

    OPENFILENAME.lStructSize = Len(OPENFILENAME)

    'If the OpenFile Dialog box is linked to a form use this line.

    'It will pass the forms window handle.

    OPENFILENAME.hwndOwner = Screen.ActiveForm.hWnd

    'If the OpenFile Dialog box is not linked to any form use this line.

    'It will pass a null pointer.

    OPENFILENAME.hwndOwner = 0&

    OPENFILENAME.lpstrFilter = lstrcpy(Filter$, Filter$)

    OPENFILENAME.nFilterIndex = 1

    OPENFILENAME.lpstrFile = lstrcpy(FileName$, FileName$)

    OPENFILENAME.nMaxFile = Len(FileName$)

    OPENFILENAME.lpstrFileTitle = lstrcpy(FileTitle$, FileTitle$)

    OPENFILENAME.nMaxFileTitle = Len(FileTitle$)

    OPENFILENAME.lpstrTitle = lstrcpy(Title$, Title$)

    OPENFILENAME.Flags = OFN_FILEMUSTEXIST Or OFN_READONLY

    OPENFILENAME.lpstrDefExt = lstrcpy(DefExt$, DefExt$)

    OPENFILENAME.hInstance = 0

    OPENFILENAME.lpstrCustomFilter = 0

    OPENFILENAME.nMaxCustFilter = 0

    OPENFILENAME.lpstrInitialDir = lstrcpy(szCurDir$, szCurDir$)

    OPENFILENAME.nFileOffset = 0

    OPENFILENAME.nFileExtension = 0

    OPENFILENAME.lCustData = 0

    OPENFILENAME.lpfnHook = 0

    OPENFILENAME.lpTemplateName = 0

    '* This will pass the desired data structure to the Windows API,

    '* which will in turn it uses to display the Open Dialog form.

    APIResults% = GetOpenFileName(OPENFILENAME)

    If APIResults% <> 0 Then

        '* Note that FileName$ will have an embedded Chr$(0) at the

        '* end. You may wish to strip this character from the string.

      FileName$ = Left$(FileName$, InStr(FileName$, Chr$(0)) -1)

        Message$ = "The file you chose was " + FileName$

    Else

        Message$ = "No file was selected"

    End If

    MsgBox Message$

End Function

REFERENCES

==========

"Microsoft Windows Software Development Kit Programmer's Reference,

Volume 2: Functions," version 3.1

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: How to Use TimeValue() to Calculate Difference in Times

Article ID: Q100141

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use the TimeValue() function to find the

difference between two values that have Date/Time data types and that

occur within a 24-hour period.

MORE INFORMATION

================

To set up an example that uses the TimeValue() function, create a form

with the following text boxes:

   Object: Text Box

   ----------------

   ControlName: Start_Time

   Object: Text Box

   ----------------

   ControlName: End_Time

To calculate the difference between the times in these two fields,

create a third text box with the following properties:

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code.

   Object: Text Box

   ----------------

   ControlName: Time_Difference

   ControlSource: =Format(TimeValue([End_Time])_

                   -TimeValue([Start_Time]),"Short Time")

Note that in the example above, the Format() function is used to

format the time difference. Short Time displays the difference in

hours and minutes.

REFERENCES

==========

For more information on formatting values, search for "format" then

"format, format$" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: How to Wait for a Shelled Process to Finish

Article ID: Q99940

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are using the Shell() function or the RunApp macro action to

run another program or process, Microsoft Access does not wait for the

shelled process to finish before processing the next line in the macro

or function. This causes problems for macros and functions whose

subsequent actions depend on the results of the shelled process.

This article includes a function called WaitShell(), which, given an

application name or process to run, starts the process and waits for

it to terminate.

MORE INFORMATION

================

The following Microsoft Access function, WaitShell(), uses

GetModuleUsage, a Microsoft Windows API function, to determine if the

shelled process has terminated. The Shell() function, if it

successfully starts the process, returns a handle to the process

module. If the process is no longer running, the handle is invalid and

GetModuleUsage returns a value of 0. WaitShell() simply loops until

the module is no longer valid.

NOTE: You may have the following GetModuleUsage Windows API function

defined in an existing Microsoft Access library. If you receive a

duplicate procedure name error message, delete the Declare statement

from your code.

   Option Explicit

   Declare Function GetModuleUsage% Lib "Kernel" (ByVal hModule%)

   Function WaitShell (AppName$)

      Dim hMod%

       hMod% = Shell(AppName$, 1)

       If (hMod% > 32) Then

          While (GetModuleUsage(hMod%))

             DoEvents

          Wend

       Else

          MsgBox "Unable to start " & AppName$

       End If

   End Function

To test this function, create and run the following Microsoft Access

macro

   Action

   ------

   RunCode

   MsgBox

   Macro Actions

   -------------

   RunCode

      Function Name: =WaitShell("Command.com")

   MsgBox

      Message:       Done!

 -or-

run the following Microsoft Access function:

   Function TestWaitShell()

      x=WaitShell("Command.com")

      MsgBox "Done!"

   End Function

Both examples above launch instances of the DOS prompt, which remain

until you terminate them by typing "exit" at the command line and

pressing ENTER.

REFERENCES

==========

Microsoft Windows "Programmer's Reference, Volume 2: Functions,"

version 3.1, pages 403-404

Additional reference words: 1.00 1.10 2.00 terminate basic shell

KBCategory:

KBSubcategory: PgmOthr


INF: Implementing Counter Values on Attached SQL Server Tables

Article ID: Q100166

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you create a table in Microsoft Access and port it to SQL Server,

some tasks are difficult to implement because SQL Server does not

include a Counter data type. This article discusses how to maintain

the counter functionality of an attached SQL Server table.

MORE INFORMATION

================

With a multiuser system, you must take special precautions. Assume

that the Counter column in SQL Server is called ID and that ID is the

unique index for this table. In most cases, users try to simulate

counters with a SQL Server OnInsert trigger that computes the maximum

value and adds 1. However, Microsoft Access uses that index (bookmark)

to point to the record and is not aware that the trigger is changing

the index value. Thus, Microsoft Access loses track of that record

until the next time the table is queried.

Since SQL Server triggers do not work and SQL Server does not have a

unique Counter data type as does Microsoft Access, you must use an

Access Basic function to control the counter value, as in the

procedure below:

1. In a single-column, single-row Microsoft Access table, store a

   value that represents the next highest counter value.

   NOTE: You must store the table in Microsoft Access, since the

   OpenTable action does not work on an attached SQL Server table and,

   therefore, cannot open the table exclusively. For more information

   on the OpenTable action, refer to the Microsoft Access "Language

   Reference" manual.

2. In the data entry form, apply a function to the BeforeUpdate event

   so that the function completes the following tasks:

    - Open the table that contains the counter value

    - Grab the value for the current record

    - Add 1 to the value in the table

    - Close the table

   Each user must have exclusive access to the table to ensure that no

   duplicate values are recorded. You must do error checking when

   trying to open the table exclusively because another user may have

   the table open at the same time. If this occurs, the program loops

   and retries several times before alerting the first user.

3. Once the value has been retrieved, set the ID of the current record

   equal to that value and commit the record to the SQL Server

   database.

REFERENCES

==========

For more information about, and an example of, creating a unique custom

counter, query on the following words here in the Microsoft Knowledge Base:

   table and counter and custom and unique

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: Import/Export Accepts Only 24-Hour Time Format

Article ID: Q89618

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When importing or exporting time values, Microsoft Access works only

with 24-hour time values.

MORE INFORMATION

================

If you try to import a time value such as 1:00 P.M. into an existing

time column, the record will not be loaded and you will get an Import

Errors table that has a "Type Conversion Failure" on the value. To

import a time value such as 1:00 P.M., the value must be in the

24-hour format (in this case, 13:00).

To work around this behavior, import your time values into an existing

text column and use Microsoft Access Basic code to manipulate the

values into the correct data type format.

If you try to export a value such as 1:00 P.M. to an ASCII text file,

the value will be exported in the 24-hour format (13:00).

Additional reference words: 1.00 1.10 2.00 military clock

KBCategory:

KBSubcategory: IntpOthr


INF: Imported Microsoft Excel Date Fields Are Off by 4 Years

Article ID: Q103996

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Excel versions 2.0, 3.0, 4.0, and 5.0

---------------------------------------------------------------------

SUMMARY

=======

If date fields imported from a Microsoft Excel spreadsheet are off by four

years, the 1904 date system was used on the original spreadsheet. This

setting can be verified in Microsoft Excel by choosing Calculation from the

Options menu. In the Sheet Options group, there is a check box labeled

"1904 Date System." If the box is selected, the spreadsheet is based on the

1904 date system. If the box is not selected, the spreadsheet is based on

the 1900 date system.

MORE INFORMATION

================

The date systems used by Microsoft Excel can be based on one of two

different dates. By default, Microsoft Excel for Windows starts its

dates at January 1, 1900. A serial number of 1 in Microsoft Excel

represents January 1,1900. Microsoft Excel can also be set to start on

January 1, 1904. This option was included in Microsoft Excel for

Windows to make it compatible with Excel for the Macintosh, which

starts on January 1, 1904. The starting serial numbers are also

different. A serial number of zero (0) in Excel for the Macintosh

represents January 1, 1904.

If the spreadsheet you want to import into Microsoft Access was based

on the 1904 date system, complete the following steps before importing

the spreadsheet into Microsoft Access:

1. Open the spreadsheet in Microsoft Excel.

2. From the Options menu (or from the Tools menu in version 5.0), choose

   Calculation.

3. In the Sheet Options group, clear the box labeled "1904 Date

   System."

4. Save and close the spreadsheet.

The spreadsheet is now ready to be imported into Microsoft Access.

If you do not have Microsoft Excel available to switch the date system

before importing the spreadsheet, you can use the following steps to

perform an Update Query to correct the dates after the spreadsheet has

been imported into Microsoft Access:

1. Create a new query based on the table that was created when you

   imported the spreadsheet.

2. Drag the DateField name to the Field row in the query grid. For this

   example, the date field's name is "DateField."

3. From the Query menu, choose Update.

4. In the Update To field, enter the following:

      [DateField] + 1462

5. From the Query menu, choose Run.

A message box appears and tells you how many records were updated.

Your dates should now appear correctly.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmExl5


INF: Importing an Entire Sheet from a MS Excel 5.0 Workbook

Article ID: Q115190

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Excel for Windows, version 5.x

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use Access Basic code to import an entire

worksheet from a Microsoft Excel version 5.0 workbook without specifying a

range.

MORE INFORMATION

================

To import an entire worksheet, refer to the worksheet without a named

range, but include an exclamation point (!). For example, the following

sample code will import Sheet5 from a workbook named T.XLS.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Function ImportXL5 ()

      DoCmd TransferSpreadsheet _

         A_IMPORT,5,"TestTable","T.XLS",True,"Sheet5!"

   End Function

If you do not specify a value for the last argument, Microsoft Access will

import the first worksheet that it finds in the workbook. If you specify a

range, that range will be imported from the first worksheet in the

workbook. To specify a range from a specific worksheet, use the syntax in

the following example:

   Sheet5!R2C1:R15:C5

Additional reference words: 2.00

KBCategory:

KBSubcategory: IsmExl5


INF: Importing DataEase Data Files

Article ID: Q94194

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not import DataEase data files directly, but you

can export your DataEase data to a formatted disk file that Microsoft

Access can import. The information is this article applies to DataEase

versions 4.2, 4.5, and 4.53. DataEase is a character-based relational

database system.

To export DataEase data from DataEase, create a DQL report, specify the

Format as export, and set the Print Style to print to a disk file. Select

one of the following export formats to create a file Microsoft Access can

import:

   Lotus           (creates a .WKS file)

   Variable Length (creates a delimited ASCII text file)

   Fixed Length    (creates a fixed-width ASCII text file)

MORE INFORMATION

================

Export Using DataEase

---------------------

To create a formatted disk file in DataEase 4.x, create a DQL report using

the following steps. For more detailed information about creating reports,

please refer to the DataEase documentation.

1. Define the report specifying the fields you want to include in the

   output.

2. Specify the report Format as Export by choosing either Define Format or

   Modify Format under either DQL Advanced Processing or Query by Example -

   Quick Reports.

   Select 7. Export under Define Format or Modify Format. You should see

   the following list of the export formats DataEase supports.

      * 1. Lotus (wks)

        2. GrafTalk

        3. MultiMate

        4. WordPerfect

        5. Mail-Merge

      * 6. Variable Length

      * 7. Fixed Length

        8. DIF

   Choose 1, 2, or 6. Depending on your choice, DataEase may ask you if you

   want to include field names in the exported file.

3. Specify the Print Style for the report. Enter the Report Destination as

   option #3 Disk to print to a disk file. Then enter a valid file name in

   the Filename field.

Import Using Microsoft Access

-----------------------------

1. Start Microsoft Access and open your database.

2. From the File menu, choose Import.

3. In the Data Source box, select the import format that matches the export

   format you chose in DataEase.

Choosing Export/Import Format

-----------------------------

Here are some things to consider when choosing an export/import format.

Microsoft Access can import Lotus (.WKS) files and create a table with

field names if you included the field names when exporting in DataEase.

During the import process, Microsoft Access asks you if the first row

contains field names. Most DataEase data types should convert to

appropriate Microsoft Access field types.

If you choose the Variable Length format when exporting, DataEase will ask

you to enter the field separator. Enter a comma (,). Microsoft Access

recognizes the comma as the default field separator.

If you choose the Fixed Length format when exporting in DataEase, you will

need to create an Import Specification file in Microsoft Access prior to

importing the file.

For additional information registered DataEase users can contact DataEase

International HotLine Support at 1-203-374-2825.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 4, "Importing,

Exporting, and Attaching," pages 72-81

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: IntpOthr


INF: Importing Word Print Merge Data Files to Microsoft Access

Article ID: Q96899

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a,

   2.0a-CD, 2.0b, 2.0c

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to import data from a Word for Windows

print merge data file for use in Microsoft Access.

MORE INFORMATION

================

In order to use data from a Word for Windows print merge data file in

Microsoft Access, the file must be saved as a comma- or tab-delimited

unformatted text file.

Word for Windows can perform print merges on data contained in files

that are comma- or tab-delimited, or on data formatted from a table. If

the data is already comma- or tab-delimited, you must take care to

ensure the file is saved as an unformatted text file.

If the data is in table form, the table must first be converted to a

tab-delimited format before saving it as a text file.

NOTE: In Word for Windows, you can create multiple-line information within

a table cell that contains carriage returns (paragraph marks). The carriage

returns must be removed before converting the table to a tab-delimited

format.

Converting Data from a Table to a Tab-Delimited Format

------------------------------------------------------

Word for Windows 1.x:

1. Open the data document in Word for Windows.

2. Position the insertion point anywhere inside the table.

3. Press ALT+Keypad 5 to select the entire table (make sure that NUM

   LOCK is turned off).

4. From the Insert menu, choose Table To Text.

5. In the Convert Table To box, select Tab Delimited, then choose OK.

Word for Windows 2.x:

1. Open the data document in Word for Windows.

2. Position the insertion point anywhere inside the table.

3. From the Table menu, choose Select (or press ALT+Keypad 5).

4. From the Table menu, choose Convert Table To Text.

5. Choose the Tabs button from the Separate Text With group

   and choose OK.

Saving the Data File as an Unformatted Text-Only File

-----------------------------------------------------

Word for Windows 1.x:

1. From the File menu, choose Save As, and enter an unique filename in

   the Save File Name box.

2. Choose the Options button.

3. From the File Format box, select Text Only, and choose OK.

Word for Windows 2.x:

1. From the File menu, choose Save As, and type a unique filename in

   the File Name box.

2. In the Save File As Type box in the lower left corner, select Text

   Only, and choose OK.

Removing Unwanted Carriage Returns from a Table-Formatted Data File

-------------------------------------------------------------------

Word for Windows 1.x:

1. In the Search For box type "^p" (the caret symbol (^) is generated by

   pressing SHIFT+6).

2. In the Replace With box press SPACEBAR once.

3. Clear the Confirm Changes check box and choose the OK button.

Word for Windows 2.x:

1. From the Edit menu, choose Replace.

2. In the Find What box, type "^p" (the caret symbol (^) is generated by

   pressing SHIFT+6).

3. In the Replace With box, press SPACEBAR once.

4. Choose the Replace All button.

Importing the Text Data File into Microsoft Access

--------------------------------------------------

1. From the File menu, choose Import.

2. Select Text (Delimited) from the Data Source list and choose OK.

3. Select the Word for Windows text file to import from the file list

   and choose the Import button.

4. Select First Row Contains Field Names if the first row in the

   Word data file contains a list of field names.

5. Choose the Options button.

6. Choose {tab} in the Field Separator box.

7. Choose the OK button to begin the import.

Additional reference words: 1.00 1.10 2.00 winword

KBCategory:

KBSubcategory: IntpPrtm


INF: Importing, Exporting, and Attaching FoxPro 2.0, 2.5 Data

Article ID: Q100177

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access versions 1.1 and 2.0, you can import from, export to,

and attach data in FoxPro versions 2.0 and 2.5.

MORE INFORMATION

================

If you select either Import or Attach Table from the File menu, you

can choose FoxPro 2.0 or FoxPro 2.5 from the Data Source list box.

When you attach a FoxPro file, you can also associate the appropriate

FoxPro index (.IDX or .CDX file). The procedure to import, export, and

attach files is the same for FoxPro files as it is for dBASE and Paradox

files.

dBASE and Paradox are manufactured by Borland International, Inc., a

vendor independent of Microsoft; we make no warranty, implied or otherwise,

regarding these products' performance or reliability.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, chapter 4, "Importing,

Exporting, and Attaching," pages 60-65

Additional reference words: 1.10 2.00 Import/Export fox idx cdx

KBCategory:

KBSubcategory: IsmXbase


INF: Incrementing the Numeric Portion of a String

Article ID: Q88169

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a formula that you can use to set the default value

of a bound text field in a form to the next higher numeric value (default

value = default value + 1).

The sample formula in this article follows these steps:

1. Find the highest numeric value used in a table.

2. Strip any leading text characters.

3. Add 1 to the value found in step 1.

4. Reconnect the leading text characters.

NOTE: This example assumes that the number of leading text characters

is known at the time the form is designed.

MORE INFORMATION

================

Use the following sample procedure to increase the default value of a

bound text field on a form:

 1. Open an existing database, or create a new database.

 2. Create a new table.

 3. Add a field called Book ID with a Text data type. From the Edit

    menu, choose Set Primary Key.

 4. Add a second field of any data type to the table.

 5. Save the table as Increment.

 6. Switch to Datasheet view and enter the following values:

       Book ID       Second Field

       --------------------------

       BO-110

       BO-111

       BO-112

 7. Close the table.

 8. Create a new form based on the Increment table.

 9. From the View menu, choose Field List.

10. Drag the Book ID field and the second field from the field list

    to the form.

11. Change the form's DefaultView property to Single Form.

12. Set the DefaultValue property of the Book ID text box to the

    following:

    NOTE: In the following sample code, an underscore (_) is used as a

    line-continuation character. Remove the underscore when re-creating

    this code in Access Basic.

       ="BO-" & Right(DMax("[Book ID]","Increment"),Len(DMax_

          ("[Book ID]","Increment"))-3)+1

13. Switch to Form view and enter a new record.

The components of the formula for the DefaultView property are:

 - DMax("[Book ID]","Increment") locates the highest value in the table.

 - Len(DMax(...)) finds the length of the value returned by the DMax()

   function.

 - Right(DMax(...),Len(...)-3) strips the three leading text characters.

 - +1 increments the result of the Right() function.

 - "BO-" concatenates the text "BO-" on to the incremented number.

Note that this example works correctly when the form's DefaultView property

is Single View; it may not work correctly in Continuous View. When you move

to a new record and begin to enter data, Microsoft Access displays the next

empty record. The default values for this record are calculated before the

record you are currently editing is committed. Because the DMax() function

calculates the maximum value from those records stored in the table, the

Book ID of the record you are currently editing is repeated.

If you are working in a multiuser environment, it is possible that

more than one user may receive the same calculated Book ID value.

Although you can manually change the Book ID, you can also maintain

the highest numeric value in a separate table, using a macro or Access

Basic code.

REFERENCES

==========

For more information on multiuser counters, query on the following words

here in the Microsoft Knowledge Base:

   multiuser and counter

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: TblPriky


INF: Introduction to Windows Programming for MS-DOS Programmer

Article ID: Q88164

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses some differences between programming in the

MS-DOS environment and programming in the event-driven Windows

environment.

MORE INFORMATION

================

For the purposes of this discussion, consider the use of the term

"traditional programmer" as someone who has not programmed in Windows,

but has experience programming in an MS-DOS environment.

As a traditional programmer, you may not only have become comfortable

with a particular programming style, but also with certain accepted

fundamentals, such as writing an instruction and expecting it to be

carried out in a controlled order. Access Basic makes good use of

Windows, making it easy to learn to program.

"One Entry, One Exit" vs. Event-Driven Programming

--------------------------------------------------

Consider the following pseudocode of a program designed to get user

input, count all the records in a table, and display the result in a

box if the user presses 1, or exit if the user presses 2.

   START PROGRAM

   LOOP WHILE TRUE

      GET KEYPRESS INTO X

      IF X IS "1"

         COUNT ALL RECORDS IN THE TABLE INTO Y

         DRAW BOX FROM ROW 10 COLUMN 5 TO ROW 12 COLUMN 7

         DISPLAY Y AT ROW 11 COLUMN 6

      IF X IS "2"

         EXIT LOOP

   END LOOP

   STOP PROGRAM

The purpose of this program is to continuously loop until a key

press of a 1 or 2 is detected. At that point, a decision is made to

perform some sort of operation, or to ignore the keypress and continue

looping. The programmer has full control over what happens.

The Windows programming model is event-driven and graphic object

oriented. In other words, programming in Windows involves creating

objects and modifying aspects (or properties) of those objects based

on different events. Consider the following sample program that

presents two buttons to the user. If the user chooses the Count

button, the program counts the records in the database and displays

the result in a window. The user can press the Exit button to exit

from the program.

First, you create the necessary objects. Most of this phase of Access

Basic programming is created graphically with the Access Forms

designer. The list of controls and properties below defines a form

that will be used to illustrate this.

   Form: MasterForm

   ----------------------------

   Push Button: CountButton

       Caption: Count

        OnPush: =DisplayCount()

   Push Button: ExitButton

       Caption: Exit

        OnPush: =CloseProgram()

   Text Box: DisplayWindow

NOTE: OnPush is a property of Microsoft Access version 1.x command buttons

that gives you the ability to invoke an Access Basic procedure or macro. In

Microsoft Access 2.0, the property is called OnClick.

You can then create the modules that the objects will invoke. In this

case, buttons are the only objects that will have the ability to

invoke procedures. The procedures shown below are pseudo-code

examples.  The first procedure defined is the DisplayCount procedure:

   PROCEDURE DisplayCount()

      COUNT ALL THE RECORDS IN THE TABLE INTO Y

      CHANGE THE DISPLAYWINDOW TEXT PROPERTY TO Y

   END PROCEDURE

Notice that the code did not direct the resulting count to display in

a box painted on the screen. Instead, the Text property of

DisplayWindow was changed to the resulting count value. The next

procedure defined is the CloseProgram procedure.

   PROCEDURE CloseProgram

      CLOSE MASTERFORM

   END PROCEDURE

Notice that this procedure does not provide an exit from some kind of

loop or other program structure. Instead, it closes the object that

contains the buttons and window.

At this point, you have a master form object containing two buttons, a

window, and a couple of coded procedures. They are in no special

order, they simply exist as part of the form. So, where is the loop

that checks for button activity? Where is the command to invoke the

program?

The answer is that these do not exist as you might expect them to.

You "run" the program by opening MasterForm. When you open the form,

all the control objects (that is, the buttons and so on) exist on

the form waiting for something to happen. In this example, there is no

flow of control (no looping to check activity).

While the form is active, Windows constantly checks for events. When

an event occurs, the user's input is put in a queue and "waits in

line" until it is processed. For example, when you push the "Count"

button, Windows detects that the button object you placed on the form

has been affected.  Windows sends a "Mouse Click" message to Access.

Access then translates the message and determines that the

DisplayCount() function should be called based on the "On Push" field

of the command button.

Advantages

----------

The traditional programmer will find this new approach to programming

a bit challenging. There are a few things to learn and "unlearn," but

there are many advantages.

Windows Interface

-----------------

The Windows interface is one that has been regarded throughout the

industry as being very user-friendly. Familiar objects such as push

buttons, radio buttons, list boxes, and a wide variety of colors and

screen fonts are generally more appealing than standard ASCII text

characters.

The Windows Standard

--------------------

Because Access Basic forces you to some extent into the Windows

standard, others who are familiar with Windows applications can

immediately recognize the "look and feel" of your application. This

reduces the learning time because the user does not have to learn

entirely new interface controls and prompts.

Advantages Offered by the Windows Environment

---------------------------------------------

You do not have to worry too much about different devices such as

monitors, printer drivers, and so on. The Windows operating

environment takes care of most device compatibility and user

preference issues. In addition, because Windows handles and processes

events, you will find it much easier to create and manage many aspects

of an application.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Join Type Mismatch Errors Caught at Runtime

Article ID: Q96581

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access will not detect a type mismatch error for joins created

in a query until the query is actually run. This is illustrated in the

following example.

MORE INFORMATION

================

Follow these steps in the sample database NWIND.MDB:

1. Create a new query.

2. Add the Orders and Products tables from the Add Table dialog

   box.

3. Create a join between the Employee ID field in Orders and

   the Product Name field in Products.

4. Bring all fields from both tables into the Field row of the QBE

   grid.

5. From the Query menu, choose Run.

The query will start to process, then return the following error message:

   ! TYPE MISMATCH

Choose OK to clear the box (choosing the Help button will give you

information on the possible causes of this error).

It may not be obvious that the join is at fault because of the timing

of the error message (especially when querying large amounts of data

over a network).

This issue is one reason it is advantageous to create relationships

between tables before creating queries.

Additional reference words: 1.00 1.10 2.00 error code 13 errmsg

KBCategory:

KBSubcategory: QryJoin


INF: Like vs. = with Wildcard Characters in Query Searches

Article ID: Q88166

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are searching a string using wildcards (for example, * or ?), you

must use Like or Not Like in the Criteria field, rather than using = or <>.

When you use the = or <> operators, Microsoft Access treats them as actual

characters to search for.

MORE INFORMATION

================

If you have a table with one column called Col_Name and the following

four records

   Foos

   Foosball

   Foos ball

   Foos*

and you make a query based on the table with the criteria

   ="Foos*"

your query will return:

   Foos*

But, if your criteria is

   Like "Foos*"

your query will return the following four records:

    Foos

    Foosball

    Foos ball

    Foos*

The SQL statements built by Microsoft Access for these queries are as

follows:

The SQL statement using Like is:

   SELECT  DISTINCTROW tablename.Col_Name

   FROM [tablename]

   WHERE ((tablename.Col_Name Like "foos*"));

The SQL statement using = is:

   SELECT  DISTINCTROW tablename.Col_Name

   FROM [tablename]

   WHERE ((tablename.Col_Name="foos*"));

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryOthr


INF: Limitations on Setting Report Properties at Run Time

Article ID: Q114510

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 supports using macros or code to set certain

properties at run time for reports.

MORE INFORMATION

================

To prevent possible problems during formatting and printing, the following

limitations have been imposed for setting properties at run time for

reports:

 - The following properties can only be set from the OnOpen property (not

   from OnFormat, OnPrint, or OnRetreat):

    - "Datasource" properties: RecordSource, ControlSource,

      LinkChildFields, and LinkMasterFields.

    - Any action in any property that would cause the report width to grow.

      This includes moving a control past the current report width. This is

      restricted because you could inadvertently increment the number of

      pages in the middle of a print job.

 - The following properties cannot be set at run time at all:

    - The SourceObject property for subforms and subreports.

    - "Event" properties: OnOpen, OnFormat, OnPrint, and so on.

    - RunningSum

    - HideDuplicates

    - CanGrow and Canshrink

    - KeepTogether

    - ForceNewPage

    - RowSource for Graph objects

All other properties can be set at run time (in a report's OnOpen,

OnFormat, or OnPrint property, for example).

NOTE: All the restrictions in this article also apply to form printing.

REFERENCES

==========

For more information about designing reports, search for "setting

properties" then "Setting Properties Using Code, or search for "report

properties" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: RptProp


INF: LimitToList Property Set to Yes Needs a Unique Entry

Article ID: Q96901

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

If you set the LimitToList property of a combo box to Yes, and type a

portion of an entry into the combo box and press ENTER, you may

receive the following error message:

   The text you enter must match an entry in the list.

The error occurs because there are duplicates in the list. For

example, if you enter the value "co" in the combo box and the values

"conf" and "cond" exist in the drop-down list, the error occurs.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, chapter 9, "Designing

Forms", pages 244-245

Additional reference words: 1.00 1.10 2.00 combo box errmsg checkpage

KBCategory:

KBSubcategory: FmsCmbo


INF: Links to Formatted DDE Items Result in Text

Article ID: Q90108

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Dynamic data exchange (DDE) links to numeric items that have been formatted

will result in text. To perform calculations on the results of these links,

you must convert the results to a numeric data type, as described below.

MORE INFORMATION

================

The following example demonstrates how to create a DDE link to a numeric

item that has been formatted:

 1. Start Microsoft Excel.

 2. In cell A1 of Sheet1, type "80" (without the quotation marks).

 3. Select cell A1, and choose Number from the Format menu.

 4. From the Format Codes list, select a currency format, such as

    $#,##0_);($#,##0), and then choose the OK button.

 5. Select cell A1, and choose Copy from the Edit menu.

 6. Start Microsoft Access and open any database.

 7. Create a new, unbound form.

 8. From the Edit menu, choose Paste Special, then select Text from

    the Data Type list.

 9. Choose Paste Link. A text box with the following formula will be

    created on the form:

       =DDE("Excel","Sheet1","R1C1")

10. Create a new text box on the form, and enter the formula:

       =Field0+100

11. View the form in Form view. Note that the first text box, Field0,

    displays "$80." The second text box displays "#Error."

The following steps demonstrate how to convert the DDE-linked item to a

Numeric data type:

1. View the form in Design view.

2. Change Field0 to be:

      =CCur(DDE("Excel","Sheet1","R1C1"))

3. View the form in Form view. Note that the second text box now displays

   the value 180.

REFERENCES

==========

For more information about data type conversions, search for "conversions"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


INF: List of Articles Relating to MSACCESS.INI File

Article ID: Q102673

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

The following is a list of articles found in the Microsoft Knowledge

Base that relate in some way to the MSACCESS.INI file:

   ARTICLE#             TITLE & DESCRIPTION

   --------             -------------------

   Q88175      INF: Creating, Debugging, and Using an Access Library

               (Refers to the [Libraries] section)

   Q88648      INF: Easy Way to Add Items to the Help Menu

               (Refers to the [Menu Add-Ins] section)

   Q90105      INF: Could not Find SYSTEM.MDA or UTILITY.MDA File

               (Refers to the [Options] section)

   Q98224      PRB: ErrMsg: Couldn't Open Table MSysAccounts

               (Refers to the [Options] section)

   Q96996      INF: How to Change the Font for the Zoom Box

               (Refers to the [Options] section)

   Q90170      INF: How to Make Access Opening Screen Display

               (Refers to the [Microsoft Access] section, Tutorial

               setting only)

   Q95051      PRB: Unable to Connect to Attached SQL Server Table,

               Error Msg

               (Refers to the [SQLSERVER] section of the WIN.INI

               file)

   Q101323     INF: Five Parameters to Set in ISAM Section of

               MSACCESS.INI

               (Refers to the [ISAM] section)

   Q95388      INF: Doc Err: dBASE SET DELETED Characteristic in

               MS Access

               (Refers to the [dBASE ISAM] section, Deleted

               setting only)

   Q98805      PRB: Internal Database Error (-5207) When Attaching

               Tables

               (Refers to the [Paradox ISAM] section,

               CollatingSequence only)

   Q100176     INF: Upper Limit on QueryTimeout and LoginTimeout

               (Refers to the [ODBC] section)

   Q100972     INF: Forcing Access to Use Snapshot Method on Attached

               Data

               (Refers to the [ODBC] section)

   Q95050      PRB: Data Source Not Found, No Default Driver Specified

               Error

               (Refers to the ODBC.INI file)

   Q103173     PRACC9307: Options in Form and Report Wizards Do Not

               Display

               (Refers to the [Form Wizards], [Report Wizards] and

                [Libraries] sections)

Additional reference words: 1.00 1.10 2.00 Initialization x-ref

KBCategory:

KBSubcategory: StpOthr


INF: List of Categories and Examples from SOLUTION.MDB

Article ID: Q111782

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Solutions sample application (SOLUTION.MDB) included with Microsoft

Access version 2.0 contains many examples of common tasks that you can use

to help you design your database applications. This article lists all the

available categories and examples in the Solutions sample application.

MORE INFORMATION

================

These are the categories and examples in the Solutions sample application.

Each category is followed by all the examples for that category:

   Build a Microsoft Windows interface

   -----------------------------------------------------------

    - Change tool bars in response to events

    - Close all database objects when you exit the application

    - Create a custom menu bar for a form

    - Create a main menu form

    - Create a startup form

    - Create a tool bar that has custom buttons

    - Create an About dialog box

    - Create an informational form that users can turn off

    - Get information from a user in a dialog box

   Sample forms

   ----------------------------

    - About Solutions

    - Add All To List

    - Add Category

    - Edit Products

    - Employee Sales Dialog Box

    - Enter or Edit Products

    - Find Customers

    - Limit List Contents

    - Reattach NWIND

    - Sales Totals

    - Show Sales

    - Solutions

    - Solutions Intro

    - Startup

   Work with forms and controls

   ------------------------------------------------------------------

    - Capitalize one or more letters in a field automatically

    - Change the color of a control based on the value in the control

    - Change the color of a section and control at run time

    - Clear the values in unbound text boxes and a subform

    - Control when you go to a new record

    - Create a form in which you can edit but not enter records

    - Create a form in which you can enter or edit data

    - Create a main menu form

    - Create a startup form

    - Create an About dialog box

    - Create an informational form that users can turn off

    - Get information from a user in a dialog box

    - Remove the minimize and maximize buttons from a form

    - Update a list to show current data

   Get more mileage from combo boxes, list boxes, subforms and subreports

   ----------------------------------------------------------------------

    - Add "(all)" to a list

    - Add a new record to a list

    - Find a record based on a value you select from a list

    - Limit the contents of a list based on the value selected from an

      option group

    - Limit the contents of a list based on the value selected in

      another

    - Show totals in a subreport

    - Update a list after you change its contents

    - Use a custom function in a subform's SELECT statement

    - Use criteria from the main form to set the subform's RecordSource

      property

    - Use two subforms on a form

   Query by form

   --------------------------------------------------------------------

    - Find a record based on a value you select from a list

    - Find records based on values in one or more fields

    - Show progressively more detail about a subject

    - Use a custom function in a subform's SELECT statement

    - Use criteria from the main form to set the subform's RecordSource

      property

    - Use part of a value to specify criteria

    - Use two subforms on a form

   Using queries with forms and reports

   --------------------------------------------------------------------

    - Create a crosstab query for a report

    - Create a SELECT statement for a form based on user input

    - Limit the contents of a list based on the value selected from an

      option group

    - Limit the contents of a list based on the value selected in

      another

    - Use a custom function in a subform's SELECT statement

    - Use a parameterized query in an event procedure

    - Use a totals query as the record source for a subform

    - Use criteria from the main form to set the subform's RecordSource

      property

   Sample reports

   ----------------------

    - Customer Phone List

    - Employee Sales

    - Invoice

    - Sales Averages

    - Sales Letter

    - Shipping Log

   Create advanced reports

   --------------------------------------------------------

    - Create a crosstab report with dynamic column headings

    - Create a form letter

    - Create a multiple-column report

    - Create a multiple-fact crosstab report

    - Create a report for a preprinted form

   Control what you print on reports

   ----------------------------------------------------------------

    - Draw a circle around data to accentuate it

    - Hide a section when it falls at the top of a page

    - Hide and show controls based on the value in another control

    - Hide and show sections that print on a preprinted form

    - Print "Continued" at the bottom of a preprinted form

    - Print report criteria that was entered in a dialog box

    - Print the first and last entries on a page in the page header

      Repeat a group name at the top of a column or page

   Calculate totals on reports

   -------------------------------------------------------

    - Calculate row and column totals on a crosstab report

    - Show totals in a subreport

   Use multiple databases

   ---------------------------

    - Attach tables at startup

Additional reference words: 2.00 Designing

KBCategory:

KBSubcategory: GnlApp


INF: List of Constants in Macros and Modules

Article ID: Q112140

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists the contant variables that are in the UTILITY.MDA file.

This list is for reference only; importing these constants would result in

a duplicate definition error.

Additional constants are listed in the CONSTANT.TXT file located in your

Microsoft Access directory. This text file is provided for supplementary

use and can be imported.

MORE INFORMATION

================

AbcConstants Module from UTILITY.MDA

------------------------------------

  NOTE: All of the constants listed below are global constants.

V_EMPTY = 0                V_NULL = 1                 V_INTEGER = 2

V_LONG = 3                 V_SINGLE = 4               V_DOUBLE = 5

V_CURRENCY = 6             V_DATE = 7                 V_STRING = 8

DB_BINARY = 9              DB_OLE = 11                DB_NONULLS = 3

A_TABLE = 0                A_QUERY = 1                A_FORM = 2

A_REPORT = 3               A_MACRO = 4                A_MODULE = 5

A_FORMBAR = 0              A_FILE = 0                 A_EDITMENU = 1

A_RECORDSMENU = 3          A_NEW = 0                  A_SAVEFORM = 2

A_SAVEFORMAS = 3           A_SAVERECORD = 4           A_UNDO = 0

A_UNDOFIELD = 1            A_CUT = 2                  A_COPY = 3

A_PASTE = 4                A_DELETE = 6               A_SELECTRECORD = 7

A_SELECTALLRECORDS = 8     A_OBJECT = 14              A_REFRESH = 2

A_OBJECTVERB = 0           A_OBJECTUPDATE = 3         A_ANYWHERE = 0

A_ENTIRE = 1               A_START = 2                A_UP = 0

A_DOWN = 1                 A_CURRENT = 0              A_ALL = 1

A_PREVIOUS = 0             A_NEXT = 1                 A_FIRST = 2

A_LAST = 3                 A_GOTO = 4                 A_NEWREC = 5

A_NORMAL = 0               A_DESIGN = 1               A_PREVIEW = 2

A_FORMDS = 3               A_ADD = 0                  A_EDIT = 1

A_READONLY = 2             A_HIDDEN = 1               A_ICON = 2

A_DIALOG = 3               A_PRINTALL = 0             A_SELECTION = 1

A_PAGES = 2                A_HIGH = 0                 A_MEDIUM = 1

A_LOW = 2                  A_DRAFT = 3                A_PROMPT = 0

A_SAVE = 1                 A_EXIT = 2                 A_IMPORT = 0

A_EXPORT = 1               A_ATTACH = 2               A_IMPORTDELIM = 0

A_IMPORTFIXED = 1          A_EXPORTDELIM = 2          A_EXPORTFIXED = 3

A_EXPORTMERGE = 4          OLE_CHANGED = 0            OLE_SAVED = 1

OLE_CLOSED = 2             OLE_RENAMED = 3            OLE_RELEASE = 5

SHIFT_MASK = 1             CTRL_MASK = 2              ALT_MASK = 4

LEFT_BUTTON = 1            RIGHT_BUTTON = 2           MIDDLE_BUTTON = 4

DATA_ERRCONTINUE = 0       DATA_ERRDISPLAY = 1        DATA_ERRADDED = 2

LB_INITIALIZE = 0          LB_OPEN = 1                LB_GETROWCOUNT = 3

LB_GETCOLUMNCOUNT = 4      LB_GETCOLUMNWIDTH = 5      LB_GETVALUE = 6

LB_GETFORMAT = 7           LB_CLOSE = 8               LB_END = 9

SYSCMD_INITMETER = 1       SYSCMD_UPDATEMETER = 2    SYSCMD_REMOVEMETER = 3

SYSCMD_SETSTATUS  = 4      SYSCMD_CLEARSTATUS = 5     SYSCMD_RUNTIME = 6

SYSCMD_ACCESSVER = 7       SYSCMD_CLEARHELPTOPIC = 11 OBJSTATE_OPEN = 1

OBJSTATE_NEW = 4           OBJSTATE_DIRTY = 2         A_DELETE_V2 = 7

A_SELECTRECORD_V2 = 8      A_SELECTALLRECORDS_V2 = 9  A_TOOLBAR_YES = 0

A_TOOLBAR_WHERE_APPROP = 1 A_TOOLBAR_NO = 2           DELETE_OK = 0

DELETE_CANCEL = 1          DELETE_USER_CANCEL = 2

Form, Report, Macro and Module Specific Security Constants

----------------------------------------------------------

DB_SEC_FRMRPT_READDEF = &H4&

DB_SEC_FRMRPT_WRITEDEF = &H8& + DB_SEC_FRMRPT_READDEF + DB_SEC_DELETE

DB_SEC_FRMRPT_EXECUTE = &H100&

DB_SEC_MAC_READDEF = &HA&

DB_SEC_MAC_WRITEDEF = &H6& + DB_SEC_DELETE

DB_SEC_MAC_EXECUTE = &H8&

DB_SEC_MOD_READDEF = &H2&

DB_SEC_MOD_WRITEDEF = &H4& + DB_SEC_MOD_READDEF + DB_SEC_DELETE

A_MENU_VER1X = 11, A_MENU_VER20 = 20

A_FORMATRTF = "Rich Text Format (*.rtf)"

A_FORMATXLS = "Microsoft Excel (*.xls)"

A_FORMATTXT = "MS-DOS Text (*.txt)"

DataConstants Module from UTILITY.MDA

-------------------------------------

DB_OPEN_TABLE = 1

DB_OPEN_DYNASET = 2

DB_OPEN_SNAPSHOT = 4

DB_DENYWRITE = &H1

DB_DENYREAD = &H2

DB_READONLY = &H4

DB_APPENDONLY = &H8

DB_INCONSISTENT = &H10

DB_CONSISTENT = &H20

DB_SQLPASSTHROUGH = &H40

DB_FAILONERROR = &H80

DB_FORWARDONLY = &H100

DB_OPTIONINIPATH = 1

DB_FIXEDFIELD = &H1

DB_VARIABLEFIELD = &H2

DB_AUTOINCRFIELD = &H10

DB_UPDATABLEFIELD = &H20

DB_DESCENDING = &H1

DB_BOOLEAN = 1

DB_BYTE = 2

DB_INTEGER = 3

DB_LONG = 4

DB_CURRENCY = 5

DB_SINGLE = 6

DB_DOUBLE = 7

DB_DATE = 8

DB_TEXT = 10

DB_LONGBINARY = 11

DB_MEMO = 12

DB_RELATIONUNIQUE = &H1&

DB_RELATIONDONTENFORCE = &H2&

DB_RELATIONINHERITED = &H4&

DB_RELATIONUPDATECASCADE = &H100&

DB_RELATIONDELETECASCADE = &H1000&

DB_RELATIONLEFT = &H1000000

DB_RELATIONRIGHT = &H2000000

DB_ATTACHEXCLUSIVE = &H10000

DB_ATTACHSAVEPWD = &H20000

DB_SYSTEMOBJECT = &H80000002

DB_ATTACHEDTABLE = &H40000000

DB_ATTACHEDODBC = &H20000000

DB_HIDDENOBJECT = &H1&

DB_TABLE = 1

DB_QUERYDEF = 5

DB_QSELECT = &H0

DB_QACTION = &HF0

DB_QCROSSTAB = &H10

DB_QDELETE = &H20

DB_QUPDATE = &H30

DB_QAPPEND = &H40

DB_QMAKETABLE = &H50

DB_QDDL = &H60

DB_QSQLPASSTHROUGH = &H70

DB_QSETOPERATION = &H80

DB_QSPTBULK = &H90

DB_UNIQUE = 1

DB_PRIMARY = 2

DB_PROHIBITNULL = 4

DB_IGNORENULL = 8

DB_LANG_ARABIC = ";LANGID=0x0401;CP=1256;COUNTRY=0"

DB_LANG_CZECH = ";LANGID=0x0405;CP=1250;COUNTRY=0"

DB_LANG_DUTCH = ";LANGID=0x0413;CP=1252;COUNTRY=0"

DB_LANG_GENERAL = ";LANGID=0x0409;CP=1252;COUNTRY=0"

DB_LANG_GREEK = ";LANGID=0x0408;CP=1253;COUNTRY=0"

DB_LANG_HEBREW = ";LANGID=0x040D;CP=1255;COUNTRY=0"

DB_LANG_HUNGARIAN = ";LANGID=0x040E;CP=1250;COUNTRY=0"

DB_LANG_ICELANDIC = ";LANGID=0x040F;CP=1252;COUNTRY=0"

DB_LANG_NORDIC = ";LANGID=0x041D;CP=1252;COUNTRY=0"

DB_LANG_NORWDAN = ";LANGID=0x0414;CP=1252;COUNTRY=0"

DB_LANG_POLISH = ";LANGID=0x0415;CP=1250;COUNTRY=0"

DB_LANG_CYRILLIC = ";LANGID=0x0419;CP=1251;COUNTRY=0"

DB_LANG_SPANISH = ";LANGID=0x040A;CP=1252;COUNTRY=0"

DB_LANG_SWEDFIN = ";LANGID=0x040B;CP=1252;COUNTRY=0"

DB_LANG_TURKISH = ";LANGID=0x041F;CP=1254;COUNTRY=0"

DB_VERSION10 = 1

DB_ENCRYPT = 2

DB_DECRYPT = 4

DB_VERSION11 = 8

DB_VERSION20 = 16

DB_SORTARABIC = 267

DB_SORTCYRILLIC = 263

DB_SORTCZECH = 264

DB_SORTDUTCH = 259

DB_SORTGENERAL = 256

DB_SORTGREEK = 269

DB_SORTHEBREW = 268

DB_SORTHUNGARIAN = 265

DB_SORTICELANDIC = 262

DB_SORTNORWDAN = 261

DB_SORTPDXINTL = 4096

DB_SORTPDXNOR = 4098

DB_SORTPDXSWE = 4097

DB_SORTPOLISH = 266

DB_SORTSPANISH = 258

DB_SORTSWEDFIN = 260

DB_SORTTURKISH = 270

DB_SORTUNDEFINED = -1

DB_FREELOCKS = 1

DB_SEC_NOACCESS = &H0&

DB_SEC_FULLACCESS = &HFFFFF

DB_SEC_DELETE = &H10000

DB_SEC_READSEC = &H20000

DB_SEC_WRITESEC = &H40000

DB_SEC_WRITEOWNER = &H80000

DB_SEC_DBCREATE = &H1&

DB_SEC_DBOPEN = &H2&

DB_SEC_DBEXCLUSIVE = &H4&

DB_SEC_CREATE = &H1&

DB_SEC_READDEF = &H4&

DB_SEC_WRITEDEF = &H8& Or DB_SEC_READDEF Or DB_SEC_DELETE

DB_SEC_RETRIEVEDATA = &H10& Or DB_SEC_READDEF

DB_SEC_INSERTDATA = &H20&

DB_SEC_REPLACEDATA = &H40&

DB_SEC_DELETEDATA = &H80&

REFERENCES

==========

For more information about constants, search for "constants" then

"Constants" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: MdlLib


INF: List of OLE 2.0 Features Supported in MS Access v. 2.0

Article ID: Q112749

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 supports the Object Linking and Embedding

(OLE) specification version 2.0. The OLE 2.0 specification describes a

standard set of interfaces that allow applications to share features.

Applications may provide none, some, or all of this functionality.

MORE INFORMATION

================

When you install Microsoft Access version 2.0, all the files necessary for

OLE 2.0 functionality are installed and Microsoft Access is registered in

your system as an OLE 2.0 client. If you choose to install Microsoft Graph

during the Microsoft Access installation, it is registered as an OLE 2.0

server application.

Embedding and Linking

---------------------

Objects created in OLE 1.0 and 2.0 servers can be embedded or linked into

Microsoft Access forms, reports, and tables. Microsoft Access supports the

OLE 2.0 standard menus and dialog boxes for inserting and updating objects.

Visual Editing

--------------

Microsoft Access 2.0 supports in-place editing of OLE objects in a form's

Form view. To prevent in-place editing of an embedded OLE object, set the

Enabled property of the object's frame to No. In-place activation is not

available in a form or report's Design view, or in a table, query, or

form's Datasheet view.

Drag and Drop

-------------

Microsoft Access 2.0 does not support Drag and Drop across applications.

Drag and Drop is used in Microsoft Access 2.0 to quickly create macro

actions, new controls, and to customize tool bars.

OLE Automation

--------------

Microsoft Access 2.0 provides full access to the OLE Automation methods

supported by embedded objects through the use of Access Basic.

Context-Sensitive Menus

-----------------------

Context-sensitive menus are used extensively in Microsoft Access 2.0 to

provide shortcuts for commonly used commands. This includes access to an

OLE object's object-specific verb menu when you click the right mouse

button on an OLE object. When an OLE object is activated in place, mouse

clicks are passed to the OLE object. When the object is not active the

mouse clicks are handled by Microsoft Access.

OLE Server

----------

Objects created in Microsoft Access 2.0 cannot be embedded or linked into

other OLE 2.0 applications; Microsoft Access 2.0 is not an OLE 2.0 server.

You can export objects to other Windows applications using a variety of

methods including DDE and the Microsoft Access Export command.

Conversion and Emulation

------------------------

Microsoft Access 2.0 does not have a Convert dialog box. Objects that are

registered to use AutoConversion or Object Type Emulation (also called

"Activate As" or "Treat As") are fully supported by Microsoft Access 2.0.

Relative Links

--------------

Links in OLE 2.0 maintain both a relative link source reference and an

absolute link source reference. You can take advantage of this

functionality in Microsoft Access 2.0, or you can continue to use the OLE

1.0 behavior in which only absolute link source reference information is

saved. This allows users operating in a heterogeneous environment (where

both Microsoft Access 1.x and 2.0 is used) to share databases. This option

is controlled through an entry in the MSACC20.INI file called

AllowOLE1LinkFormat. The default for this entry is 0, which means that all

OLE 2.0 link tracking information (both the relative and absolute link

source references) is maintained and stored.

REFERENCES

==========

For more information about modifying the MSACC20.INI file, search for

"customizing Microsoft Access" then "Customizing MSACC20.INI Settings"

using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IntpOle


INF: Macro to Check for Duplicate Values in a Field

Article ID: Q103135

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use a macro using the DLookup()

function to check for duplicate values in a field.

MORE INFORMATION

================

Microsoft Access provides automatic checking for duplicate values in a

field that has been designated as the primary key. However, this

check occurs after all fields for a record have been entered, just

before the record is committed to the database. The following sample

macro is based on the sample database NWIND.MDB and will perform a

duplicate check as the data in a field is entered:

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code.

1. Open the NWIND.MDB database.

2. Create a new form based on the Customers table.

3. Create a new macro as follows:

      Macro Name     Condition     Action

      --------------------------------------

      MyMacro        1.            MsgBox

                     ...           SendKeys

      1. DLookup("[Customer ID]", "Customers", "[Customer ID] = _

            Form.[Customer ID]") is Not Null

      MyMacro Actions

      --------------------------------------

      MsgBox

         Message: That value already exists.

      SendKeys

         Keystrokes: +{TAB}

         Wait: No

   Note that the ellipsis (...) under the condition indicates that the

   condition controls both macro actions. The SendKeys action will

   return the cursor to the field just exited.

4. In Design view for the form, attach this macro to the AfterUpdate

   property of the Customer ID control.

5. In Form view, make a note of the value of the current Customer ID.

6. From the Records menu, choose Data Entry to add a new record.

7. Enter the value of the earlier noted Customer ID. The message box

   with your message will appear and the cursor will be returned to

   the Customer ID field.

REFERENCES

==========

Microsoft Access "User's Guide," Chapter 22, and Appendix C

Additional reference words: 1.00 1.10 2.00 validate same validationrule

KBCategory:

KBSubcategory: McrCond


INF: Macro to Enter Date Record Was Last Modified

Article ID: Q96103

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to write a macro that will place the current

date into a LastModified field in your table each time a record is

modified. This method works when you are editing records from a form.

MORE INFORMATION

================

When a form is used to edit records, you can date stamp the record by

attaching a macro to the BeforeUpdate property of the form. For this

example, we will use the Customers table in the sample database

NWIND.MDB.

1. Add a new field to the Customers table.

      Table: Customers

   ---------------------------

      Field Name: DateModified

      DataType:   Date/Time

2. Create a macro called LastModified as follows:

      Macro Name            Action

      -------------------------------------------

      LastModified        SetValue

                             Item: [DateModified]

                             Expression: Date()

   NOTE: There is no equal sign (=) in front of the Date() function.

   If you put an equal sign in front of the Date() function, the macro

   will always put the date 12/30/99 into the [DateModified] control

   even though the macro step window shows the correct date in the

   argument section.

3. Create a form called Modify Customers based on the Customers table.

   Place a few of the fields on the form as follows:

      Form Name: Modify Customers

      ---------------------------

      ControlSource: DateModified

      ControlSource: Customer ID

      ControlSource: Company Name

      ControlSource: Address

4. Enter the macro name LastModified into the BeforeUpdate property of

   the Modify Customers form. Switch the form to Form view. Any time

   you modify the record, the current date will be placed in the

   DateModified control.

Additional reference words: 1.00 1.10 2.00 unexpected

KBCategory:

KBSubcategory: McrActn


INF: Maximum Number of Rows in Table When Counter is the Key

Article ID: Q97520

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The maximum value of a Counter data type is the same as the maximum

value of a Long Integer. A Long Integer is 32 bits long and has a

maximum positive value of 2,147,483,647 and a minimum negative value

of -2,147,483,648. If you use a Counter as the primary key, a table

can contain up to four billion records. The maximum number of records

in the table is also limited by the maximum size of a database. For

more information, see Appendix A in the Microsoft Access "User's

Guide," versions 1.0, 1.1 and 2.0.

MORE INFORMATION

================

Values in a Counter field increment from 1 to 2,147,483,647. The next

record receives the minimum negative value for a Long Integer,

-2,147,483,648. The Counter value for each subsequent record is one

greater than the previous value, until it reaches zero.

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: TblDatyp


INF: Microsoft Access 2.0 Disk Contents (3.5", 1.44 MB)

Article ID: Q115123

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists the directory contents of the disks shipped with

Microsoft Access version 2.0 (3.5 inch, 1.44 MB).

MORE INFORMATION

================

Disk 1

------

Volume Label: DISK1

ACMSETUP EX_       106,497 04-05-94  12:00a

ACMSETUP HL_        12,618 04-05-94  12:00a

ACREADME HLP        84,659 04-05-94  12:00a

ACSETUP  TT_        52,390 04-05-94  12:00a

ADMIN    IN_         2,530 04-05-94  12:00a

BTRV200  DL_        56,473 04-05-94  12:00a

CTL3D    DL_        10,085 04-05-94  12:00a

CTL3DV2  DL_        10,331 04-05-94  12:00a

DBNMP3   DL_         5,909 04-05-94  12:00a

DECOMP   EXE        39,044 04-05-94  12:00a

DRVSSRVR HL_        54,381 04-05-94  12:00a

INSTCAT  SQ_        14,016 04-05-94  12:00a

MSACAHBB DL_        61,904 04-05-94  12:00a

MSCPYDIS DL_         8,805 04-05-94  12:00a

MSSETUP  DL_        91,812 04-05-94  12:00a

ODBC     DL_        23,412 04-05-94  12:00a

ODBCADM  EX_         3,270 04-05-94  12:00a

ODBCINST DL_        42,520 04-05-94  12:00a

ODBCINST HL_        10,369 04-05-94  12:00a

OLE2     RE_         2,749 04-05-94  12:00a

PDX200   DL_       120,351 04-05-94  12:00a

README   TXT           696 04-05-94  12:00a

SETUP    EXE        39,856 04-05-94  12:00a

SETUP    INI           149 04-05-94  12:00a

SETUP    IN_         2,699 04-05-94  12:00a

SETUP    LST           578 04-05-94  12:00a

SETUP    ST_        16,136 04-05-94  12:00a

SQLSRVR  DL_        85,111 04-05-94  12:00a

TYPELIB  DL_        78,623 04-05-94  12:00a

XBS200   DL_       150,214 04-05-94  12:00a

_MSSETUP EX_         9,147 04-05-94  12:00a

       31 file(s)      1,197,334 bytes

Disk 2

------

Volume Label: DISK2

DAO2016  DL_       165,299 04-05-94  12:00a

MSABC200 DL_       190,545 04-05-94  12:00a

MSACCESS EX_     1,031,533 04-05-94  12:00a

MSAJU200 DL_        50,106 04-05-94  12:00a

        4 file(s)      1,437,483 bytes

Disk 3

------

Volume Label: DISK3

COMPOBJ  DL_        47,475 04-05-94  12:00a

MSAEXP20 DL_        42,016 04-05-94  12:00a

MSAIN200 DL_       120,884 04-05-94  12:00a

MSAJT200 DL_       500,727 04-05-94  12:00a

MSAOLE20 DL_        57,065 04-05-94  12:00a

ODBCJT16 DL_        65,459 04-05-94  12:00a

OLE2     DL_       144,252 04-05-94  12:00a

OLE2DISP DL_        44,927 04-05-94  12:00a

STDOLE   TL_         1,881 04-05-94  12:00a

STORAGE  DL_        68,983 04-05-94  12:00a

UTILITY  MD_        52,695 04-05-94  12:00a

WRKGADM  EX_        86,698 04-05-94  12:00a

WZLIB    MD_       158,976 04-05-94  12:00a

       13 file(s)      1,392,038 bytes

Disk 4

------

Volume Label: DISK4

CONSTANT TX_         1,137 04-05-94  12:00a

DRVACC2  HL_        13,960 04-05-94  12:00a

MSACC20  H1_     1,048,730 04-05-94  12:00a

MSACCPSS HL_        15,959 04-05-94  12:00a

MSAFIN   DL_        12,409 04-05-94  12:00a

MSAU200  DL_        11,681 04-05-94  12:00a

MSINFO   EX_        16,713 04-05-94  12:00a

MSJETERR DL_         5,943 04-05-94  12:00a

MSJETINT DL_        10,112 04-05-94  12:00a

MSTOOLBR DL_         5,536 04-05-94  12:00a

ODBCTL16 DL_        36,022 04-05-94  12:00a

OLE2CONV DL_        29,914 04-05-94  12:00a

OLE2NLS  DL_        40,507 04-05-94  12:00a

OLE2PROX DL_        17,642 04-05-94  12:00a

ORDERS   MD_        64,335 04-05-94  12:00a

SOA200   DL_        19,549 04-05-94  12:00a

VER      DL_         5,737 04-05-94  12:00a

VSHARE   38_         7,241 04-05-94  12:00a

       18 file(s)      1,363,127 bytes

Disk 5

------

Volume Label: DISK5

MAPIVIM  DL_        27,676 04-05-94  12:00a

MSACC20  H2_     1,082,248 04-05-94  12:00a

MSACCESS CU_       310,145 04-05-94  12:00a

ORDERS   HL_        13,029 04-05-94  12:00a

        4 file(s)      1,433,098 bytes

Disk 6

------

Volume Label: DISK6

MSACC20  H3_       835,954 04-05-94  12:00a

NWIND    MD_       546,150 04-05-94  12:00a

SDM      DL_        57,337 04-05-94  12:00a

        3 file(s)      1,439,441 bytes

Disk 7

------

Volume Label: DISK7

GRAPH5   EX_       879,809 04-05-94  12:00a

MSACCARD DL_         2,168 04-05-94  12:00a

MSGRAPH  HL_       340,135 04-05-94  12:00a

WZBLDR   MD_       212,971 04-05-94  12:00a

        4 file(s)      1,435,083 bytes

Disk 8

------

Volume Label: DISK8

AUTOCONV EX_         9,390 04-05-94  12:00a

CCAPI200 DL_        23,659 04-05-94  12:00a

CCARD200 EX_        64,797 04-05-94  12:00a

GREN50   OL_        23,011 04-05-94  12:00a

GRINTL   DL_        55,622 04-05-94  12:00a

MCIOLE   DL_         4,818 04-05-94  12:00a

NETWKSTA 50_        61,578 04-05-94  12:00a

NEWCUST  DB_         1,104 04-05-94  12:00a

SCP      DL_         4,637 04-05-94  12:00a

SOLUTION HL_       129,280 04-05-94  12:00a

SOLUTION MD_       119,655 04-05-94  12:00a

WFWNET   DR_       137,584 04-05-94  12:00a

WZFRMRPT MD_       241,258 04-05-94  12:00a

WZQUERY  MD_        87,570 04-05-94  12:00a

WZTABLE  MD_        70,152 04-05-94  12:00a

WZTBLDAT MD_        54,328 04-05-94  12:00a

       16 file(s)      1,088,443 bytes

Additional reference words: 2.00

KBCategory:

KBSubcategory: StpOthr


INF: Microsoft Access 2.0 Readme Help File Contents

Article ID: Q113564

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists the contents and topics contained in the Microsoft

Access version 2.0 Readme Help file. Note that the Readme Help file

replaces the text-only README.TXT file included with earlier versions of

Microsoft Access.

MORE INFORMATION

================

In the items below, each content section is underlined, with its associated

topics below.

Microsoft Access Product Update

-------------------------------

 - Microsoft Access Q&A.

 - Using SHARE.EXE or VSHARE.386.

 - Using DECOMP.EXE to Decompress Microsoft Access Files.

 - Renaming, Deleting, or Moving Files and Directories.

 - Files That Must Be Installed Locally.

 - Warning When Attaching Tables with Unsupported Indexes.

 - Scope and Lifetime of Access Basic Variables and Functions.

 - International Issues.

Conversion and Compatibility Updates

------------------------------------

 - Conversion from Microsoft Access Version 1.x to 2.0.

 - Setup Removes Microsoft Access Version 1.x Files.

 - Improving Index Performance.

 - Conflicts with New Property Names in Expressions and Access Basic

   Code.

 - Form Control and Section Names.

 - Converting a "Front-end/Back-end" Application.

 - Version 2.0 Setup and the UTILITY.MDA File.

 - Using Visual Basic Version 3.0 Applications.

 - Exporting to Version 1.1 Databases.

 - DefaultValue Property Setting Includes Quotation Marks in Version

   2.0.

 - Owner Access Queries.

 - Order of Evaluation of Expressions.

 - Applications That Use the SQL Pass-through DLL.

 - Closing Pop-up Forms and Their Underlying Windows.

 - Unused Error Messages.

Network Installations

---------------------

 - Designating Network Connections.

 - Setting Up Microsoft Access on a Network File Server.

 - Creating Custom Installations for Workstation Users.

Documentation Updates

---------------------

 - Book: Microsoft Access Getting Started.

 - Book: Microsoft Access User's Guide.

 - Book: Microsoft Access Building Applications.

 - Help: Microsoft Access Help.

Using Microsoft Access Version 2.0 with Other Software

------------------------------------------------------

 - Microsoft Visual Basic.

 - Accessing Microsoft Access Data from Microsoft Word and Microsoft

   Excel.

 - Using Microsoft Access with Paradox Databases.

 - Running Multiple Data Access Applications.

 - Using Microsoft Access to Import, Attach, or Export to Microsoft

   FoxPro Version 2.5 Files.

 - Lotus cc:Mail or Lotus Notes.

 - Using Microsoft Access with Microsoft Video for Windows

   Windows NT.

 - Setting Up Microsoft Access on a Novell Network.

 - Using Microsoft Access on Novell NetWare Servers and Banyan VINES

   Servers (Increasing the Number of Record Locks).

 - Using Microsoft Access with Microsoft LAN Manager.

 - Using Microsoft Access with Microsoft Windows for Workgroups.

 - Using SQL Server Data Installed on a Novell NetWare LAN or a

   Banyan VINES Network.

 - Asynchronous Query Execution and ODBC Drivers.

 - ORACLE Server Databases and Null Indexes.

Using Microsoft Access with Btrieve

-----------------------------------

 - General Considerations.

 - How Microsoft Access Locates Btrieve Files.

 - Using Databases with Xtrieve-style Security.

 - Using Compressed Data Files.

 - Using Btrieve in a Multiuser Environment.

 - Using Btrieve Indexes.

 - Setting Btrieve Options.

 - Setting Microsoft Access Options for Btrieve.

 - Configuring the Server-based Version (BTRIEVE.NLM).

Files Included with Microsoft Access

------------------------------------

 - Outdated Version 1.0 and Version 1.1 Files.

 - Microsoft Access Version 2.0 Files.

Additional reference words: 2.00 helpfile read.me

KBCategory:

KBSubcategory: DcmOthr


INF: Microsoft Access 2.0 Wizards Use More Global Memory Space

Article ID: Q114166

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Microsoft Access Wizards in Microsoft Access version 2.0 require 12%

more global memory space than they do in version 1.x. In version 1.x the

Wizards require 13% of total global memory; in version 2.0 they require

25%.

Because the Wizards require more global memory in version 2.0, large

applications that use many global variables, and have several Wizards

loaded, may run out of global memory space, resulting in "Out of Memory"

error messages.

MORE INFORMATION

================

To avoid running out of global memory space, try the following tips:

 - Uninstall some (or all) of the Wizards.

 - Whenever possible, use locally-scoped, instead of global, variables.

 - Use private functions in form or report modules, rather than using

   global modules.

REFERENCES

==========

For more information about global variables, search for "Global" then

"Global Statement" using the Microsoft Access Help menu.

Additional reference words: 2.00 AB Programming OOM

KBCategory:

KBSubcategory: GnlOthr


INF: Microsoft Access and ORACLE ODBC Drivers

Article ID: Q112105

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 contains an ODBC driver for connecting to SQL

Server. However, Microsoft Access 2.0 does not contain the Oracle 6 ODBC

driver because customer research showed that relatively few people used the

Oracle driver that was shipped with Microsoft Access version 1.1.

If you have the Oracle ODBC driver supplied with Microsoft Access version

1.1, however, you can use it with Microsoft Access version 2.0. The Oracle

ODBC driver included with Microsoft Access version 1.1 supports Oracle 6

functionality and Oracle 6 functionality in Oracle 7, but does not support

full Oracle 7 functionality. If you want full Oracle 7 functionality, both

Oracle and Q+E have Oracle 7 ODBC drivers available that can be used with

Microsoft Access version 2.0.

If you do not have Microsoft Access 1.1, you can obtain the Oracle 6

driver by purchasing the Microsoft ODBC Drivers fulfillment kit. This kit

contains ODBC drivers for Microsoft SQL Server, Oracle 6, and other

drivers as they become available. To order the kit, send $5.25 + $5.00

shipping (+ local sales tax, if applicable) to:

   Microsoft Access for Windows Supplemental Offers

   PO Box 3022

   Bothell, WA 98041

Additional reference words: 2.00 Importing Exporting Attaching

KBCategory:

KBSubcategory: IntpOthr


INF: Microsoft Access and Untested Networks

Article ID: Q109739

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes some of the anomalies that can occur when you are

using Microsoft Access with networks that have not been tested with

Microsoft Access. These networks include DEC Pathworks, Sun PC-NFS, IBM

PC-LAN Server, and others.

MORE INFORMATION

================

Microsoft Access has been tested and verified as supportable on the

following networks: Microsoft LAN Manager, Windows for Workgroups, Novell

NetWare versions 2.x and 3.x, Artisoft Lantastic, and Banyan VINES.

Many other network types (including IBM PC-LAN Server, DEC Pathworks, and

Sun PC-NFS) have experienced erratic behavior and only limited success with

Microsoft Access. Irregular behaviors on these network types can include:

 - An inability to install Microsoft Access to a network drive

 - An inability to run the Workstation Setup after a successful Admin

   Setup

 - An inability to open a multiuser file (non-exclusively)

 - Multiple users cannot update a record correctly

 - Unexplained database corruption or data loss

Some of these behaviors are quite serious. We want to protect our

customers' valuable data, and the best way to do this is to support

Microsoft Access only on networks that we have tested it with. We cannot

support Microsoft Access on non-tested networks.

However, just because we have not tested Microsoft Access with a

particular network does not mean that the network will not work with

Microsoft Windows. Microsoft Windows has been tested with far more

networks than has Microsoft Access. It is a good idea, before purchasing

any product, to check with the product's manufacturer as to the product's

compatibility with your network.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.1, Appendix D

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: StpNet


INF: Microsoft Access Does Not Use Record Numbers

Article ID: Q95928

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses the reasons why Microsoft Access does not use

record numbers, as do some other database products.

MORE INFORMATION

================

Many database products, such as Microsoft FoxPro, dBASE IV, and

Paradox, use a record number that is physically associated with the

record. For example, the first record in a table has record number 1,

the second record has record number 2, and so on. The record numbers

remain part of the record as long as the record exists. The first

record entered into a table is always record number 1, even if the

table is sorted and the record appears somewhere other than the first

position in the table.

Microsoft Access does not use this approach. When you open a table in

Datasheet view, a number appears at the bottom of the form. This

number indicates the position of the record in the recordset, not the

record's natural position in the table. For example, if a record with

the key value "Anderson" is the first record in a recordset, the

number 1 appears at the bottom of the form. However, if you sort the

same records on a different key, the record may no longer appear as

the first record and a different number may appear at the bottom of

the form.

When you open a table, form, or report, Microsoft Access creates a

dynaset, a dynamic copy of the appropriate recordset, and assigns

numbers to the records therein. These numbers are used only by the

user interface to provide a visually unique identifier for each

record.

Microsoft Access uses this approach because assigning a physical

record number to each record is not "relationally correct." According

to relational database theory, data may appear in any order at any

time. Therefore, the key value, not a random record number, provides

the only reliable method to identify a record.

Because no record number is available, Microsoft Access provides

another method to identify records in a dynaset. Using the Bookmark

property, you can write a procedure to find a target record, store its

bookmark value in a variable, move to other records, and return to the

original record. For more information about bookmarks, search on

"Bookmark" using the Help menu.

dBASE IV and Paradox are manufactured by Borland International, Inc., a

vendor independent of Microsoft; we make no warranty, implied or

otherwise, regarding this product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 record selector vcr checkpage

KBCategory:

KBSubcategory: PgmObj


INF: Microsoft Access, Scanners, and Scanning Software

Article ID: Q103631

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article contains general information about Microsoft Access,

scanners, and scanning software.

MORE INFORMATION

================

To scan an image into Microsoft Access, both a scanner and scanning

software are required. The following is a list of scanners that are

currently supported by Microsoft Windows:

   Scanner        Manufacturer      Phone number

   -----------------------------------------------

   ScanJet        Hewlett-Packard   (208) 323-2551

   ScanMan        Logitech          (510) 795-0427

   Hand Scanner   Marstek           (714) 833-7740

The Hewlett-Packard (HP) ScanJet provides TWAIN compliance, the

industry's standard protocol for scanning and acquiring graphics from

software applications.

If the software that comes with the scanner saves the image in

a format that a Windows graphics program can recognize, Microsoft

Access can display the image.

The following is a list of graphics software packages and their

currently supported formats:

   Software     Graphic Formats       Phone number

   -------------------------------------------------

   Image-In     .BMP .EPS .TIF        (800) 345-3540

   CorelDRAW    .BMP .EPS .TIF .PCX   (613) 728-8200

   Paintbrush   .BMP .PCX .MSP .DIB   (206) 426-9400

Image-In is a computer-aided design (CAD) graphics software package

that ships with the Marstek Hand Scanner.

The following procedure explains how you can use Paintbrush to bring

an image into Microsoft Access from a scanner:

1. Scan the image and save it in .BMP file format using the scanner

   software.

2. Start Microsoft Access. In the sample database NWIND.MDB, open the

   Employees form.

3. From the Records menu, choose Data Entry.

4. Select the Photo field.

5. From the Edit menu, choose Insert Object.

6. In the Insert Object dialog box, choose the File button.

7. Select your file from the list.

The scanned image will display in the Photo field.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 316-339

The following products are manufactured by vendors independent of

Microsoft: CorelDRAW by Corel Systems Corp.; ScanJet by Hewlett-Packard

Company; and ScanMan by Logitech. We make no warranty, implied or

otherwise, regarding these products' performance or reliability.

Additional reference words: 1.00 1.10 2.00 WinIss ole twain picture scan

KBCategory:

KBSubcategory: EvnOs


INF: Microsoft Graph Changes May Not Be Retained

Article ID: Q97774

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you create a graph on a form or report and later make some

changes to the formatting or to the data itself within Microsoft

Graph, these changes may not appear in the form or report.

This article discusses the different sources of information that Graph

normally uses and which sources take precedence over others in the

hierarchy of graph changes.

MORE INFORMATION

================

There are several sources of information for a graph: the Microsoft

Graph application, the contents of the graph object's RowSource

property, and the data in the underlying table or query.

Microsoft Access regenerates the graph each time you print or preview the

graph, or switch to Form view. When Microsoft Access regenerates the graph,

it reads the SQL statement in the object's RowSource property. The name of

the graph and the data to be graphed are obtained from this SQL statement.

Microsoft Access obtains the format of the data from the table or query

that is the source of the graph's SQL statement.

The precedence for changes is determined as follows:

 - Anything that you change in Microsoft Graph can be overwritten by

   the SQL statement in the graph's RowSource property or by the

   underlying data itself. (Examples of what you can change in Microsoft

   Graph include font, font size, font color, and the type of graph

   selected.)

 - Anything that you change in the SQL statement of the graph's

   RowSource property can be overwritten by the underlying data.

   (Examples of what you can change in the SQL statement include the

   title and labels.)

 - Anything that you change in the underlying data has precedence over

   other changes. (An example of what you can change in the underlying

   data is the actual format of the data. However, if the SQL statement

   contains a calculated field, such as =Format([Start Date],"MMM"), the

   format is determined by the result of this calculation, not by the

   underlying data.)

REFERENCES

==========

For more information on customizing the title, labels, and data in a

graph, query on "Graph and Format and Label" or "Graph and Title" here

in the Microsoft Knowledge Base.

Microsoft Graph "User's Guide," version 3.0, Chapter 3, "Working with

a Chart", pages 71-101

Additional reference words: 1.00 1.10 2.00 chart checkpage

KBCategory:

KBSubcategory: IntpGrph


INF: MS Access Saves Printer Information with Each Form/Report

Article ID: Q90864

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access saves printer driver information with each form or report

that it generates. This means you do not have to set up the printer with

the correct driver in order to print out a form or report--the form or

report "remembers" the correct driver and uses it. For example, you can

save one form using a PostScript printer driver and another form using the

generic text driver.

NOTE: If the Default Printer option button is selected, the form will

print to the Windows default printer.

MORE INFORMATION

================

If the printer that the printer driver requires is not currently

connected, Microsoft Access displays a dialog box stating that the

printer is not available and allows you to select another printer.

Bear in mind that some text formatting depends on the current printer

driver. For example, if you format a document with a PostScript

printer font instead of a software font (such as a TrueType font) and

send the document to a PostScript printer, everything should print out

correctly. However, if you send the document to a LaserJet, you will

get output errors because some PostScript printer fonts are not

available on a LaserJet.

A driver-related problem could be something such as the sudden

appearance of the Zapf Dingbats font in a form or report set up to use

the Windows System font and sent to a PostScript printer. This problem

occurs because the Windows System font is not available on PostScript

printers. When a font is unavailable, Windows attempts to find an

equivalent among those on the printer, searching through them

alphabetically. In this case, it arrives at the Zapf Dingbats font

last and uses it because there are no other options.

The best way to avoid these problems is to create all your forms and

reports with TrueType fonts, which appear correctly in print preview

and are processed the same way by all printers.

Additional reference words: 1.00 1.10 2.00 printing post script true type

KBCategory:

KBSubcategory: RptProp


INF: Network Users Can Open Their Own SYSTEM.MDA Exclusively

Article ID: Q90851

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Two users on the same network can open the same SYSTEM.MDA file

exclusively. Microsoft Access ignores the exclusive lock on a

SYSTEM.MDA file in a multiuser installation.

MORE INFORMATION

================

Microsoft Access opens the system database nonexclusively on the

network. Subsequent requests to open the database ignore the read-only

and exclusive flags.

Since the SYSTEM.MDA file is opened whenever a user logs into the

database, opening the SYSTEM.MDA file exclusively would lock out all

other users on the network.

Additional reference words: 1.00 1.10 2.00 WinIss jet

KBCategory:

KBSubcategory: EvnOs


INF: New Events and Properties in Microsoft Access v. 2.0

Article ID: Q113302

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 has many new events and properties. The new

events and properties are listed below in alphabetical order.

MORE INFORMATION

================

- A -

Action                           Attributes

AfterDelConfirm                  AutoActivate

AfterInsert                      AutoCenter

Alias                            AutoExpand

AllowZeroLength                  AutoTab

AllowZeroLength (Data Access)

- B -

BeforeDel                        Bookmark (Data Access)

BeforeInsert                     BorderLineStyle

- C -

CacheSize                        Container

CacheStart                       ControlBox

Class                            Count (Data Access)

Clustered                        CurrentObjectName

CollatingOrder                   CurrentObjectType

ColumnHeadings                   CurrentSectionLeft

ColumnHidden                     CurrentSectionTop

ColumnOrder                      CurrentView

Connect

- D -

DatasheetFontHeight              DefaultValue (Data Access)

DatasheetFontItalic              DestConnectStr

DatasheetName                    DestinationDB

DatasheetUnderline               DestinationTable

DatasheetWeight                  Dirty

DataUpdatable                    DisplayType

DateGrouping

- E -

EnterKeyBehavior                 EventProcPrefix

- F -

FastLaserPrinting                ForeignTable

Foreign                          FrozenColumns

ForeignName

- G,H,I,J,K -

IgnoreNulls                      InputMask

IgnoreNulls (Data Access)        InSelection

Inherited                        KeepTogether - Groups

- L -

LastModified                     LoginTimeout

ListCount                        LogMessages

ListIndex                        lpOLEObject

- M -

MaxButton                        MinButton

Me                               Module

MenuBar

- N -

Name                             NavigationButtons

Name (Data Access)

- O -

Object                           OnKeyPress

ObjectPalette                    OnKeyUp

ObjectVerbs                      OnLoad

ObjectVerbsCount                 OnLostFocus

ODBCConnectStr                   OnMouseDown

ODBCTimeout                      OnMouseMove

ODBCTimeout (Data Access)        OnMouseUp

OLEType                          OnNotInList

OLETypeAllowed                   OnResize

OnActivate                       OnRetreat

OnChange                         OnTimer

OnClick                          OnUnload

OnDeactivate                     OnUpdated

OnError                          OpenArgs

OnGotFocus                       OrdinalPosition

OnKeyDown                        OutputAllFields

Owner

- P -

Pages                            PID

PaintPalette                     PreviousControl

PaletteSource                    Primary

Password                         Primary (Data Access)

PercentPosition                  PrtDevNames

Permissions

- Q,R -

QueryTimeout                     ReturnsRecords

Required                         ReturnsRecords (Data Access)

Required (Data Access)           RowHeight

Restartable                      RunPermissions

- S -

SelLength                        SourceConnectStr

SelStart                         SourceDatabase

SelText                          SourceDoc

ShortcutMenu                     SourceField

Size                             SourceItem

SizeMode                         SourceTable

Source                           SourceTableName

- T -

TabIndex                         Text

Table                            TimerInterval

TabStop                          TopValues

Tag                              Type

- U -

Unique                           UniqueValues

Unique (Data Access)             UpdateOptions

UniqueRecords                    UserName

- V -

V1xNullBehavior                  Value

ValidateOnSet                    Value (Data Access)

ValidationRule (Data Access)     Verb

ValidationText (Data Access)     Version

- W,X,Y,Z -

WindowHeight                     WindowWidth

REFERENCES

==========

For more information on new events and properties in Microsoft Access

version 2.0, search for "What's New in Microsoft Access version 2.0," and

"properties: reference" using the Microsoft Access Help menu.

Additional reference words: 2.00 PtrIss

KBCategory:

KBSubcategory: FrmrptCtlprp


INF: New ODBC Driver for Microsoft Access Version 2.0

Article ID: Q112062

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

A new ODBC driver ships with Microsoft Access version 2.0 and will

be installed only with Microsoft Access version 2.0.

MORE INFORMATION

================

The Microsoft Access 2.0 driver for Microsoft Office that allows Microsoft

Word version 6.0 for Windows and Microsoft Excel version 5.0 to use

Microsoft Access version 2.0 data ships with Microsoft Access version 2.0.

This ODBC driver works only with Word and Microsoft Excel, and will not

work with Visual C++.

This driver will automatically be installed if you have already installed

the version 1.x driver with Word or Microsoft Excel, or if you have Office

Professional version 4.3.

When you install this driver, Setup creates a data source for Word. To use

the query tool with Microsoft Excel, you must set up your own data source.

While the new ODBC driver will allow you to access both version 1.x and

2.0 databases, you will probably want to use the version 1.x driver for

accessing 1.x databases because you will not be able to use the new

features in the 2.0 driver with 1.x databases.

REFERENCES

==========

For more information on the ODBC driver and setting up data sources, see

the DRVACC2.HLP file located in your \WINDOWS\SYSTEM directory.

Additional reference words: 2.00 obsolute database error

KBCategory:

KBSubcategory: IntpOthr


INF: New Version Argument for DoMenuItem in Version 2.0

Article ID: Q112065

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Since the menu structure has changed from Microsoft Access version 1.x to

Microsoft Access version 2.0, there is a new argument for the DoMenuItem

action. The new argument, version, lets you use code written for either

version 1.x or 2.0 databases. Note that this new argument is the fifth

argument for the DoMenuItem action, and is only available in Access Basic.

MORE INFORMATION

================

The new version argument takes either of two constants: A_MENU_VER1X or

A_MENU_VER20. The default for this argument is A_MENU_VER1X.

If you write code in Microsoft Access version 2.0 and you want to use

version 2.0 menu commands, set this argument to A_MENU_VER20.

The syntax for the DoMenuItem action is:

   DoCmd DoMenuItem menubar, menuname, command [,subcommand][,version]

The following example using the above syntax chooses Paste from the Edit

menu in form Design view in Microsoft Access 2.0:

   DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_PASTE, ,A_MENU_VER20

REFERENCES

==========

For more information about the DoMenuItem action, search for "DoMenuItem"

then "DoMenuItem Action" using the Microsoft Access Help menu.

Additional reference words: 2.00 AB Programming

KBCategory:

KBSubcategory: PgmOthr


INF: No Custom Printer Setup for Mailing Labels ReportWizard

Article ID: Q93023

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Mailing Labels ReportWizard allows you to choose from 66 different

labels. However, the ReportWizard does not verify whether the labels

you select will correctly fit on the paper size that you have

specified.

You may need to manually customize your printer setup or the number of

labels per page after using the ReportWizard.

MORE INFORMATION

================

The need to customize the printer setup is most common with dot-matrix

printers. Label sizes other than .5 inch or 1 inch may not fit evenly

on the default 11-inch page.

To manually customize your printer setup or the number of labels

per page:

1. Preview your report.

2. From the File menu, choose Print Setup.

3. Customize your margins to accommodate the number and width of

   the labels.

4. Choose the More button in the Print Setup dialog box to customize

   the number of rows of labels.

Additional reference words: 1.00 1.10 2.00 wizards

KBCategory:

KBSubcategory: RptLabel


INF: No Permission to Modify Data in a Table

Article ID: Q92667

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you try to modify data in a table in Datasheet view, you receive

the error message

    No permissions for '<table name>'

even though you were able to open the table without receiving any

error messages.

MORE INFORMATION

================

This error message indicates that you have only Read Definitions (in

Microsoft Access version 1.x) or Read Design (in Microsoft Access version

2.0) permissions on the table. Because you have permission to view the

data, no error message is displayed when you first open the table in

Datasheet view, which is the default.

When you try to open the table in Design view, the following error

message is displayed:

    You don't have permission to modify '<table name>'.

    Open as read-only?

This message appears because you have no security permissions to open

the table in Design view.

REFERENCES

==========

For more information on permissions, search for "permissions

command" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: ScrtOthr


INF: Norton Desktop 1.x Not Compatible with Microsoft Access

Article ID: Q88172

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

Running Norton Desktop for Windows versions 1.x with Microsoft Access

results in unpredictable behavior in Microsoft Access (for example, you

may lose the background screen or experience a general protection [GP]

fault). To resolve these problems, upgrade to version 2.0 of Norton

Desktop for Windows.

Norton Desktop for Windows is manufactured by a vendor independent of

Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 WinIss

KBCategory:

KBSubcategory: EvnOs


INF: Number of Times a Custom Function Executes in a Query

Article ID: Q98788

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

A custom function called from a query will execute as follows:

 - One time per query if the expression does not reference a field

 - One time per record if the expression does reference a field

 - Two times per record if there are criteria on the expression

MORE INFORMATION

================

To optimize a query, Microsoft Access will not re-execute a custom

function unless the value passed to it changes. If the function

accepts a field as a parameter, Microsoft Access must re-execute the

custom function for each record, since the data may change from record

to record. If criteria are placed on the result of the function,

Microsoft Access must re-execute the function when applying the

criteria.

The examples below (examples A, B, and C) demonstrate each of the

three scenarios, using a custom function designed to number the

records in a query.

NOTE: These examples are simplified to demonstrate the results you

can expect when you use custom functions in a query. Many variables

can affect the number of times Microsoft Access re-executes a custom

function. For example, if you first minimize and them maximize

Microsoft Access, the process of repainting the screen also includes

re-executing any custom function that is part of the query result.

Complete the following steps to use examples A, B, and C:

1. Create a new module called RecordNumbers in the sample database

   NWIND.MDB.

2. Add the following to the module's Declarations section:

      Option Explicit

      Global RecordNum

Example A: An Expression that Calculates Only Once Per Query

-------------------------------------------------------------

1. Add the following function to the module you created in the

   previous procedure:

      Function ShouldIncrement ()

         RecordNum = RecordNum + 1

         ShouldIncrement = RecordNum

      End Function

2. Create a new query based on the Employees table. Drag the

   Last Name field to the query grid and add a column with

   the following expression:

      RecordNumber: ShouldIncrement()

3. Run the query. In Microsoft Access version 1.x, you will get the

   following result:

      Last Name    RecordNumber

      -------------------------

      Davolio      1

      Fuller       1

      Leverling    1

      Peacock      1

      Buchanan     1

      Suyama       1

      King         1

      Callahan     1

      Dodsworth    1

   In Microsoft Access version 2.0, you will get the following result:

      Last Name    RecordNumber

      -------------------------

      Davolio      1

      Fuller       1

      Leverling    1

      Peacock      1

      Buchanan     1

      Suyama       1

      King         1

      Callahan     1

      Dodsworth    1

      Hellstern    1

      Smith        1

      Patterson    1

      Brid         1

      Martin       1

      Pereira      1

Note that the function IncrementRecNum() is executed only once.

Example B: An Expression that Calculates Once Per Record

--------------------------------------------------------

1. Add the function DoesIncrement() to the module RecordNumbers you

   created in the first procedure:

      Function DoesIncrement (AnyValue)

         RecordNum = RecordNum + 1

         DoesIncrement = RecordNum

      End Function

2. Create a new query based on the Employees table. Drag the Last

   Name field to the query grid and add a column with the following

   expression:

      RecordNumber: DoesIncrement([Employee ID])

3. Run the query. In Microsoft Access 1.x, you will get the following

   result:

      Last Name    RecordNumber

      -------------------------

      Davolio      1

      Fuller       2

      Leverling    3

      Peacock      4

      Buchanan     5

      Suyama       6

      King         7

      Callahan     8

      Dodsworth    9

   In Microsoft Access 2.0, you will get the following result:

      Last Name    RecordNumber

      -------------------------

      Davolio      1

      Fuller       2

      Leverling    3

      Peacock      4

      Buchanan     5

      Suyama       6

      King         7

      Callahan     8

      Dodsworth    9

      Hellstern   10

      Smith       11

      Patterson   12

      Brid        13

      Martin      14

      Pereira     15

Example C: An Expression that Calculates More Than Once Per Record

------------------------------------------------------------------

1. Create a new query based on the Employees table. Drag the

   Last Name field to the query grid and add a column with

   the following expression:

      RecordNumber: DoesIncrement([Employee ID])

  NOTE: You will need to complete step 1 of example B in order to

  have the DoesIncrement() function available.

2. Open the module RecordNumbers in Design view. From the View menu,

   choose Immediate Window. Type the following statement to initialize

   the variable RecordNum:

      RecordNum = 0

3. Run the query. In Microsoft Access 1.x, you will get the following

   result:

      Last Name    RecordNumber

      -------------------------

      Davolio      1

      Fuller       2

      Leverling    3

      Peacock      4

      Buchanan     5

      Suyama       6

      King         7

      Callahan     8

      Dodsworth    9

   In Microsoft Access 2.0, you will get the following result:

      Last Name    RecordNumber

      -------------------------

      Davolio      1

      Fuller       2

      Leverling    3

      Peacock      4

      Buchanan     5

      Suyama       6

      King         7

      Callahan     8

      Dodsworth    9

      Hellstern   10

      Smith       11

      Patterson   12

      Brid        13

      Martin      14

      Pereira     15

4. Repeat Step 2 in this example (example C).

5. Add the following criteria under RecordNumber:

      >=0

6. Run the query. In Microsoft Access 1.x, you will now get the following

   result:

      Last Name    RecordNumber

      -------------------------

      Davolio      10

      Fuller       11

      Leverling    12

      Peacock      13

      Buchanan     14

      Suyama       15

      King         16

      Callahan     17

      Dodsworth    18

   In Microsoft Access 2.0, you will now get the following result:

      Last Name    RecordNumber

      -------------------------

      Davolio      16

      Fuller       17

      Leverling    18

      Peacock      19

      Buchanan     20

      Suyama       21

      King         22

      Callahan     23

      Dodsworth    24

      Hellstern    25

      Smith        26

      Patterson    27

      Brid         28

      Martin       29

      Pereira      30

In this case, Microsoft Access runs the expression twice, once to

create the dynaset and again to check the criteria you specified.

REFERENCES

==========

For more information on creating custom counters for forms and queries,

query on the following words here in the Microsoft Knowledge Base:

   custom and counter

Additional reference words: 1.00 1.10 2.00 top 20 limit counter

KBCategory:

KBSubcategory: QryTotal


INF: Obtain Name of Current User Database Using Access Basic

Article ID: Q89681

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 1.x does not have a built-in way to determine the

name of the database that the user currently has open. This article lists a

sample Access Basic function you can use in Microsoft Access 1.x to find

the name of the database.

In Microsoft Access version 2.0, you can find the name of the database

using data access objects (DAO). With DAO, you can use the Name property of

the DBEngine object to find the path and name of the currently open

database. For more information on the DBEngine object, search for

"DBEngine" then "DBEngine Object" using the Microsoft Access 2.0 Help menu.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

Although you can obtain the object variable of the current user

database using the CurrentDB() function, you are unable to obtain the

text representation of the database name. The example provided shows

how a user-defined function called GetUserDBName() obtains a text

representation of the user database name.

The GetUserDBName() function returns the name of the database with no

path or extension. You must add your own path or extension string to

the result of the GetUserDBName() function when necessary.

NOTE: The code to determine the current database does not work with

run-time versions of Microsoft Access (MSARN110.EXE).

1. Enter the sample code listed below into a module.

2. From the Immediate window of the module, type the following, and then

   press ENTER:

      ?GetDBName()

The name of the database will be returned.

Sample Module Code

------------------

Notes:

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

 - You may have some Microsoft Windows API functions defined in an existing

   Microsoft Access library; therefore, your declarations may be

   duplicates. If you receive a duplicate procedure name error message,

   remove or comment out the declarations statement in your code.

Option Compare Database   'Use database order for string comparisons

Option Explicit

Declare Function GetWindow% Lib "USER" Alias "GetWindow" _

                 (ByVal hwnd%, ByVal Relationship%)

Declare Function GetClassName% Lib "USER" Alias "GetClassName" _

                 (ByVal hwnd%, ByVal ClassName$, ByVal Size%)

Declare Function GetWindowText% Lib "User" Alias "GetWindowText" _

                 (ByVal hwnd%, ByVal StringText$, ByVal wInt%)

Declare Function GetActiveWindow% Lib "USER" Alias _

                 "GetActiveWindow" ()

Declare Function GetParent% Lib "USER" Alias "GetParent" (ByVal hwnd%)

Const GW_HWNDNEXT = 2

Const GW_CHILD = 5

Const AccessDBC = "ODb"

Const AccessMDICLIENT = "MDIClient"

Const ACCESSMain = "OMain"

Function GetDBName ()

   Dim hwnd As Integer

   Dim ClassName As String, ClassLen As Integer

   Dim Caption As String, CaptionLen As Integer

   Dim Start As Integer, fMDIClient As Integer

   Dim RetVal

   '

   ' Get the handle to the Access window

   '

   hwnd = GetActiveWindow()

   ClassName = Space(127)

   ClassLen = GetClassName(hwnd, ClassName, Len(ClassName))

   While ((Left$(ClassName$, ClassLen) <> "OMain"))

      hwnd = GetParent(hwnd)

      ClassLen = GetClassName(hwnd, ClassName, Len(ClassName))

   Wend

   '

   ' Traverse the children looking for the 'MDIClient' child

   '

   hwnd = GetWindow(hwnd, GW_CHILD)

   Do While hwnd And Not fMDIClient

      ClassLen = GetClassName(hwnd, ClassName, Len(ClassName))

      If Left$(ClassName, ClassLen) = "MDIClient" Then

         fMDIClient = True

      Else

         hwnd = GetWindow(hwnd, GW_HWNDNEXT)

      End If

   Loop

   '

   ' Traverse children until we find the Database Window 'ODb' child

   ' .. which has a title of "Database: <app name>"

   '

   hwnd = GetWindow(hwnd, GW_CHILD)

   Do While hwnd

      ClassLen = GetClassName(hwnd, ClassName, Len(ClassName))

         ClassName = Mid$(ClassName, 1, ClassLen)

         If Left$(ClassName, ClassLen) = "ODb" Then

            Caption = Space$(127)

            RetVal = GetWindowText(hwnd, Caption, Len(Caption))

            Start = InStr(Caption, ":") + 2

            GetDBName = Mid$(Caption, Start)

            Exit Function

         End If

         hwnd = GetWindow(hwnd, GW_HWNDNEXT)

   Loop

   GetDBName = "Not Found"

End Function

Additional reference words: 1.00 1.10 2.00 DDE dbname

KBCategory:

KBSubcategory: PgmOthr


INF: ODBC Setup for Microsoft Access and SQL Server

Article ID: Q88173

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft SQL Server versions 1.10, 1.11, and 4.20 for MS-DOS

   and Microsoft OS/2, and Microsoft SQL Server for Windows NT

 - Microsoft SQL Administrator versions 4.20 and 4.21 for Windows

 - Microsoft ISQL for Windows version 4.21

---------------------------------------------------------------------

SUMMARY

=======

The installation of Microsoft ODBC for Microsoft and Sybase SQL Server

requires the use of ISQL command line procedures to properly run the

INSTCAT.SQL script.

If INSTCAT.SQL has not been properly implemented in SQL Server,

the following error will be displayed while attaching a SQL table

in Microsoft Access:

   [Microsoft][ODBC SQL Server Driver] The ODBC catalog stored

   procedures installed on server <server_name> are version xx.xxxx;

   version xx.xx.xxxx is required to ensure proper operation.  Please

   contact your system administrator.

MORE INFORMATION

================

To properly configure SQL Server for use with Microsoft ODBC, you must run

the SQL script file INSTCAT.SQL (shipped on the ODBC disk in Microsoft

Access version 1.x and on disk 1 in Microsoft Access version 2.0) to set up

the proper stored procedures that provide catalog information used by

Microsoft ODBC.

NOTE: Microsoft SAF for MS-DOS and OS/2 is limited to 511 lines of code in

a SQL script. INSTCAT.SQL has well over 511 lines of code.

Microsoft SQL Administrator version 4.20 will open the INSTCAT.SQL script,

but you will not be able to run it.  This is because version 4.20 of the

SQL Administrator does not recognize the GO command used in INSTCAT.SQL.

This has been corrected in the SQL Administrator version 4.21.

In Microsoft SQL Server version 4.20a or earlier, the proper way to install

the catalog stored procedures using INSTCAT.SQL is to run INSTCAT.SQL from

the command line using the SQL Server utility ISQL (Interactive SQL).  If

you are using Microsoft SQL Server version 4.20b for OS/2 or Microsoft SQL

Server for Windows NT, you can  run the INSTCAT.SQL script from within

either ISQL/w (Interactive SQL for Windows), or Microsoft SQL Administrator

for Windows version 4.21.

Note that in order to run the INSTCAT.SQL script, you must connect

to your SQL Server as the System Administrator, or SA.

The ISQL facility is run from either the MS-DOS or OS/2 command

prompt. The syntax for this procedure is:

NOTE: In the following example, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this

example.

   isql /U <sa login name> /n /P <password> /S <SQL server name> /i_

   <drive:\path\INSTCAT.SQL> /o <drive:\path\output file name>

Below are descriptions of the command line switches:

   /U    The login name for the system administrator

   /n    Eliminates line numbering and prompting for user input

   /P    Password used for the system administrator (case sensitive)

   /S    The name of the server to set up

   /i    Provides the drive and fully qualified path for the location of

          INSTCAT.SQL

   /o    Provides isql with an output file destination for results or

         the process including errors

Example

-------

   isql /U sa /n /P skier /S DUMMY_SERVER /i d:\SQL\INSTCAT.SQL /o_

   d:\SQL\output.txt

After you run INSTCAT.SQL, you should run the RECONFIGURE command

against the MASTER database using SAF. See pages 205-212 of the

Microsoft SQL "Administrator's Guide," version 4.2, for more

information.

NOTE: This information is available in the Microsoft Access README.TXT

file.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: ObcOthr


INF: OpenDatabase and CloseDatabase Pseudo Actions

Article ID: Q100148

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access includes two "pseudo actions," or dynamic data exchange

(DDE) commands, called OpenDatabase and CloseDatabase. These commands are

available through the DDE SYSTEM topic, and allow you to open and close

Microsoft Access databases over a DDE channel.

MORE INFORMATION

================

The syntax for the OpenDatabase and CloseDatabase pseudo actions is

   OpenDatabase <Database_Location>

   CloseDatabase

where <Database_Location> is the path and filename of the Microsoft

Access database to be opened. The CloseDatabase action does not take a

parameter since Microsoft Access can have only one database open at a

time.

The following sample Microsoft Excel macro demonstrates how the

OpenDatabase and CloseDatabase pseudo actions work.

NOTE: This macro will not work with Microsoft Access version 1.0.

1. Start Microsoft Access (Microsoft Access must already be running

   in order for this macro to work).

2. Open a new macro sheet in Microsoft Excel. Enter the following

   macro:

      Cell    Command

      -------------------------------------------------

      A1      PseudoOpenCloseDDEExample

      A2

      A3      chan=INITIATE("MSACCESS","SYSTEM")

      A4      =APP.ACTIVATE("Microsoft Access",FALSE)

      A5      =EXECUTE(chan,"[opendatabase nwind.mdb]")

      A6      =EXECUTE(chan,"[Sample AutoExec]")

      A7      =EXECUTE(chan,"[closedatabase]")

      A8      =TERMINATE(chan)

      A9      =APP.ACTIVATE(,FALSE)

      A10     =RETURN()

3. Size your Microsoft Access and Microsoft Excel windows so that you

   can view both applications at the same time.

4. Select cell A3. From the Macro menu, choose Run, and then choose

   OK.

The commands in cells A3 and A4 initiate a DDE channel to Microsoft

Access on the SYSTEM topic and activate the Microsoft Access

application.

The command in cell A5 opens the sample database NWIND.MDB in the

current working directory, using the OpenDatabase pseudo action.

The command in cell A6 runs the Sample AutoExec macro in the NWIND.MDB

database.

The command in cell A7 closes the currently opened database file using

the CloseDatabase pseudo action.

The commands in cells A8-A10 terminate the DDE channel, activate the

Microsoft Excel application, and end the macro.

REFERENCES

==========

For more information on using macro actions in DDE, query on the

following words here in the Microsoft Knowledge Base:

   dde and macro and action

Additional reference words: 1.00 1.10 2.00 OLE/DDE server

KBCategory:

KBSubcategory: IntpOthr


INF: Opening Databases as Read-Only Causes Error Message

Article ID: Q88649

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You receive the error message

   Database '<databasename>' is read-only. You won't be able to save

   changes made to data or object definitions in this database"

when you open a database.

MORE INFORMATION

================

This error occurs if you open a database under the following three

conditions:

 - The file is read-only, whether or not its file attribute is set to

   read-only.

 - The directory in which the file resides is also read-only.

 - You are using the /Ro command line parameter.

Note that when a database is opened as read-only, an .LDB file is never

created.

The only workaround currently available is to implement security measures.

Instead of physically opening the file as read-only, open all objects in

the database as read-only. The procedures to implement database security

are outlined in:

 - Microsoft Access "User's Guide," version 1.0, chapter 25

 - Microsoft Access "User's Guide," version 2.0, chapter 14

Additional reference words: 1.00 1.10 2.00 WinIss errmsg

KBCategory:

KBSubcategory: EvnOs


INF: OpenTable Method on Attached Table Causes Error

Article ID: Q109711

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Since an attached table does not actually exist in the current database, it

cannot be opened with Access Basic code as a table object from the current

database. Trying to do so will generate the following error message:

   Can't perform operation; it is illegal.

   -or-

   Invalid operation.

MORE INFORMATION

================

If the attached table is a Microsoft Access table and does not use an ISAM

driver (such as the dBASE, Paradox, Btrieve, or Fox ISAM) or an ODBC

driver, you can first use the OpenDatabase method to open the database that

contains the attached table. Then, you can use the OpenTable method to open

the table. This technique is demonstrated in the sample code below:

   Dim MyDB as Database

   Dim MyTable as Table

   Set MyDB = OpenDatabase("NWIND.MDB")

   Set MyTable = MyDB.OpenTable("Employees")

If the table uses an ISAM or ODBC driver, you must use the CreateDynaset

method instead. The following example demonstrates this method. In this

example, dbo_Authors is an attached SQL Server table:

   Dim MyDB as Database

   Dim MySet as Dynaset

   Set MyDB = CurrentDB()

   Set MySet = MyDB.CreateDynaset("dbo_Authors")

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. From the File menu, choose Attach Table.

3. In the Data Source box, select dBASE III, and then choose OK.

4. In the File Name box, select NEWCUST.DBF, and then choose Attach.

5. In the Select Index Files dialog box, choose Close. Choose OK in the

   confirmation dialog box. In the Select File dialog box, choose Close.

6. Create a new module with the following sample code:

      '***********************************************************

      'Declarations section of the module

      '***********************************************************

      Option Explicit

      '============================================================

      ' This function will set the database to the current database

      ' and try to open an attached table.

      '============================================================

      Function AttachTest()

         Dim MyDB as Database

         Dim MyTable as Table

         Set MyDB = CurrentDB()

         Set MyTable = MyDB.OpenTable("NEWCUST")

      End Function

7. Type the following in the module's Immediate window, and press ENTER:

      ? AttachTest()

An error message will appear. To correct the problem, use the CreateDynaset

method rather than the OpenTable method.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 8,

"Manipulating Data," pages 97-138

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Overview of Conversion Issues from Version 1.1 to 2.0

Article ID: Q112120

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you convert your Microsoft Access version 1.x databases to version 2.0

format, you may have to make some modifications to make sure your databases

will perform correctly.

MORE INFORMATION

================

There are some differences in the formats of Microsoft Access version 1.x

and version 2.0 databases. These differences may cause unexpected results

when you are using converted databases. Details of the database format

changes from version 1.x to 2.0 are listed in Appendix C of the Microsoft

Access 2.0 "Building Applications" manual.

The Convert Database command on the File menu, available only when you do

not have a database open, can be used to convert databases from version 1.x

format to version 2.0 format. When you convert a database from version 1.x

to version 2.0 format, all database objects are converted. The following

sections describe how the various database objects are converted:

Tables

------

Tables are automatically converted to version 2.0 database format. Tables

that were attached in version 1.x can still be used, but you should refresh

all attachments to take advantage of Microsoft Access 2.0's ability to send

conversion functions (such as CLng(), CStr(), and so on) to the server

rather than processing them locally.

Use the Attachment Manager Add-in in Microsoft Access 2.0 to refresh all

the attachments, rather than deleting and re-attaching each attachment as

in Microsoft Access 1.x. If an attachment is deleted, all the properties

set in the current database for that attachment are lost. To use the

Attachment Manager Add-in, choose Add-ins from the File menu, then choose

Attachment Manager.

Queries

-------

Microsoft Access automatically compiles queries before running them. The

first time you run a query in version 2.0, the compiled format of the query

will be discarded and it will be recompiled. Then, the new compiled format

will automatically be saved.

Forms and Reports

-----------------

Forms and reports are converted temporarily into memory as they are opened.

As a result, you can gain a small performance increase if you open and then

resave all of your pre-existing forms and reports in Microsoft Access

version 2.0, so that Microsoft Access does not have to convert them as you

use them.

Macros

------

Macros are not converted. The format for macros is not changed in

Microsoft Access version 2.0.

Modules

-------

The internal format of modules is changed in Microsoft Access version 2.0.

Version 2.0 automatically converts modules when they are loaded into

memory. However, the converted code is not saved until you save the module.

For that reason, you are prompted to save a converted module the first time

you close it whether you make changes to it or not. If the converted module

is not saved, the conversions are lost. This prompt occurs every time an

unconverted module is closed until you save it.

Default Values and Validation Rules

-----------------------------------

Some default value expressions and validation rules, valid in version

1.x databases, may not be valid in version 2.0 databases.

In Microsoft Access version 2.0, validation rules are evaluated starting at

the table level. Validation rules in forms or elsewhere are evaluated in

addition to table-level validation. At the table level, version 2.0 does

not allow the following in validation rules:

 - User-defined functions

 - Microsoft Access domain functions, such as DCount()

 - Total (aggregate) functions, such as Sum()

 - References to other fields for field validation (for record

   validation, references to other fields in the table are allowed)

 - CurrentUser() or Eval() functions

During the conversion process, a table named ConvertErrors will be

created and filled with descriptions of any default value expressions

or validation rules that were not converted. It may be necessary to

check all data objects for "#Name?" errors.

Changes to Reserved Words and Function Names

--------------------------------------------

There are many new reserved words and function names. "Reserved" means that

the word or function name has special significance to Microsoft Access

version 2.0 and cannot be used as a user-specified control name, function

name, and so on. The Microsoft Access Help system and Appendix C of the

Microsoft Access 2.0 "Building Applications" manual lists new reserved

words. General rules include:

 - Form controls cannot have the name "form." Also, a report control

   cannot have the name "report."

 - Controls in a form or report cannot have the same name as a

   section.

 - Object names that conflict with reserved words can be qualified by

   enclosing the object name with square brackets, such as:

   "[Move].visible" instead of "Move.visible".

SendKeys Action or Statement

----------------------------

If you use the SendKeys statement or action to fill in dialog boxes or

choose commands from menus, the changes in some version 2.0 dialog boxes

and menus may require you to recode the statement. Because changes are

likely to occur with each version of Microsoft Access, it is a good idea to

try to avoid using SendKeys when possible. See Appendix C of the "Building

Applications" manual for tips on avoiding the use of SendKeys.

Security

--------

If a version 1.x database is secured, it will remain secure whether it is

opened using version 1.x or version 2.0. However, Microsoft Access 2.0

cannot be used to change or add permissions in the database, even by the

administrator, until the database is converted to version 2.0.

When you install Microsoft Access 2.0 it creates its own workgroup

file (SYSTEM.MDA). If Microsoft Access version 2.0 is installed in the

same directory as version 1.x, the version 1.x SYSTEM.MDA file will be

renamed SYSTEM1X.MDA.

To make changes to the security of a converted database, you must use a

version 2.0 SYSTEM.MDA that has identical groups and users (and identical

PIDs) as the original SYSTEM.MDA.

NOTE: PIDs (Personal IDs) in Microsoft Access version 2.0 are the

equivalent of PINs (Personal ID Numbers) in version 1.x.

How to Create a Secure Workgroup:

1. Use the Workgroup Administrator tool to create a new workgroup.

   This is a version 2.0 SYSTEM.MDA file.

2. Re-create all the users and groups using the same names and PIDs

   that were used in Microsoft Access version 1.x.

How to Convert a Secure 1.x Database to 2.0 Format:

NOTE: In a secure workgroup, only users with Modify Design permissions to

all of the objects can convert a version 1.x format to version 2.0 format.

Also, you must assign Modify Design permissions to the version 1.x database

in Microsoft Access version 1.x using the version 1.x workgroup.

1. Make sure that no one is using the version 1.x database.

2. Log on to Microsoft Access 2.0 as a member of the Admins group who is

   not the Admin user.

3. From the File menu, choose the Convert Database command.

4. Select the version 1.x database you want to convert. You will be

   prompted for the version 2.0 database name.

   NOTE: The Convert Database command will force you to choose a new name

   for the database. This lets you keep a backup copy of your version 1.x

   database, as once you have converted a database from version 1.x to

   version 2.0 you CANNOT convert it back to version 1.x.

5. Have your users join the new version 2.0 workgroup (SYSTEM.MDA) by

   using the Workgroup Administrator tool.

   NOTE: You can also accomplish this by modifying the MSACC20.INI file

   in your Windows directory. In the [Options] section of the file,

   change the SystemDB entry to point to the version 2.0 SYSTEM.MDA

   file. The [Options] section of the file will be similar to the example

   below:

      [Options]

      SystemDB=<microsoft access path>\SYSTEM.MDA

Verifying Conversion

--------------------

To determine if a database was converted from Microsoft Access version 1.x

to version 2.0 with the Convert Database command correctly, check the

V1xNullBehavior property. This property is not available if the database

was converted by Access Basic code. It is available only if the database

was converted using the Convert Database command on the File menu.

The sample function below uses the V1xNullBehavior property to determine if

a database was converted from Microsoft Access version 1.x to version 2.0

with the Convert Database command. The flag variable IsConverted holds the

function's result. If IsConverted is True (-1,) then the database was

converted with the Convert Database command.

   Function IsConverted (checkdb As String)

      On Error GoTo NotFound

      Dim MyDatabase As Database, V1xNull As Integer

      Set MyDatabase = DBEngine.Workspaces(0).OpenDatabase(checkdb)

      V1xNull = MyDatabase.properties.V1xNullBehavior

      IsConverted = True

      MyDatabase.Close

      Exit Function

   NotFound:

      If Err = 3024 Then

         MsgBox "Could not find database."

      Else

         IsConverted = False

         MyDatabase.Close

      End If

      Exit Function

   End Function

To use this function, type the following in a module's Immediate window,

and then press ENTER:

   ? IsConverted("<yourdatabasename>.MDB")

Note that a native version 2.0 database will return a 0 when used with this

function.

To check which version of Microsoft Access a SYSTEM.MDA file was created

with, use the following sample Access Basic function:

   Function CheckSysDbVer (sysdbname As String) As String

      Dim d As Database

      Set d = DBEngine(0).OpenDatabase(sysdbname)

      CheckSysDbVer = d.version

      d.Close

   End Function

To use this function, type the following in a module's Immediate window and

then press ENTER:

   ? CheckSysDbVer("<microsoft access path>\SYSTEM.MDA")

Conversion Errors

-----------------

If the process of converting a 1.x database to version 2.0 results in any

unexpected errors or problems, such as a general protection (GP) fault or

Microsoft Access closing itself, try running the Repair command (from the

File menu) in Microsoft Access version 1.x on the version 1.x database.

Then, try to convert the database again. Some version 1.x databases may

have slight errors that go undetected until you try to convert the database

in version 2.0, because version 2.0 is better at detecting database

problems.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 1

Microsoft Access "Building Applications," version 2.0, Appendix C

For more information about converting databases, search for "Convert

Database" then "Convert Database Command" using the Microsoft Access Help

menu.

Additional reference words: 2.00 permission upgrading upgrade

KBCategory:

KBSubcategory: StpOthr


INF: Overview of MS Access Developer's Toolkit (ADT) v. 2.0

Article ID: Q112137

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Microsoft Access Developer's Toolkit (ADT) version 2.0 is the upgrade

to the Microsoft Access Distribution Kit (ADK) version 1.1, and complements

the retail version of Microsoft Access version 2.0. Developers can use the

ADT to assist them in developing advanced database applications, creating

client/server solutions, and developing Wizards and other add-ins for

Microsoft Access.

MORE INFORMATION

================

The ADT provides a run-time version of Microsoft Access 2.0 and tools to

assist the developer with the creation and distribution of applications

developed using the retail version of Microsoft Access 2.0. The retail

version of Microsoft Access 2.0 is not included with the ADT, but can be

purchased separately.

The ADT includes a run-time version of Microsoft Graph for distributing

graphs and charts with applications, the Microsoft Windows Help compiler

for creating custom Help files, and a Setup Wizard for creating customized

Setup programs. Code samples for Wizards, functions, and other utilities

are also included and can be copied and pasted directly into applications.

Detailed technical documentation and customization tools are provided,

including the Access Basic "Language Reference" manual, and the "Advanced

Topics" manual, which addresses client/server development, connecting to

external data sources, and using data access objects (DAO). In addition,

there are sample OLE custom controls including calendar, scroll bar and

data outline controls.

The Microsoft Access Developer's Toolkit version 2.0 is scheduled to be

available through resellers or direct from Microsoft in the early spring of

1994 with a suggested retail price of $495. For the product's first 90

days, current Microsoft Access Distribution Kit 1.1 and Microsoft Visual

Basic 3.0 for Windows users will receive $100 off the suggested retail

price with an on-box rebate coupon.

Additional reference words: 2.00 executable runtime

KBCategory:

KBSubcategory: NpdOthr


INF: Overview of New Query Features in Version 2.0

Article ID: Q112136

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article summarizes the new query features and functionality in

Microsoft Access version 2.0. This information can also be found using the

Microsoft Access Help menu by searching for "What's New in Microsoft Access

Version 2.0."

MORE INFORMATION

================

Rushmore Query Optimization

---------------------------

Microsoft Access uses an optimization method similar to that used by

Microsoft FoxPro to speed up many types of queries.

Automatic Joins for Fields with the Same Name

---------------------------------------------

Even if you have not defined relationships between tables, Microsoft Access

automatically creates joins in a query between tables containing matching

fields.

Greater Updatability of Query Fields

------------------------------------

When a query includes fields from more than one related table, you can

update data on both sides of the join in the same query.

New Query Properties and Property Sheet

---------------------------------------

With the new query properties, you can add input masks and formats to your

queries, and you can limit the number of records displayed to a specified

value. Query properties can be set in the property sheet.

Query Datasheet Formatting

--------------------------

As with tables and forms, you can save your datasheet layout in queries.

For example, if you freeze a column in a query datasheet, you can save the

layout so it will appear the same way when you run the query again.

Subqueries

----------

You can use SQL SELECT statements as subqueries within your expressions in

the Criteria row of the Query window.

Union and Data-Definition Queries

---------------------------------

Using SQL in Microsoft Access, you can create union queries and queries

that create, change, or delete tables and indexes in Microsoft Access

databases. Use the SQL Specific command on the Query menu in a query's

Design view to create these types of queries.

Improved SQL View Window

------------------------

You can enter any SQL statement in the improved SQL View window, including

statements that you cannot create in the query's QBE grid. The menu and the

toolbar buttons are also available when you are working in a SQL View

window.

SQL Pass-Through

----------------

You can pass SQL statements directly to SQL databases, providing improved

connectivity in client-server relationships. You can use SQL pass-through

queries as the source for a query, form, or report.

REFERENCES

==========

For more information about queries, search for "queries: <option>" then

view each of the topics using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: QryOthr


INF: Overview of Version 2.0 Add-Ins, Builders, and Wizards

Article ID: Q112751

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article is an overview of the add-ins, builders, and Wizards in

Microsoft Access version 2.0. Listed below is the name of each add-in,

builder, and Wizard, and a brief description of its purpose.

MORE INFORMATION

================

Name                      Description of Purpose

--------------------------------------------------------------------

Add-In Manager            Used to install, uninstall, or customize

                          add-ins, builders, and Wizards.

Add-Ins                   File menu command to control any current

                          add-in, builder, or Wizard.

Archive Query Wizard      Creates a query that will copy records

                          from one table into another, new table.

Attachment Manager        Used to view or refresh the links to

                          attached tables.

AutoDialer                Used by Microsoft Access to dial a

                          selected phone number.

AutoForm                  Creates a form based on the

                          currently selected table or query.

AutoReport                Creates a report based on the

                          currently selected table or query.

Code Builder              Displays the Module window, where you

                          create or modify a procedure for an

                          event.

Color Builder             Creates custom colors, or you can

                          select colors in the palette.

Combo box Wizard          Creates a combo box on a form or report.

Command button Wizard     Creates a command button with built-in

                          bitmaps and code.

Crosstab Query Wizard     Creates a query that will summarize

                          data in row and column format.

Database Documentor       Used to print a list of design elements

                          of your database objects.

Expression Builder        Creates expressions using functions,

                          operators, constants, and so on.

Field Builder             Adds a new field to a table's design

                          from a list of tables and fields.

Find Duplicates           Creates a query that will find duplicate

Query Wizard              records in a table or query.

Find Unmatched            Creates a query to find records that

Query Wizard              do not match in other tables or queries.

Graph Wizard              Creates a form containing a graph or

                          creates a graph in an existing form or

                          report.

Groups/Totals             Creates a report that groups and

Report Wizard             aggregates values in tabular format.

Import Database Add-in    Imports all the objects from another

                          Microsoft Access database.

Input Mask Wizard         Adds an input mask to a field in a

                          table or query or a text box on a form.

List box Wizard           Creates a list box on a form or report.

Macro Builder             Creates a new macro where you select from

                          47 actions for an event.

Mailing Label             Creates a report used to make mailing

Report Wizard             labels.

Main/Subform Wizard       Creates a form based on one or more

                          tables or queries.

Menu Builder              Used to create a menu bar that you can

                          attach to a form or report.

Microsoft Word Mail       Merges Microsoft Access data

Merge Wizard              with a Word for Windows document.

ODBC Connection           Creates a connection string to gain

String Builder            access to a backend server.

Option Group Wizard       Creates an option group on a form or

                          report.

Picture Builder           Used to add a picture to a command

                          button or toggle button.

Query Builder             Design or modify a query that is the

                          source for a form, report, list box,

                          combo box, graph, or object frame.

Single-Column Form        Creates a form that displays the

Wizard                    contents of each record in a column.

Single-Column Report      Creates a report that displays the

Wizard                    contents of each record in a column.

Summary Report Wizard     Similar to the Groups/Totals Report

                          Wizard but without detail lines.

Table Wizard              Assists you in creating a table by

                          offering over 40 sample tables.

Tabular Form Wizard       Creates a form that displays record

                          values in columns from left to right.

Tabular Report Wizard     Creates a report that displays record

                          values in columns from left to right.

Wizards Customizer        Customizes add-ins, builders, and Wizards.

Zoom box                  Zooms the contents of an input area

                          using SHIFT+F2.

REFERENCES

==========

For more information about Microsoft Access 2.0 add-ins, builders, and

Wizards, search for "Wizards: reference" then "Builders, Wizards, and Add-

ins" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: GnlOthr


INF: Page Header Will Span Full Width Of Multi-Column Report

Article ID: Q90870

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can design a report in Microsoft Access that has a page header

that spans the entire width of the page, a group section header that

is the width of a column, plus has a multiple-column detail section.

To do this, the columns are defined in the Print Setup box as either

Vertical (also called snaking columns,) or Horizontal. This article

describes the steps to create a report with 3 across, 2 inch wide

snaking columns.

MORE INFORMATION

================

To create a grouped, multiple-column report where the page header

spans the width of the page, follow these steps:

 1. In report Design view, drag the right edge of any report section to

    the desired width of the report. For this example, drag the edge over

    to the 7 inch mark on the ruler.

 2. Choose Sorting and Grouping from the View menu and enter a field

    or expression in the Field/Expression box to group your data by.

 3. In the Group Properties section of the Sorting and Grouping dialog

    box, enter 'Yes' for Group Header.

 4. Using the Toolbox, create a Label and place it in the Page Header

    section. Enter the text for the label in the Caption property. Size

    the text box so it is the same width as the Page Header section.

 5. Using the Toolbox, create a text box bound to the group field. Place

    the text box in the Group Header. Size this control 2 inches wide

    or less, and place the left edge of the box along the left edge of

    the group section.

 6. In the detail section place your bound control(s) within the first

    2 inches.

 7. From the File menu, choose Print Setup.

 8. In the Print Setup dialog box, choose the More button.

 9. In the Items Across box, type the number of columns you want in the

    detail section. For this example, enter 3. Leave row and column

    spacing as they are.

10. In the Item Size section, clear the Same as Detail check box.

11. In the Width box, type the number of inches you want to allow for

    each column of data. For this example, enter 2.

12. Under Item Layout, select Vertical. This creates a snaking column

    report.

13. Choose OK.

14. Click on the group Header Section and display the property sheet.

    For the "New Row Or Col" property, choose Before Section. This

    causes the group header to print at the top of the column one time

    for each new group.

15. Print or Preview the report.

REFERENCES

==========

For other articles describing how to print the group header at the

top of continued columns, search in this Knowledge Base for:

   print and group's and name and subsequent and column and page

Microsoft Access "User's Guide," version 1.0, chapter 18, "Designing

Reports," and chapter 19, "Sorting and Grouping Data"

For additional information on columnar reports, search for "Multiple-

column reports" and "NewRowOrCol" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 columns snake checkpage

KBCategory:

KBSubcategory: RptLayou


INF: Page Locking, No Cluster Indexing Support

Article ID: Q96892

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Cluster indexing and row level locking are not possible with Microsoft

Access, unless you are using an attached table.

MORE INFORMATION

================

These features are not supported because of the variable-length

architecture. When using an attached table, Microsoft Access uses the

same locking scheme as does the native product. When you are using the

installable ISAMs for dBASE, Paradox, and Btrieve, you will do record-

level locking. The Paradox ISAM even understands the clustered indexes

and takes advantage of these indexes in some queries.

The following products are manufactured by vendors independent of

Microsoft: Btrieve by Novell, Inc., dBASE by Borland International,

Inc., and Paradox by Borland International. We make no warranty, implied

or otherwise, regarding these products' performance or reliability.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlMu


INF: Paradox 4.x OLE Field Names Visible Only

Article ID: Q114167

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you import or attach a Paradox version 4.x table, OLE field names in

the Paradox table will be visible in Microsoft Access, but the data in the

OLE fields will not be visible.

MORE INFORMATION

================

Microsoft Access version 2.0 cannot import, edit, or view Paradox 4.x OLE

objects, or export Microsoft Access OLE objects to Paradox's OLE format.

This behavior is due to differences in the way Microsoft Access and Paradox

store OLE object header information. If you add a record to an attached

Paradox 4.x file, OLE fields in that record will be null.

Note that Microsoft Access also does not support the following Paradox MEMO

types:

 - BINARY (type B)

 - FORMATTED (type F)

 - GRAPHIC (type G)

When you import data from a Paradox table, the data will be converted as

follows:

   Paradox Data Type      Microsoft Access 2.0 Data Type

   -----------------------------------------------------------------

   Alphanumeric           Text

   Number                 Number (FieldSize property set to Double)

   Short Number           Number (FieldSize property set to Integer)

   Currency               Number (FieldSize property set to Double)

   Date                   Date/Time

   Memo                   Memo

   OLE                    OLE (Field name visible, but not the data)

Paradox is manufactured by Borland International Inc., a vendor independent

of Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

REFERENCES

==========

For more information about the conversion of Paradox data types to

Microsoft Access data types, search for "importing data: basics" then

"Importing and Attaching Paradox Tables" using the Microsoft Access Help

menu.

Also, see the "Using Microsoft Access Version 2.0 with Other Software"

topic, "Using Microsoft Access with Paradox Databases" subtopic, in the

ACREADME.HLP Help file.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IntpOthr


INF: Paradox Tables, Indexes, and Multiple Connections

Article ID: Q90152

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If a Paradox table does not have a primary key, then it cannot be

opened twice, even exclusively. This means it cannot be used in more

than one place in a query or in code.

MORE INFORMATION

================

If you try to attach a Paradox table that has no primary key, you

will get an error stating that the operation is not supported on

Paradox tables without a primary key. This can be confusing, because

you can create the query that accesses the table twice, but if you try

to use it, you will get this error. In addition, if anyone tries to

get the output column list of the query, this error will occur.

Additional reference words: 1.00 1.10 2.00 index

KBCategory:

KBSubcategory: IsmPdox


INF: Part 1: DDE in Visual Basic to Request MS Access Data

Article ID: Q98791

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to use Microsoft Visual Basic to request

data from Microsoft Access using dynamic data exchange (DDE).

For information that goes into greater detail and demonstrates how to

parse the requested data in a Visual Basic array and then populate a

grid control with the data, query on the following words in the

Microsoft Knowledge Base:

   dde and vb and part two

MORE INFORMATION

================

This article provides a Visual Basic code example demonstrating how to

request information from the Employees table in the sample database

NWIND.MDB.

The following code example demonstrates how to fill a Visual Basic

text box with the entire contents of an Microsoft Access table,

including field names.

In Visual Basic, create a new form, add the following controls, and

set the appropriate properties for each control:

   Text Box

   --------

      Name:       Text1

      Multiline:  True

      Scrollbars: 3 - Both (vertical and horizontal)

   Command Button

   --------------

      Name:       Command1

NOTE: Size the text box large so that data can be seen and scrolled

easily following the DDE request.

Double click the command button and enter the following code between

the "Sub Command1_Click ()" and "End Sub" lines:

   Sub Command1_Click()

      Text1.LinkTopic = "MSACCESS|NWIND;TABLE Employees"

      Text1.LinkMode = 2     ' Establish a manual DDE link to Access

      Text1.LinkItem = "All" ' Setup the DDE request item to get ALL the

                             ' .. data from the Employees table,

                             ' .. including field names.

      Text1.LinkRequest      ' Request the data into the Text1 text box

      Text1.LinkMode = 0     ' Terminate the DDE link to Access

   End Sub

In this example, the first line specifies "MSACCESS" as the

application to communicate with and "NWIND;TABLE Employees" as the

topic of the DDE conversation. We could also specify an SQL statement

as the topic of the conversation. The following line of code is

functionally equivalent to the first line above:

   Text1.LinkTopic = "MSACCESS|NWIND;SQL Select * From Employees;"

In this example, the item "All" tells Microsoft Access to supply

Visual Basic with the entire contents of the Topic, including field

names. Microsoft Access supports a rich set of other items and topics.

For a list of supported topics and items, query on the following words

in the Microsoft Knowledge Base:

   dde and server and topics

When you run this example, be sure that Microsoft Access is running

and has the NWIND database opened.

When you run this code, the text box will be filled with the entire

contents of the Employees table. Each field will be delimited by a tab

character, Chr$(9), and each record row will end with a newline

character (a carriage return followed by a linefeed character).

Additional reference words: 1.00 1.10 2.00 vb b_vbasic

KBCategory:

KBSubcategory: IntpDde


INF: Part 2 DDE in Visual Basic to Request Data from MS Access

Article ID: Q99405

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This is the second in a series of two articles containing an advanced

example that demonstrates how to use Visual Basic to request data from

Microsoft Access by using dynamic data exchange (DDE).

MORE INFORMATION

================

The following Visual Basic example demonstrates how to use DDE to

request information by using SQL statements and the rich set of items

supported by Microsoft Access to navigate tables. Further, a

subroutine that assists in parsing data from the tab-delimited records

that are requested is provided.

Specifically, the example does the following:

1. Gets the number of records and fields in the table using the

   "FirstRow" and "FieldCount" items.

2. Creates an array to store the records when they are retrieved.

3. Requests the data from a table, one record at a time, using the

   "FirstRow" and "NextRow" items.

4. Requests a list of field names using the "FieldNames" item.

5. Uses a subroutine to parse each tab-delimited record requested from

   Microsoft Access and places the data in the array mentioned above. (A

   separate array holds the field names).

6. This step is optional. Once all the data is placed in the array, a

   Visual Basic grid control will be populated with the array contents.

   Further, the grid columns will be populated with the names of the

   fields.

When you run this example, be sure that Microsoft Access is running and the

sample database NWIND.MDB is open.

To use this example, create a new Visual Basic program with a text

box, a command button, and a grid control with the following

properties:

   Text Box

   --------

      Name: Text1

   Command Button

   --------------

      Name: Command1

   Grid

   ----

      Name: Grid1

NOTE: The grid control is available in the Professional Toolkit for

Visual Basic version 1.0 and ships with version 2.0 of the

Professional Edition of Microsoft Visual Basic for Windows.

Double-click the command button and type the code that follows between

the Sub Command1_Click () and End Sub lines.

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

   Dim CntRows, CntCols As Integer ' Row and column count in the table

   Dim Row, Col As Integer         ' Current row/column being filled.

   Dim Record As String            ' Record read from employees table.

   ' Get the number of records in the Employees Table

   Text1.LinkTopic = "MSACCESS|NWIND;SQL Select Count(*) As _

      EmployeeCount From Employees;"

   Text1.LinkItem = "FirstRow"   ' Setup to get the first row of data

   Text1.LinkMode = 2            ' Establish a manual link

   Text1.LinkRequest             ' Request the data into the Text1

   Text1.LinkMode = 0            ' Terminate the link

   CntRows = Val(Text1.Text)     ' Convert the result to a number

   ' Establish a DDE Link to the Employees table

   Text1.LinkTopic = "MSACCESS|NWIND;SQL Select * From Employees;"

   Text1.LinkMode = 2            ' Establish a manual link

   ' Get the number of columns in the Employees Table

   Text1.LinkItem = "FieldCount" ' Setup to get count of fields/cols

   Text1.LinkRequest             ' Request the data into Text1

   CntCols = Val(Text1.Text)     ' Convert the result to a number

   ' Create the arrays to hold employee information and field names.

   ReDim Employees(CntRows, CntCols) As String

   ReDim FieldNames(1, CntCols) As String

   ' Get the field names in the Employees table from Access

   Text1.LinkItem = "FieldNames" ' Setup to get the field names

   Text1.LinkRequest             ' Request the data into Text1

   ' Parse the tab delimited list of field names and copy it into the

   ' .. FieldNames array. (ParseRecord subroutine is listed latter)

   ParseRecord FieldNames(), 1, (Text1.Text)

   ' Request each tab delimited record of data one at a time.

   For Row = 1 To CntRows

      If Row = 1 Then

         Text1.LinkItem = "FirstRow"  ' Setup for the first record

      Else

         Text1.LinkItem = "NextRow"   ' Setup for the next record

      End If

      Text1.LinkRequest          ' Request the data into Text1

      ' Parse the tab delimited record and store it in Employees array

      ParseRecord Employees(), Row, (Text1.Text)

   Next Row

   Text1.LinkMode = 0  ' Terminate link, arrays are filled with data

   ' OPTIONAL: The following code populates a grid control with the

   ' contents of the Employees and FieldNames arrays.

   ' Setup the Grid with the correct number of Rows and Cols

   Grid1.Rows = CntRows + 1      ' Add 1 for the row selector buttons

   Grid1.Cols = CntCols + 1      ' Add 1 for the column header buttons

   ' Fill the Grid column header with the data in the FieldNames array

   Grid.Row = 0                  ' Move to the column header row

   For Col = 1 To CntCols

      Grid.Col = Col                   ' Move to the column

      Grid.Text = FieldNames(1, Col)   ' .. and fill it with data

   Next Col

   ' Fill the Grid control rows with the data in the Employees array

   For Row = 1 To CntRows

      Grid.Row = Row                    ' Move to the row

      For Col = 1 To CntCols

        Grid.Col = Col                  ' Move to the column

        Grid.Text = Employees(Row, Col) ' Fill it with array data

      Next Col

   Next Row

   End Sub

The following subroutine, ParseRecord, is used to extract the tab-

delimited data from a record and place the data in an array in the

specified row. The subroutine takes the following three arguments:

   Array()  - A two-dimensional array of strings to store data into.

   Row      - The row position in the array to store the parsed data.

   Record   - A string with tab delimited information to parse.

Create a new module in Visual Basic with the following subroutine:

Sub ParseRecord (Array() As String, ByVal Row As Integer, _

   ByVal Record As String)

   Dim Start As Integer    ' Start position of field in record

   Dim TabStop As Integer  ' Position in the record of the next tab.

   Dim CntCols As Integer  ' The number of columns in the Array

   Dim Col As Integer      ' The current column (field) being parsed

   CntCols = UBound(array, 2)   ' Get count of columns in the array

   Start = 1       ' Start parsing with first character

   ' Find the first tab stop (ASCII character 9) in the record.

   TabStop = InStr(Start, Record, Chr$(9), 0)

   ' Loop until we fill up all but the last column (Col < CntCols)

   ' .. or until there are no more columns to read (TabStop <> 0 means

   ' .. that no tab was found)

   Col = 1

   While Col < CntCols And TabStop <> 0

      ' extract the field from the string and store it in the array

      Array(Row, Col) = Mid$(Record, Start, TabStop - Start)

      Start = TabStop + 1        ' Increment start to next tab stop

      TabStop = InStr(Start, Record, Chr$(9), 0) ' Find next tab stop

      Col = Col + 1              ' Increment to next column in array

   Wend

   Array(Row, CntCols) = Mid$(Record, Start)  ' Get last col of data

End Sub

Additional reference words: 1.00 1.10 2.00 part two vb b_vbasic

KBCategory:

KBSubcategory: IntpDde


INF: Passing Values from a Form to a Parameter Query

Article ID: Q93695

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you run a parameter query, Microsoft Access prompts you to enter

each parameter in a separate dialog box. This article explains how to

create a form that will collect all the values for a parameter query.

MORE INFORMATION

================

The following step-by-step example uses the Orders table from the sample

database NWIND.MDB. The example shows you two things: how to create a form

that prompts for a date value, and how to add a command button to the form

to execute the query.

1. Open the NWIND database.

2. Create a query based on the Orders table. Add the following field

   names with the specified criteria and save the query as MyQuery:

      Field             Criteria

      ---------------------------------------------

      Customer ID

      Order ID

      Order Date        > [Forms]![MyForm]![MyDate]

3. Create a new macro with the following action argument, and save it

   as MyMacro.

      Action       Action Argument    Value

      ---------------------------------------

      OpenQuery    Query Name         MyQuery

4. Create an unbound, blank form by leaving the Select A Table/Query box

   empty and choosing the Blank Form button.

5. Place a text box control on the form and set the following

   properties:

      Text Box

      ------------------

      Name: MyDate

      Format: Short Date

   NOTE: In Microsoft Access versions 1.0 and 1.1, the Name property is

   called ControlName.

6. Select the Database window by pressing F11.

7. Choose the Macro button with the mouse, and drag MyMacro onto the

   form. This will generate a command button with the OnPush property set

   to MyMacro.

8. Click in the Form window to select it, and then save the form as

   MyForm.

9. Switch to Form view, enter a date such as 1/1/91, and then click the

   MyMacro button. This will execute the MyMacro macro and run the MyQuery

   query using the date you entered in the MyDate text box as the query

   parameter.

Additional reference words: 1.00 1.10 2.00 Parameters

KBCategory:

KBSubcategory: QryParm


INF: Placing the User Login Name on a Form or in the Title Bar

Article ID: Q94599

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to use the User() function in Microsoft Access

version 1.x, or the CurrentUser() function in Microsoft Access version 2.0,

to display the current user name in a control on a form or in the title bar

of the Microsoft Access window.

MORE INFORMATION

================

In Microsoft Access, you can implement security to control user access to

the different objects in your database. Then you can use the User() or

CurrentUser() function to display the current user's name.

How to Display User Name in a Control on a Form

-----------------------------------------------

Use the following procedure to display a user name in a control on a form:

1. Create a form and place an unbound text box control on the form.

2. For Microsoft Access version 1.x, type "=User()" (without quotation

   marks) in the text box ControlSource property.

   For Microsoft Access version 2.0, type "=CurrentUser()" (without

   quotation marks) in the text box ControlSource property.

3. Switch to Form view to see the current user name displayed in

   the control.

How to Display User Name in the Title Bar

-----------------------------------------

Use the following procedure to display a user name in the title bar of the

Microsoft Access window:

1. Create a new module.

2. Enter the following Access Basic code:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

   '=====================================================================

   'Declarations section of the module

   '=====================================================================

   Option Explicit

   Declare Function SendMessage& Lib "User" (_

                ByVal hw%, ByVal message%, ByVal wParam%, LParam As Any)

   Declare Function GetActiveWindow% Lib "User" ()

   Const WM_SETTEXT = &HC

   DIM stTitle$

   DIM x%

   '=====================================================================

   'The following function places the user name in the title bar.

   '=====================================================================

   Function SetDatabasewindowWindowTitle ()

   'USE ONLY ONE OF THE FOLLOWING TWO LINES OF CODE

   'DEPENDING ON YOUR VERSION OF MICROSOFT ACCESS

      stTitle$ = "User = " + User()          '>>>>>FOR VERSION 1.X

      stTitle$ = "User = " + CurrentUser()   '>>>>>FOR VERSION 2.0

      x% = SendMessage(GetActiveWindow(), WM_SETTEXT, 0, ByVal stTitle$)

   End Function

   '=====================================================================

   'End of code section

   '=====================================================================

3. From the Run menu, choose Compile All.

4. Save the module.

5. Create a new macro with the RunCode action, using the following

   as the action argument:

      SetDatabasewindowWindowTitle()

   Save the macro and name it ShowUser.

6. Run the ShowUser macro. You should see the Database window title bar

   change from "Microsoft Access" to "User = <username>".

REFERENCES

==========

For more information, search for either "User" then "User Function," or

"CurrentUser" then "CurrentUser Function" using the Microsoft Access Help

menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmApi


INF: Print a Sequential Number for Each Record/Group on Report

Article ID: Q98790

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can place a text box control that prints a sequential number for

each record in the Detail section of a report. This number can be

reset so that a separate set of numbers is printed for each group of

records. This article explains these procedures by modifying a report

in the sample database NWIND.MDB.

MORE INFORMATION

================

If you want to print an incremental counter for each record in a report

group, place an unbound text box control in the Detail section of the

report. To begin the sequence with the number 1, set the ControlSource

property to =1, then set the RunningSum property to Over Group.

Steps to Reproduce Behavior

---------------------------

1. From the Database window, open the "List of Products by Category"

   report in Design view.

2. Place the following text box control before the Product Name

   control in the detail section:

      Object: Text Box

      ---------------------------------------------------------------

      Name: MyLineNumber (in version 1.x, Control Name: MyLineNumber)

      ControlSource: =1

      RunningSum: Over Group

3. Preview the report. Note that each group's records are sequentially

   numbered, beginning with the number 1.

You can also increment the counter number for each group in the report

by changing the RunningSum property to Over All. To do this, replace

step 2 above with the following step:

2. Place the following text box control before the Category Name

   control in the Category Name Header section:

      Object: Text Box

      -----------------------------------------------------------------

      Name: MyLineNumber2 (in version 1.x, Control Name: MyLineNumber2)

      ControlSource: =1

      RunningSum: Over All

Repeat step 3 above. Note that each individual record now prints a

unique sequential number.

REFERENCES

==========

For more information, search on "Calculating the Number of Records in a

Report" using the Microsoft Access Help menu

Additional reference words: 1.00 1.10 2.00 reports sequential

KBCategory:

KBSubcategory: RptOthr


INF: Printing Microsoft Access Reports on HP Laserjet II

Article ID: Q94418

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you print to a Hewlett-Packard Laserjet II, set the option Print

TrueType As Graphics in Print Setup. This is necessary because mixing

TrueType (TT) fonts and graphical objects on the HP Laserjet printer

can cause inconsistent results (that is, not true WYSIWYG). To set the

option, choose Print Setup from the File menu. Choose the Options

button. Then choose the box in the bottom left hand corner, Print True

Type as Graphics.

MORE INFORMATION

================

Before setting the Print Option, you might see the following problems when

printing Microsoft Access reports on a Hewlett-Packard Laserjet II:

 -  Microsoft Access displays white text on a black line in the report

    preview, but it prints a solid black line.

 -  Microsoft Access begins to print reports containing lines (graphics)

    with the text aligned correctly, but subsequently prints the line and

    then prints the text shifted to the far right.

REFERENCES

==========

For additional information, query on the following words here in the

Microsoft Knowledge Base:

   truetype and graphics and laserjet

Additional reference words: 1.00 1.10 2.00 PtrIss HPII

KBCategory:

KBSubcategory: PtrGraph


INF: Programmatically Add Counter Field to Table Using DAO

Article ID: Q113546

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to add a counter field to an existing table

using data access objects (DAO).

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

MORE INFORMATION

================

The example below demonstrates how to add a counter to a table using DAO

and Access Basic:

1. Open the sample database NWIND.MDB.

2. Create the following new table:

      Table: Counterless

      -----------------------

      Field Name: MyText

         Data Type: Text

      Field Name: MyNumber

         Data Type: Number

      Field Name: MyDate

         Data Type: Date/Time

3. Save the table as Counterless, without creating a primary key.

4. Create a new module and add the following line to the Declarations

   section:

      Option Explicit

5. Enter the following function in the module:

      '***************************************************************

      ' FUNCTION: AddCounter()

      '

      ' PURPOSE:  Programmatically adds a counter field to an

      '           existing table.

      '

      ' ARGUMENTS:

      '

      '    TName: The name of the table.

      '    FName: The name of the new counter field.

      '

      ' RETURNS:  True (error was encountered) or

      '           False (no error) as an integer.

      '

      '***************************************************************

      Function AddCounter (TName As String, FName As String) As Integer

         Dim DB As Database, TDef As TableDef, Fld As Field

         ' Get the current database.

         Set DB = DBEngine.Workspaces(0).Databases(0)

         ' Open the tabledef to which the counter field will be added.

         Set TDef = DB.TableDefs(TName)

         ' Create a new counter field of type LONG

         ' with the counter attribute.

         Set Fld = TDef.CreateField(FName, DB_LONG)

         Fld.Attributes = DB_AUTOINCRFIELD

         ' Trap for any errors.

         On Error Resume Next

         ' Append the new field to the tabledef.

         TDef.fields.Append Fld

         ' Check to see if an error occurred.

         If Err Then

            AddCounter = False

         Else

            AddCounter = True

         End If

         DB.Close

      End Function

6. Save the module as DAOAddCounter, and then close it.

7. Create the following macro:

      Action

      -------

      RunCode

      RunCode argument

      ------------------------------------------------

      Function Name: Addcounter("Counterless","NewID")

8. Save the macro as DAOAddCounter, and then close it.

9. Run the macro.

When you open the Counterless table, note the new NewID counter field.

REFERENCES

==========

For more information about the CreateField method, search for "CreateField"

then "CreateField Method (Data Access)" using the Microsoft Access Help

menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: TblModfy


INF: Query by Form (QBF) Using Dynamic QueryDef

Article ID: Q117544

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use a form to specify the criteria for a

query that will be dynamically built by an Access Basic function. This

technique is called query by form (QBF).

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

MORE INFORMATION

================

It is possible to create a QBF situation that uses various criteria to

filter an existing query. However, this method becomes complex as more and

more fields are added. One such complication might be when a user of the

form does not enter any value in a criteria field on the form.

A more flexible QBF method is to use an Access Basic function to

dynamically create the SQL statement for a query that will be deleted and

recreated each time the function runs. Using this method, an empty criteria

field will simply not be used as part of the query's WHERE condition.

The following example uses the Orders table in the sample database

NWIND.MDB to demonstrate how to use the QBF technique to display the

records that match a user's criteria:

1. Open the NWIND database and create a new form.

2. Create six text boxes on the form. Give each of the text boxes one of

   the following Name properties:

      Customer ID

      Ship City

      Ship Country

      Employee ID

      Order Start Date

      Order End Date

3. Create a command button on the form. Set the button's Caption property

   to "Run Query" (without quotation marks).

4. Set the command button's OnClick property to the following event

   procedure.

   NOTE: In the following sample code, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this code in Access Basic.

   Dim db As Database

   Dim QD As QueryDef

   Dim where As Variant

   Set db = dbengine.workspaces(0).databases(0)

   'Delete existing dynamic query, trap error if it does not exist.

   On Error Resume Next

   db.querydefs.Delete ("Dynamic_Query")

   On Error GoTo 0

   'Note Single quotes surrounding text fields [Ship Country]

   and [Customer ID]

   'Note NO Single quotes surrounding Numeric field [Employee Id]

   where = Null

   where = where & (" AND [Ship Country]= '" + Me![Ship Country] + "'")

   where = where & (" AND [Customer Id]= '" + Me![customer id] + "'")

   where = where & (" AND [Employee Id]= " + Me![Employee Id])

   'The following Section is for the Ship City and if it determines the

   'first or the last characters of the User's criteria are the "*" it

   'will use the "LIKE" operator in the SQL statement instead of the "="

   'Also Note Single quotes surrounding text field [Ship City]

   If Left(Me![Ship City],1) = "*" Or Right(Me![Ship City],1) = "*" Then

      where = where & (" AND [Ship City] like '" + Me![Ship City] + "'")

   Else

      where = where & (" AND [Ship City] = '" + Me![Ship City] + "'")

   End If

   'Note the # symbol surrounding Date field [Order Date]

   If Not IsNull(Me![order end date]) Then

      where = where & (" AND [order date] between #" + Me![order start _

      date] + "# AND #" & Me![order end date] & "#")

   Else

      where = where & (" AND [order date] >= #" + Me![order start date]_

      + " #")

   End If

   MsgBox "Select * from orders " & (" where " + Mid(where, 6) & ";")

   'Remove previous line to NOT have the SQL statement displayed

   Set QD = db.CreateQueryDef("Dynamic_Query", "Select * from _

   orders " & (" where " + Mid(where, 6) & ";"))

   DoCmd OpenQuery "Dynamic_Query"

5. From the View menu, choose Code. Enter the following Sub procedure in

   the form module's (general) section:

      Sub Tests (SQLString, Where_Test)

          If Where_Test = 0 Then

              SQLString = SQLString & " Where "

              Where_Test = Where_Test + 1

          Else

              SQLString = SQLString & " AND "

          End If

      End Sub

6. View the form in Form view.

7. To run the query, enter the appropriate criteria in the text boxes and

   then choose the command button.

You may want to try the following sample criteria:

 - Ship City: SE*

   Employee ID: 1

 - Customer ID: CACTU

   Order Start Date: 1/1/94

The method demonstrated in the above example has the following features:

 - Criteria entered in the text boxes will be evaluated with the AND

   operator. For example, if you enter "BONAP" in the Customer ID box and

   "1" in the Employee ID box, the resulting query will display records

   where [Customer ID] = BONAP AND [Employee ID] = 1.

 - If you enter an asterisk (*) at the beginning or end of the Ship City

   criteria box, the asterisk will be interpreted as a wildcard and the

   LIKE operator will be used in the SQL statement. For example, if you

   enter "Sea*" in the Ship City box, the resulting query will display

   records where the Ship City is Seattle.

 - If you enter a criterion in the Order Start Date box, but not in the

   Order End Date box, the resulting query will search for everything after

   the specified start date (instead of searching for a range of dates).

 - After you enter your criteria in the form and choose the command button,

   the query is built and run. You could also use this technique to print a

   report based on the query.

 - The SQL statement that is built for the dynamic query is displayed in a

   message box.

 - If you do not enter any criteria, the resulting query will return all

   the records in the table.

REFERENCES

==========

For more information about the CreateQueryDef method, search for

"CreateQueryDef" then "CreateQueryDef Method" using the Microsoft Access

Help menu.

For more information about SQL, search for "SQL: basics" then "Retrieving

Data Using SQL" using the Microsoft Access Help menu.

For more information about the QBF technique, search for "QBF" then "Query

by Form" using the Microsoft Access Help menu. Or, please see the following

articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q95931

   TITLE     : How to Use the Query by Form (QBF) Technique

   ARTICLE-ID: Q109334

   TITLE     : How to Dynamically Create a Filter

Additional reference words: 2.00 qbf

KBCategory:

KBSubcategory: PgmObj


INF: Query with Parameters to Evaluate Complex Criteria

Article ID: Q103252

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access allows the use of variable parameters in queries.

This article discusses how to construct a query requiring more than

one prompt. Each parameter can be used both as criteria and as a field

to allow complicated evaluation of the value entered in each

parameter.

MORE INFORMATION

================

The following parameter query is based on the Orders table in the

sample database NWIND.MDB. It selects orders written between two

variable dates provided by the user.

If either the Start Date or the End Date is not entered, the query

returns all dates greater than or equal to the Start Date, or less

than or equal to the End Date. If neither a Start Date nor an End Date

is entered, the query returns all orders.

   Query: FindOrdersByDate

   -----------------------------------------------------------

   Field: Order ID

      Show: Yes

   Field: Order Date

      Sort: Ascending

      Show: Yes

      First Criteria Line: Between [Start Date] and [End Date]

      Second Criteria Line: <=[End Date]

      Third Criteria Line: >=[Start Date]

      Fourth Criteria Line:

   Field: [Start Date]

      Show: No

      First Criteria Line: Is Not Null

      Second Criteria Line: Is Null

      Third Criteria Line: Is Not Null

      Fourth Criteria Line: Is Null

   Field: [End Date]

      Show: No

      First Criteria Line: Is Not Null

      Second Criteria Line: Is Not Null

      Third Criteria Line: Is Null

      Fourth Criteria Line: Is Null

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 178-181

For more information on similar criteria, query on the following

phrase here in the Microsoft Knowledge Base:

   query by form

Additional reference words: 1.00 1.10 2.00 queries ui parameter query

KBCategory:

KBSubcategory:  QryParm


INF: Questions and Answers About .LDB Files

Article ID: Q109957

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

Q: What is an .LDB file and what is it used for?

A: The .LDB file maintains lock information about a database, and

   each user who opens the database has an entry in it. The .LDB file

   contains the computer and user names of all users currently

   accessing a database in a multiuser (network) environment. No

   other information is read from or written to the .LDB file.

   Microsoft Access uses this information to tell which records are

   locked in a database, and who has them locked, to prevent possible

   file contention errors and database corruption by multiple users.

   However, the .LDB file does not give Microsoft Access information

   on who has a database opened exclusively, since this is handled by

   SHARE.EXE (or VSHARE.386 in Windows 3.1). Those programs do not

   return information to Microsoft Access about who has the database

   open.

Q: Can I find out the structure of the .LDB file?

A: The format of the .LDB file is not published and is subject to

   change or elimination in future releases of Microsoft Access.

   Therefore, code written to manipulate it or read its current

   format may not work correctly if the .LDB file is eliminated or its

   format changed in a future release.

Q: Is the information in the .LDB file accessible to users or

   programmers?

A: No. The information in the .LDB file is only used internally by

   Microsoft Access and is not designed to be used by users or

   programmers.

Q: Where and when is an .LDB file created?

A: An .LDB file is created when you open a database. The .LDB file

   must reside in the same directory as that database. If an .LDB file

   isn't present, and Microsoft Access requires it, it attempts to

   create one in the same directory as the database.

   Normally, the .LDB file must be in a directory where the user has

   read-write privileges. However, it is possible to open a database

   in a directory or device where a user has read-only privileges.

   To do this, select both the Read Only and the Exclusive check boxes

   in the Open Database dialog box. The Open Database dialog box can

   be found by selecting Open Database from the File menu. The

   combination of read-only and exclusive means that users will not be

   updating any database information, so record-locking isn't

   required. Since record-locking isn't required, Microsoft Access

   does not attempt to open or create an .LDB file.

   This technique also works with directories where the user has read-

   write privileges and will improve performance if database updating

   isn't required.

Q: If you move a database, do you also need to move its .LDB file?

A: It isn't necessary to move the .LDB file, since Microsoft Access

   attempts to re-create the .LDB file if it is not present.

   A potential problem can occur if the database is placed in a

   directory where some users have directory read-only privileges and

   other users have directory read-write privileges.

   When a read-only user opens a database, no information is written

   to the .LDB file, since that user is not allowed to write any

   information to the database. When a read-write user opens a

   database, their name and computer information are written to the

   .LDB file.

   If both of these users (read-only and read-write) open a database

   and read the same record, a file conflict occurs if the read-write

   user attempts to update the record, because an update action would

   conflict with the read-only user. When a file conflict occurs,

   Microsoft Access pulls data from the .LDB file for what it thinks

   is the read-only user and uses this data in the file conflict error

   message given to the read-write user. However, since the read-only

   user's name and computer weren't written to the .LDB file, and since

   previously used .LDB files contain the names of previous read-write

   users, Microsoft Access reads old, outdated user information from

   the .LDB file and subsequently uses it in the error message instead

   of valid user information.

   To protect against this problem, the database should first be

   opened and then closed by one of the read-write users before any read-

   only users open the database. This creates the .LDB file for that

   database.

Q: Can I erase the .LDB file?

A: You can erase the .LDB file if no one currently has it open.

   However, unless the database is opened as read-only and exclusive,

   Microsoft Access will re-create the file the next time the database

   is opened.

   In fact, if you get strange user names reported (such as old user

   names or garbage) when a lock conflict occurs, your .LDB file is

   most likely damaged. If you suspect this, it is best to erase your

   old .LDB file and let Microsoft Access automatically create a new

   one for you.

Q: What is the maximum size the .LDB file can be?

A: The maximum size is 16K, with each active user taking 64 bytes.

Q: When is information written to the .LDB file?

A: Information is only written to the .LDB file once, when a user

   opens a database and the .LDB file is created, and active user

   information is written to it. After that point, Microsoft Access

   only locks portions of the .LDB file and does not read from it or

   write to it.

Q: How does Microsoft Access use the information in the .LDB files?

A: Microsoft Access uses .LDB file information to determine who has

   which files (or records in a file) locked. If Access detects a lock

   conflict with another user, it reads the .LDB file to get the

   computer and user name of the user who has the file or record

   locked. However, the state of the information in the .LDB file has

   no bearing on the state of the database. If the .LDB file is

   completely corrupt, everything in the database will still work

   correctly (although user names reported in lock conflicts might

   look strange).

   In most lock conflict situations, you get a generic "Write

   conflict" error message that allows you to save the record, copy it

   to the clipboard, or drop the changes you made. In some

   circumstances, however, you get the error message:

      Couldn't lock table <table name>; currently in use by user

      <user name> on computer <computer name>.

Q: How can I find out which users are accessing my database?

A: Microsoft Access does not provide direct functionality to identify

   users accessing a database. The level and type of functionality in

   this area differs, and depends largely on the operating system and

   network software.

   For example, Microsoft Lan Manager provides an Audit API function

   set that can be used to create and manage real-time audit files.

   These audit files keep track of server operations and the users who

   perform them. These API functions can be manipulated through Access

   Basic to provide user information.

   Some operating systems (such as Windows for Workgroups, which comes

   with a tool called NetWatch) give you the ability to identify

   users logged onto a shared network directory. However, NetWatch

   cannot indentify users currently accessing a given file.

REFERENCES

==========

Microsoft Lan Manager "A Programmer's Guide," version 2.0, Chapter 8,

"Information APIs," pages 234-236

For more information about .LDB files, search for "LDB files" then "Locking

Information Files" using the Microsoft Access version 2.0 Help menu.

Additional reference words: 1.00 1.10 2.00 Q&A lockfile

KBCategory:

KBSubcategory: GnlMu


INF: Reading, Storing, & Writing Binary Large Objects (BLOBs)

Article ID: Q103257

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The OLE data type is often used to store large data objects (such as

sound, video, and graphic data) in a Microsoft Access table. However,

some large binary data objects cannot be represented if they do not

have an OLE server that understands the data being stored. You may

also want to store copies of executable program files (or other large,

non-OLE data) in a Microsoft Access table.

This type of data is often referred to as a binary large object (BLOB).

The following information discusses how to use a Microsoft Access Memo

field to store and work with large binary objects.

MORE INFORMATION

================

Provided below are two Access Basic functions that you can use to

manage large amounts of binary data in Microsoft Access Memo fields:

 - ReadBLOB() facilitates reading a binary file from disk and storing

   its contents in a Microsoft Access Memo field.

 - WriteBLOB() facilitates writing binary data stored in a Microsoft

   Access Memo field to a file on disk.

Information that demonstrates how to use these functions is also

provided.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

Create a new module with the following Declaration section and

functions:

NOTE: In the following sample code, an underscore (_) is used as a

line continuation character. Remove the underscore when re-creating

this code in Access Basic.

'*******************************************************************

' DECLARATION SECTION

'*******************************************************************

Option Explicit

Const BlockSize = 32768

'*******************************************************************

' FUNCTION: ReadBLOB

'

' PURPOSE:

'   Reads a large binary file (BLOB) from disk and stores the contents

'   it in the specified table/memo field.

'

' PREREQUISITES:

'   The specified table with the memo field to contain the binary

'   data must be opened in Access basic code and the correct

'   record navigated to prior to calling ReadBLOB.

'

' ARGUMENTS:

'   Source - The path\filename to be read and stored.

'   T      - The table object to store the data into.

'   Field  - The memo field name in table T to store data into.

'

' RETURN:

'   The number of bytes read from the Source file.

'

'*******************************************************************

Function ReadBLOB (ByVal Source As String, T As Table, _

Field As String)

    Dim NumBlocks As Integer

    Dim FileLength As Long, LeftOver As Long

    Dim FileData As String

    Dim SourceFile As Integer

    Dim i As Integer, RetVal As Variant

    On Error GoTo Err_ReadBLOB

    ' Open the source file to read from

    SourceFile = FreeFile

    Open Source For Binary Access Read As SourceFile

    ' Get the length of the file

    FileLength = LOF(SourceFile)

    If FileLength = 0 Then

        ReadBLOB = 0

        GoTo Bye_ReadBLOB

    End If

    ' Calculate number of blocks to read and left over bytes

    NumBlocks = FileLength \ BlockSize

    LeftOver = FileLength Mod BlockSize

    ' Initialize the status bar meter

    RetVal = SysCmd(1, "Reading BLOB", FileLength \ 1000)

    ' Put the table in edit mode to read data into

    T.Edit

    ' Read the 'left over' amount of data, writing it to the table

    FileData = String$(LeftOver, 32)

    Get SourceFile, , FileData

    T(Field).AppendChunk (FileData)

    ' Update status bar meter

    RetVal = SysCmd(2, LeftOver / 1000)

    ' Read the remaining blocks of data, writing them to the table

    FileData = String$(BlockSize, 32)

    For i = 1 To NumBlocks

        Get SourceFile, , FileData

        T(Field).AppendChunk (FileData)

        ' Update status bar meter

        RetVal = SysCmd(2, BlockSize * i / 1000)

    Next i

    ' Update the table record

    T.Update

    ' Remove status bar meter

    RetVal = SysCmd(3)

    Close SourceFile

    ReadBLOB = FileLength

Bye_ReadBLOB:

    Exit Function

Err_ReadBLOB:

    ReadBLOB = -1 * Err

    Resume Bye_ReadBLOB

End Function

'*******************************************************************

' FUNCTION: WriteBLOB

'

' PURPOSE:

'   Writes large binary file (BLOB) information stored in the

'   specified table/memo field to the specified path\file on disk.

'

' PREREQUISITES:

'   The specified table with the memo field containing the binary

'   data must be opened in Access basic code, and the correct record

'   navigated to prior to calling WriteBLOB.

'

' ARGUMENTS:

'   T           - The table object containing the binary information

'                 to write.

'   Field       - The memo field name in table T containing the

'                 binary information to write.

'   Destination - The path\filename to write the binary

'                 information to.

'

' RETURN:

'   The number of bytes written to the Destination file.

'

'*******************************************************************

Function WriteBLOB (T As Table, Field As String, _

ByVal Destination As String)

    Dim NumBlocks As Integer

    Dim FileLength As Long, LeftOver As Long

    Dim FileData As String

    Dim i As Integer, RetVal

    Dim DestFile As Integer

    On Error GoTo Err_WriteBLOB

    ' Get the size of the field

    FileLength = T(Field).FieldSize()

    If FileLength = 0 Then

        WriteBLOB = 0

        GoTo Bye_WriteBLOB

    End If

    ' Calculate number of blocks to write and left over bytes

    NumBlocks = FileLength \ BlockSize

    LeftOver = FileLength Mod BlockSize

    ' Remove any existing destination file

    DestFile = FreeFile

    Open Destination For Output As DestFile

    Close DestFile

    ' Open the destination file to write to

    Open Destination For Binary As DestFile

    ' Initialize status bar meter

    RetVal = SysCmd(1, "Writing BLOB", FileLength / 1000)

    ' Write the 'left over' amount of data to the output file

    FileData = T(Field).GetChunk(0, LeftOver)

    Put DestFile, , FileData

    ' Update status bar meter

    RetVal = SysCmd(2, LeftOver / 1000)

    ' Write the remaining blocks of data to the output file

    For i = 1 To NumBlocks

        ' Clear the buffer and read a chunck

        FileData = ""

        FileData = T(Field).GetChunk((i - 1) * BlockSize _

    + LeftOver, BlockSize)

        ' Write the chunck to the output file

        Put DestFile, , FileData

        ' Update status bar meter

        RetVal = SysCmd(2, ((i - 1) * BlockSize + LeftOver) / 1000)

    Next i

    ' Remove status bar meter

    RetVal = SysCmd(3)

    Close DestFile

    WriteBLOB = FileLength

Bye_WriteBLOB:

    Exit Function

Err_WriteBLOB:

    WriteBLOB = -1 * Err

    Resume Bye_WriteBLOB

End Function

How to Use the ReadBLOB() and WriteBLOB() Functions

---------------------------------------------------

The following subroutine, CopyFile, demonstrates how to copy a binary

file into a Microsoft Access Memo field and then write it back out to

a new disk file.

1. Create the following table:

   Table BLOB

   ----------

   FieldName: Blob

      DataType: Memo

2. Add the following function to the BLOB module created earlier:

'***************************************************************

' SUB: CopyFile

'

' PURPOSE:

'   Demonstrates how to use CopyBLOB and WriteBLOB.

'

' PREREQUISITES:

'   A table called "BLOB" must be created which contains a

'   memo field with the name "Blob".

'

' ARGUMENTS:

'   Source - The source path\file name to copy

'   Destination - The destination path\file name to write to

'

' EXAMPLE:

'   CopyFile "c:\access\msaccess.hlp", "c:\access\msacces2.hlp"

'

'***************************************************************

Sub CopyFile (ByVal Source As String, ByVal Destination As String)

    Dim BytesRead, BytesWritten

    Dim Msg As String

    Dim db As Database, T As Table

    ' Open the BLOB table

    Set db = CurrentDB()

    Set T = db.OpenTable("BLOB")

    ' Create a new record and move to it

    T.AddNew

    T.Update

    T.MoveLast

    BytesRead = ReadBLOB(Source, T, "Blob")

    Msg = "Finished reading """ & Source & """"

    Msg = Msg & Chr$(13) & ".. " & BytesRead & " bytes read."

    MsgBox Msg, 64, "Copy File"

    BytesWritten = WriteBLOB(T, "Blob", Destination)

    Msg = "Finished writing """ & Destination & """"

    Msg = Msg & Chr$(13) & ".. " & BytesWritten & " bytes written."

    MsgBox Msg, 64, "Copy File"

End Sub

3. With the BLOB module open in Design view, choose Immediate window

   from the View menu.

4. Type the following and press ENTER:

      CopyFile "c:\access\msaccess.hlp", "c:\access\msacces2.hlp"

   Result: The Microsoft Access Help file, which is over 3 megabytes in

   size, is copied into the BLOB Memo field in the BLOB table. Then, this

   information is copied to the hard disk with a new name.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.1, Chapter 2,

"Writing a New Function," pages 8-14, and Chapter 8, "Manipulating

Data,"pages 98-117

Microsoft Access Distribution Kit "The Secrets of Access Wizards," version

1.1, Chapter 2, "Inclinations: AccessWizard Functions and Properties,"

pages 30-32

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: README.TXT File and Novell Locking Issues

Article ID: Q109400

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The README.TXT file shipped with Microsoft Access version 1.1 contains a

section titled "Using Microsoft Access on Novell NetWare Servers and Banyan

VINES Servers (Increasing the Number of Record Locks)". This information

does not apply to Novell NetWare286 (version 2.x). It only applies to

Novell NetWare386 (version 3.x) and Banyan VINES.

The README.TXT file does not state that the information does not apply to

Novell NetWare286.

MORE INFORMATION

================

The following information is taken from the README.TXT file:

------------------------------------------------------------

Using Microsoft Access on Novell NetWare Servers and Banyan

   VINES Servers (Increasing the Number of Record Locks)

------------------------------------------------------------

On Novell NetWare Servers:

If you are attempting to use large Microsoft Access databases on a

Novell NetWare server, set the "maximum record locks per connection"

to the largest allowable value (10,000). The execution of large bulk

operations in Microsoft Access (such as a large update query) can

cause the server to run out of record lock connections. If you do not

set the number of record locks to the maximum value while using

Microsoft Access, it could result in the loss of data due to a server

crash.

See your Novell NetWare documentation for a description of

how to set the number of record locks.

------------------------------------------------------------

NOTE: NetWare286 does not have definable configurations for its locking

schemes. A server supervisor can use the NetWare console command FCONSOLE

to view the locks on the network.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: StpNet


INF: Relationship Between Btrieve and Microsoft Access

Article ID: Q113928

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Btrieve is not a complete database program, such as Microsoft Access or

Microsoft FoxPro. Btrieve is a database engine that provides database

functionality to applications developed with programming languages such as

Microsoft Visual Basic, Microsoft Visual C++, Pascal, and Assembly

Language.

Microsoft Access has the ability to attach, import, and export Btrieve

files.

MORE INFORMATION

================

Novell defines Btrieve as a record manager, not as a complete stand-alone

database application. Btrieve has no user interface; it provides only back-

end functionality.

In order to retrieve data using Btrieve, a front end, or user interface,

must first be written, usually in a programming language. Microsoft Access

has been designed to provide such front end functionality.

The relationship between Btrieve and its front end is similar to the

relationship between the Microsoft Jet database engine and a Visual Basic

front end application, although the Jet database engine provides greater

functionality.

To provide front end functionality for Btrieve, Novell created Xtrieve.

Where Btrieve standards and Xtrieve standards differ, Microsoft Access

follows the Xtrieve standard.

Many programs have been written to use Btrieve. Several major accounting

applications use it to perform database functions. Customers often use

Microsoft Access in conjunction with these programs to provide report

generation capability. By attaching the Btrieve files, Microsoft Access can

read them while the accounting application is still actively using them.

Btrieve is provided by Novell as a dynamic-link library (DLL) file named

WBTRCALL.DLL. This DLL file provides the disk I/O and indexing for the

Btrieve files. Data Dictionary (DDF) files are used by Xtrieve and

Microsoft Access, since Btrieve files do not contain any field information.

The relationship between Microsoft Access and Btrieve is shown in this

diagram:

    Microsoft Access

          |

   Jet database engine   Database engine used by Microsoft Access.

          |

      BTRV200.DLL        Microsoft Access Btrieve ISAM DLL file.

          |

     WBTRCALL.DLL        This file is provided by Novell.

          |

      DDF files          Data Dictionary files.

          |

       Hard disk         This is the Btrieve file that can be used

         file            as a table in Microsoft Access.

Btrieve and Xtrieve are manufactured by Novell Inc., a vendor independent

of Microsoft; we make no warranty, implied or otherwise, regarding these

products' performance or reliability.

Additional reference words: 2.00 importing exporting attaching

KBCategory:

KBSubcategory: IsmBtrv


INF: Reporting the Median Value of a Group of Records

Article ID: Q103271

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to create a report that shows the median

value for a set of records. Note that a median value is the midpoint

in an ordered set of values (the value above and below which there is

an equal set of values), or the arithmetic mean of the two middle

numbers if there is no one middle number.

MORE INFORMATION

================

The following sample report is based on the Orders table in the sample

database NWIND.MDB. The report will group records by the Customer ID

field, and will sort records within each group by the Freight

field.

1. Create a new report based on the Orders table in NWIND.MDB.

2. From the View menu, choose Sorting And Grouping. Select Customer ID

   as the first field. Set GroupHeader and GroupFooter to Yes.

3. Select Freight as the second field. Select Ascending for the

   Sort Order.

4. From the View menu, choose Field List. Drag the Customer ID field

   from the field list to the Customer ID header on the report.

5. Drag the Freight field to the detail section.

6. Add the following fields to the Customer ID header:

      Name         Control Source

      -------------------------------

      IDCount      =Count(*)

      Half         =Int([IDCount]/2)

      Odd          =([IDCount] Mod 2)

   NOTE: The Name property is called ControlName in version 1.x.

7. Add the following controls to the detail section:

   NOTE: In the following example, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this example.

      Name         Control Source

      (Control Name in version 1.x)

      -------------------------------------------------------------

      Position     =1

      Arg1         =IIf([Position]=([Half]+[Odd]),[Freight],0)

      Arg2:        =IIf([Odd]=0,IIf([Position]=([Half]+_

                      [Odd]+1),[Freight],0))

   Set the RunningSum property to Over Group for each of the controls in

   this section.

8. Add the following control to the Customer ID Footer:

      Name         Control Source

      ---------------------------------------------------

      Median       =IIf([Odd]=0,([Arg1]+[Arg2])/2,[Arg1])

9. Save and run the report.

REFERENCES

==========

For more information on finding median values, query on the following

word here in the Microsoft Access Knowledge Base:

   median

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptOthr


INF: Requery Control Err Msg: There Is No Control Called...

Article ID: Q92899

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you try to requery a control by using the Requery macro action,

an error appears indicating that the specified control does not exist

even though the control clearly exists on the form.

MORE INFORMATION

================

For the Requery Control Name parameter, Microsoft Access expects a

short control name without any brackets. The Help system informs you

that you should not use the full syntax, but it does not mention that

the brackets must be omitted even if the control name consists of more

than one word. Because other scenarios require the use of brackets,

this inconsistency is confusing.

The following example reproduces the problem and discusses the

solution:

1. Create an unbound form called Form1.

2. Place a combo box bound to NWIND.MDB "Sales Totals Query" on the form

   and call the combo box Field1.

3. Create a macro called Macro1 with the following Action/Parameter:

      Action       : Requery

      Control Name : [Field1]

   Note that [Field1] is enclosed in brackets.

4. Save and close Macro1 and drag it on to Form1 in design mode.

5. Switch to Browse mode on the form and choose the button.

   The following error message appears:

      There is no control called '[Field1]'.

6. Remove the brackets from the Control Name parameter in Macro1 and

   try again.

   The control should now work properly.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: McrArg


INF: Requery, Repaint, and Records Refresh

Article ID: Q96104

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Requery, Repaint, and Records Refresh items are different; however,

they are all used to ensure that what you see is updated.

MORE INFORMATION

================

Requery

-------

The Requery macro action updates controls, such as list boxes and combo

boxes. It does not work for the form on which those controls exist.

Repaint

-------

Repaint is not related to data, it merely redraws the object or

control. If there is data that has been updated in the underlying

dynaset but is not reflected on the form, Repaint cannot be used.

Records Refresh

---------------

Records Refresh requeries the form itself, as opposed to any control on the

form.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsRqry


INF: Requirements to Connect to SYBASE SQL Server

Article ID: Q96468

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The SQL Server ODBC driver that ships with Microsoft Access is

designed to work with both Microsoft SQL Server and SYBASE SQL Server.

This article describes requirements for running Microsoft Access

versions 1.0, 1.1, and 2.0 with SYBASE SQL Server.

MORE INFORMATION

================

The SQL Server ODBC driver works with both Microsoft and SYBASE SQL

Servers. However, the Microsoft applications that shipped with the SQL

Server driver (Visual Basic version 2.0 and Microsoft Access) were

tested and verified with Microsoft SQL Server only.

The following sections discuss the issues associated with using the

Microsoft SQL Server ODBC driver with SYBASE SQL Server.

ODBC Driver Requires Catalog Stored Procedures

----------------------------------------------

The ODBC driver requires the catalog stored procedures that ship with

SQL Server version 4.2a. Until the 4.9.1 SYBASE release, these catalog

procedures did not ship with SYBASE servers. To install the

procedures, you must run the INSTCAT.SQL script against the SYBASE

server.

NOTE: Sybase changed the system catalogs in their 4.8 release.

Therefore, SYBASE SQL Server versions 4.8 and later require a modified

script called INSTCAT.48. This revised script is available from

Microsoft Product Support and CompuServe. This script is required with

Microsoft Access version 1.0. With Microsoft Access 1.1 and 2.0, the

INSTCAT.SQL file applies to all versions of Microsoft SQL Server, as well

as to all versions of SYBASE SQL Server.

For more information on the INSTCAT.48 script, query on the following

words here in the Microsoft Knowledge Base:

   access and sybase and instcat.48

ODBC Driver Comes with Named Pipe Network Library (Net-Library)

---------------------------------------------------------------

The SQL Server ODBC driver that ships with Microsoft Access and Visual

Basic 2.0 comes with the Named Pipe Net-Library. To connect to SYBASE,

you need to use the SQL Bridge product or buy the Net-Libraries from

Sybase for each client machine. (The only Sybase Net-Library that has

gone through interoperability testing is the Microsoft TCP/IP

Net-Library.)

Both Microsoft Access and Visual Basic 2.0 use the network in a way

that is atypical of Windows applications; they use multiple

simultaneous connections and use asynchronous calls. For this reason,

Sybase Net-Libraries may fail with these products in some network

configurations. Microsoft and Sybase are discussing how best to

perform interoperability testing with the various network

configurations supported by Sybase (FTP, Wollongong, Novell and other

TCP/IP, DECnet, and so forth).

The following is a list of Net-Libraries that Microsoft has confirmed

to work with Microsoft Access/ODBC and SYBASE SQL Server:

NOTE: An EBF is an Emergency Bug Fix, available from Sybase.

Net-Library                                          EBF #

-------------------------------------------------------------------

Named Pipe Net-Libraries 1.0

Novell LAN WorkPlace TCP 4.0 with 1.0 Net-Library

Netware (SPX) 1.0 Net-Library

FTP 2.05 with Net-Libraries 1.0 and 1.0.1

Microsoft TCP/IP 1.0 with Net-Library 1.0.1

FTP 2.1 with Net-Library 1.0.1                       1285

FTP 2.2 with Net-Library 1.02                        2300

NetMangae TCP/IP 3.06 Net-Library 1.0                1326

PC-NFS Net-Library 1.0                               1334

Wollongong Pathway Net-Library 1.0                       1327*

DECNET (WDBDECDE.DLL)                                1561, May 1993

*NOTE: To use Wollongong Pathway, the files C37603.EXE and C39489.EXE are

required in addition to EBF #1327. This is required by Wollongong Pathway

and is not specific to running ODBC or Microsoft Access. These files are

available from Wollongong, either through their BBS or through CompuServe.

Contact Wollongong for more information.

The two additional files are for the latest version of Wollongong's Pathway

Access, version 2.1.1. (The version number for the run-time software is

1.2.) The run-time software is shipped with Pathway Access, but can also be

ordered separately from Wollongong. The run-time software is all that is

needed to run Net-Library.

Some of the products mentioned above are manufactured by vendors

independent of Microsoft; we make no warranty, implied or otherwise,

regarding these products' performance or reliability.

Additional reference words: 1.00 1.10 2.00 net-library net library

KBCategory:

KBSubcategory: ObcOthr


INF: Reserved Words in Microsoft Access

Article ID: Q109312

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists words and symbols that should not be used in field names

because they are "reserved" words, or words that are reserved by Microsoft

Access because they have a specific meaning to the program.

MORE INFORMATION

================

The following words are reserved and should not be used as field names:

   AND

   APPLICATION (2.0)

   COUNT

   DATE

   DESCRIPTION

   ELSE

   END

   ERROR

   EXIT

   FALSE

   FORM

   FORMS

   FUNCTION

   GROUP BY

   IF

   IN

   IS

   NAME

   NO

   NULL

   OFF

   ON

   OR

   REAL

   REPORTS

   SCREEN

   SECTION

   SELECT

   SQL

   TRUE

   YES

The following symbols should not be used as part of a field name:

   .

   /

   *

   :

   !

   #

   &

   -

REFERENCES

==========

For more information on reserved words, search help for "reserved words"

then check each of the topics listed using the Microsoft Access Help menu.

Microsoft Access "Language Reference," page 509

Additional reference words: 1.00 1.10 2.00 misc

KBCategory:

KBSubcategory: TblFldp


INF: Returning Case-Sensitive Match in Queries

Article ID: Q95605

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access can differentiate between case sensitive text strings

using the Asc() function. Using this function in a select query,

Microsoft Access can locate an exact case sensitive match.

MORE INFORMATION

================

This technique is useful in a situation where the user needs to find

all the records in a field that contain lowercase text rather than

uppercase text for the first character. An example of this might be in

the Employees table of the NWIND.MDB sample database. Please note that

the example below will find only the first character. If you need

something more complex, you must call an Access Basic function to

return the results.

Suppose the text field called First Name contains values such as the

following:

   First Name

   ----------

   andrew

   Andrew

   Nancy

If you need to find all the records that contain the lower case

"andrew" as compared to "Andrew," use the Asc() function. To do this,

create a new select query:

   Query: QueryTest

   -----------------------

   Field name: First Name

      Show: True

   Field name: Asc([First name])

      Show: True

      First Criteria Line:  Asc("a")

This query will return only the record for "andrew," not "Andrew."

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, page 40

Microsoft Access "User's Guide," version 1.0, Chapter 6, "Designing Select

Queries"

Additional reference words: 1.00 1.10 2.00 chr chr$

KBCategory:

KBSubcategory: QryParm


INF: Row Fix-up in the NWIND.MDB Order Form

Article ID: Q95643

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access provides an automatic "row fix-up" feature that uses

links between tables to update (fix up) records in queries and forms.

You can use this feature to enter a single value, and Microsoft Access

automatically looks up and displays other values for that record.

Row fix-up allows you to update forms and queries without using macros

or Access Basic code. This article uses the Orders form in the sample

database NWIND.MDB to demonstrate how to set up and use row fix-up.

MORE INFORMATION

================

To see an example of the row fix-up technique, follow these steps:

1. Open the NWIND.MDB database.

2. Open the Orders form in Form view.

3. Open the Order Information query in Design view.

Note the following about the Orders form:

1. The RecordSource property of the Orders form is set to the Order

   Information query.

2. In Microsoft Access version 1.x, the Order Information query is based on

   three tables: Orders, Customers, and Employees. In version 2.0, the

   query is based on the Orders and Customers tables.

3. The Join property between Customers and Orders tables is:

         One                          Many

      -------------------------------------------------

      CUSTOMERS.[customer id] ==>  ORDERS.[customer id]

4. The Order ID field in the query grid comes from the Orders table,

   which is on the many side of the relationship, and not from the

   Customers table, which is on the one side of the relationship. (See

   point 3, above.)

5. The Bill To combo box is based on the Customer List query. Customer

   List has the following characteristics:

   a. The query is based on the Customers table.

   b. The query returns two columns: Company Name and Company ID.

   c. The bound column is Customer ID.

   d. The visible column is Company Name.

6. Microsoft Access select queries are updatable. This means that when

   you make a change to a query's dynaset, Microsoft Access can update

   the source tables with your changes. For more information on this,

   search for "updating underlying tables," then "When is Query

   Updatable" using the Microsoft Access Help menu.

The Bill To combo box presents you with a list of company names from

the visible column of the Customer List query.

When you make a selection, the combo box stores the bound column--

the Customer ID field from the Customer List query--in the Customer ID

field in the Orders table. (See points 4 and 5d, above.) It is

important to note that the selection was stored in the many-side

table. (See point 3a, above.)

After the combo box updates the Customer ID field in the Orders table

(the many-side table), the field is changed so it no longer points to

the same record in the Customers table (the one-side table). (See point

6, above.) Note that the Orders table is updated because the query's

dynaset was changed.

Microsoft Access recognizes that the relationship no longer matches,

so it automatically updates the relationship by linking the changed

record in the Orders table with the appropriate record in the

Customers table.

All the fields in the Orders form that come from the Customers table

(the one-side table) are updated to show the values in the record for the

newly formed link.

Example

-------

When you make a change to the Bill To combo box, Microsoft Access uses

row fix-up to update the following list of fields on the Orders form:

 - [Address]

 - [City]

 - [Region]

 - [Postal Code]

 - [Country]

The following list of fields on the Orders form are not updated by Row

fix-up. However they are updated by the Orders Fill In Ship To macro

on the AfterUpdate property of the Bill To combo box:

 - [Ship Name]

 - [Ship Address]

 - [Ship City]

 - [Ship Region]

 - [Ship Postal]

 - [Ship Country]

REFERENCES

==========

The row fix-up technique is referred to as AutoLookup in Microsoft

Access version 2.0 and as  dynamic lookup in previous versions. For

more information on row fix-up, search for "dynamic lookup" using the Help

menu in Microsoft Access version 1.x or 2.0.

For more information, query on the following words here in the Microsoft

Knowledge Base:

   row and fix-up

Additional reference words: 1.00 1.10 2.00 dynamic lookup checkpage

KBCategory:

KBSubcategory: QryJoin


INF: Running a MS Access Macro from Visual Basic Using DDE

Article ID: Q97776

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The following information provides some examples of how to use

Microsoft Visual Basic to run macros in Microsoft Access using

dynamic data exchange (DDE).

MORE INFORMATION

================

The following code demonstrates how to run a macro called "MyMacro" in

Microsoft Access from a Visual Basic application.

   Sub Command1_Click()

      'the character between MSACCESS and System is the pipe symbol

      Text1.LinkTopic = "MSACCESS|System"

      ' Establish a manual DDE link to Access

      Text1.LinkMode = 2

      ' Run the macro called "MyMacro"

      Text1.LinkExecute "MyMacro"

      ' Terminate the DDE link to Access

      Text1.LinkMode = 0

   End Sub

To use this code, create a new Visual Basic program with a text box

and a command button with the following properties:

   Text box

   --------

   Name: Text1

   Command Button

   --------------

   Name: Command1

Double-click the command button and enter the code example listed

above between the "Sub Command1_Click ()" and "End Sub" lines.

When you run this example, be sure that Microsoft Access is running

and that a database containing a macro called "MyMacro" is open. For

testing purposes, you may want to create a macro called "MyMacro" that

contains a single MsgBox action.

NOTE: While the above example uses the Microsoft Access system Topic

listed in the LinkTopic line, Microsoft Access is capable of executing

a macro with virtually every valid topic it supports. For a list of

topics that Microsoft Access supports, query on the following words

here in the Microsoft Knowledge Base:

   b_waccess and dde and server and topics

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpDde


INF: Running MS-DOS SHARE with Windows for Workgroups

Article ID: Q88914

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

--------------------------------------------------------------------

SUMMARY

=======

If you are running a regular version of Microsoft Windows 3.x (not

Windows for Workgroups or Windows NT) during the installation of

Microsoft Access version 1.0 or 1.1, Setup automatically inserts the

following MS-DOS command in the AUTOEXEC.BAT file:

   <MS-DOS directory>\SHARE.EXE /L:500

If you are running Windows for Workgroups, we recommend that you not

load this SHARE command.

MORE INFORMATION

================

Microsoft Access versions 1.0 and 1.1

-------------------------------------

Setup automatically detects Windows for Workgroups and does not

install SHARE if Windows for Workgroups is found.

Windows for Workgroups has its own sharing mechanism (VSHARE.386),

which is loaded with Windows by a SYSTEM.INI file entry. VSHARE.386

is intended as a replacement for SHARE.EXE.

SHARE.EXE is dependent on the number of locks specified by the /L:

parameter, with a default of 20. VSHARE.386, on the other hand,

allocates the number of locks dynamically.

Because VSHARE.386 is a 386 enhanced mode virtual device driver (VxD),

it contains features that improve file sharing when running in 386

enhanced mode.  Because it was designed to work with Windows for

Workgroups, VSHARE.386 has greater usability features than SHARE.EXE,

especially regarding access control.

If SHARE.EXE is loaded and you start Windows for Workgroups in 386

enhanced mode, VSHARE.386 takes over file sharing control until you

exit Windows. If you usually run Windows for Workgroups in 386

enhanced mode, you may not need to run SHARE.EXE at all, saving you 5K

or more of conventional memory. The number of locks available is

especially important if you are using your Windows for Workgroups

machine as a network server.

Microsoft Access version 2.0

----------------------------

Microsoft Access version 2.0 will install VSHARE.386 instead of modifying

the AUTOEXEC.BAT file to load SHARE.EXE. If you are already loading

SHARE.EXE in the AUTOEXEC.BAT file, Microsoft Access will leave the line

in the AUTOEXEC.BAT file alone, but will still install VSHARE.386. When

you enter 386 enhanced mode, VSHARE.386 will take over from SHARE.EXE.

Additional reference words: 1.00 1.10 2.00 WFW vshare

KBCategory:

KBSubcategory: StpNet


INF: Sample DDE Macro Communicates with Microsoft Excel 4.0

Article ID: Q97522

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Excel for Windows, version 4.0

---------------------------------------------------------------------

SUMMARY

=======

The text below demonstrates communication between two applications

through dynamic data exchange (DDE). Specifically, one example shows a

macro developed for Microsoft Excel version 4.0 for Windows that

starts Microsoft Access, loads a database and runs a macro. A second

example shows an Access Basic function that loads Microsoft Excel and

runs a macro.

MORE INFORMATION

================

Running a Microsoft Access Macro from Microsoft Excel

-----------------------------------------------------

Perform the following three steps to demonstrate this behavior. These

steps assume that a "MESSAGE" macro already exists in Microsoft

Access.

1. In Microsoft Excel, choose New from the File menu, select Macro

   Sheet and choose OK.

2. Enter the following macro into the macro sheet. Substitute the

   appropriate location for files on your computer.

      =EXEC("c:\access\msaccess.exe c:\access\db4.mdb")

      Chan=INITIATE("MSACCESS","system")

      =APP.ACTIVATE("Microsoft Access")

      =EXECUTE(Chan,"MESSAGE")

      =TERMINATE(Chan)

      =RETURN()

3. To run the macro, select the first cell, select Run from the Macro

   menu and choose OK.

The EXEC function in the macro loads Microsoft Access minimized and

loads the DB4.MDB database. The macro initiates a DDE channel and

assigns it to the variable Chan. The APP.ACTIVATE switches to the

Microsoft Access window to show the macro actions running.

The EXECUTE function runs a macro named "MESSAGE," as follows.

   Name Summary

   --------------------------------

   Application Name: "MSACCESS"

   Window Title: "Microsoft Access"

   Topic: "System"

   Item: "Message"

Running a Microsoft Excel Macro from Microsoft Access

-----------------------------------------------------

Perform the following two steps to demonstrate this behavior. These

steps assume that a macro named "Message" already exists in a

Microsoft Excel macro sheet named "MACRO1.XLM."

1. In Microsoft Access, create a new function that contains the

   following code. Substitute the appropriate location for files on

   your computer.

      Function CallExcel ()

         Dim Chan

         x = Shell("c:\excel\excel.exe c:\excel\macro1.xlm", 1)

         Chan = DDEInitiate("Excel", "System")

         DDEExecute Chan, "[Run(""macro1.xlm!Message"")]"

         DDETerminate Chan

      End Function

2. Create a new blank form and place a command button on it.

3. Select the button.

4. From the View menu, choose Properties.

5. Set the button's OnPush property to the following:

      = CallExcel()

   Note that the OnPush property is renamed OnClick in Microsoft Access

   version 2.0.

6. View the form in Form view.

7. Choose the command button to start the function.

The Shell function loads Microsoft Excel and the "MACRO1.XLM" macro

sheet full screen and leaves the focus on Microsoft Excel. The macro

initiates a DDE channel and assigns it to the variable Chan.

The EXECUTE function runs a macro named "Message."

   Name Summary

   -------------------------------------

   Application Name: "Excel"

   Window Title: "Microsoft Excel"

   Topic: "System"

   Item: "[Run(""macro1.xlm!Message"")]"

The syntax for these two macros demonstrates that the correct syntax

for the "Item" depends on the target application.

REFERENCES

==========

"Microsoft Excel Function Reference", version 4.0, pages 14 - 15

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpDde


INF: Sample Expressions to Extract Portion of Text String

Article ID: Q115915

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists sample expressions that you can use in Microsoft Access

to extract a portion of a text string. These expressions are commonly used

in the Update To line of an update query to place a portion of a larger

field into a new field. These expressions can be adapted for use with other

common formats. For example, the expression used to extract "Doe" from

"Doe, John" can be used to extract "Seattle" from "Seattle, WA."

MORE INFORMATION

================

The following expressions are sample expressions that you can use in

Microsoft Access to extract a portion of a text string.

NOTE: In the following sample expressions, an underscore (_) at the end of

a line is used as a line-continuation character. Remove the underscore from

the end of the line when re-creating the expression.

          Original Entry          Returned by Expression

--------------------------------------------------------------------

[Names] = "John Doe"              John

Expr: Left([Names],InStr(1,[Names]," ")-1)

[Names] = "John Doe"              Doe

Expr: Right(Trim([Names]),Len(Trim([Names]))-InStr(1,[Names]," "))

[Names] = "Doe, John"             Doe

Expr: Left([Names],InStr(1,[Names],",")-1)

[Names] = "Doe, John"             John

Expr: Right(Trim([Names]),Len(Trim([Names]))-InStr(1,[Names]," "))

[Names] = "John P. Doe"           Doe

Expr: Right(Trim([Names]),Len(Trim([Names]))-InStr(InStr(1,[Names],_

      " ")+1,[Names]," "))

[Names] = "John P. Doe"           John

Expr: Left([Names],InStr(1,[Names]," ")-1)

[Names] = "John P. Doe"           P.

Expr: Mid([Names],InStr(1,[Names]," ")+1,InStr(InStr(1,[Names],_

      " ")+1,[Names]," ")-InStr(1,[Names]," "))

[Names] = "Doe, John P."          P.

Expr: Right(Trim([Names]),Len(Trim([Names]))-InStr(InStr(1,[Names],_

      " ")+1,[Names]," "))

[ZipCode] = "98052-6399"          98052

Expr: Left([ZipCode],5)

[Phone] = (206) 635-7050          206

Expr: Mid([Phone],2,3)

[Phone] = (206) 635-7050          635-7050

Expr: Right(Trim([Phone]),8)

Additional reference words: 1.00 1.10 2.00 parse

KBCategory:

KBSubcategory: ExrOthr


INF: Sample Function CopyFile() to Copy Disk Files

Article ID: Q102671

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Access Basic does not have a command, such as the MS-DOS COPY command,

to copy a disk file.

This article includes two variations of an Access Basic function

called CopyFile(), both of which allow you to copy disk files.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

Two variations of the Access Basic CopyFile() function are provided

below. The first version uses only Microsoft Access Basic code; the

second leverages some function calls to the Windows application

programming interface (API) to optimize performance, particularly with

larger files.

NOTE: You may have some Windows API functions defined in an existing

Microsoft Access library; therefore, your declarations may be

duplicates. If you receive the duplicate procedure name error message

when you compile or run your code, remove or comment out the

appropriate declarations statement from your code.

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

Method 1: CopyFile() Function Using Standard Access Basic Code

--------------------------------------------------------------

'**************************************************************

' DECLARATION SECTION

'**************************************************************

Option Explicit

'**************************************************************

' FUNCTION: CopyFile()

' PURPOSE:

'   Facilitates copying a disk file.

' ARGUMENTS:

'   Source      - The path\filename of the file to copy from.

'   Destination - The path\filename of the file to copy to.

' RETURN:

'   The length of the file copied.

'**************************************************************

Function CopyFile (ByVal Source$ ByVal Destination$) As Long

    Dim Index As Integer, NumBlocks As Integer

    Dim FileLength As Long, LeftOver As Long, AmountCopied As Long

    Dim SourceFile As Integer, DestFile As Integer

    Dim FileData As String

    Dim RetVal As Variant

    Const BlockSize = 32768

    On Error GoTo Err_CopyFile

    ' Remove the destination file.

    DestFile = FreeFile

    Open Destination For Output As DestFile

    Close DestFile

    ' Open the source file to read from.

    SourceFile = FreeFile

    Open Source For Binary Access Read As FreeFile

    ' Open the destination file to write to.

    DestFile = FreeFile

    Open Destination For Binary As DestFile

    ' Get the length of the source file.

    FileLength = LOF(SourceFile)

    ' Calculate the number of blocks in the file and left over.

    NumBlocks = FileLength \ BlockSize

    LeftOver = FileLength Mod BlockSize

    ' Create a buffer for the leftover amount.

    FileData = String$(LeftOver, 32)

    ' Read and write the leftover amount.

    Get SourceFile, , FileData

    Put DestFile, , FileData

    ' Create a buffer for a block to be read.

    FileData = String$(BlockSize, 32)

    ' Read and write the remaining blocks of data.

    For Index = 1 To NumBlocks

       ' Read and write one block of data.

       Get SourceFile, , FileData

       Put DestFile, , FileData

    Next Index

    Close SourceFile, DestFile

    CopyFile = AmountCopied

Bye_CopyFile:

    Exit Function

Err_CopyFile:

    CopyFile = -1 * Err

    Resume Bye_CopyFile

End Function

Method 2: CopyFile() Function Using Standard Access Basic Code

--------------------------------------------------------------

'****************************************************************

' DECLARATION SECTION

'****************************************************************

Declare Function fWrite Lib "kernel" Alias "_lwrite" (ByVal hFile%,

                    ByVal lpBuff&, ByVal nBuff%) As Long

Declare Function fRead Lib "kernel" Alias "_lread" (ByVal hFile%,

                    ByVal lpBuff&, ByVal nBuff%) As Long

Declare Function GlobalAlloc Lib "Kernel" (ByVal wFlags%,

                    ByVal dwBytes&) As Integer

Declare Function GLobalFree Lib "kernel" (ByVal hMem%) As Long

Declare Function GlobalLock Lib "Kernel" (ByVal hMem%) As Long

Declare Function GLobalUnlock Lib "kernel" (ByVal hMem%) As Long

'****************************************************************

' FUNCTION: CopyFile()

' PURPOSE:

'   Facilitates copying a disk file.

' ARGUMENTS:

'   Source      - The path\filename of the file to copy from.

'   Destination - The path\filename of the file to copy to.

' RETURN:

'   The length of the file copied, if successful.

'***********************************************************

Function CopyFile (ByVal Source$, ByVal Destination$) As Long

    Dim FileLength As Long, AmountCopied As Long

    Dim RetVal As Variant, lpBuff As Long

    Dim DestFile As Integer, SourceFile As Integer

    Dim DestDOS As Integer, SourceDOS As Integer

    Dim ApiErr As Integer, AmtRead As Integer

    Dim hMem As Integer

    Const nBuff = 32767

    Const wFlags = &H20

    On Error GoTo Err_CopyFile

    ' Get the size of the file.

    SourceFile = FreeFile

    Open Source For Binary Access Read As SourceFile

    FileLength = LOF(SourceFile)

    Close SourceFile

    ' Allocate and lock memory to buffer file contents.

    hMem = GlobalAlloc(wFlags, nBuff)

    lpBuff = GlobalLock(hMem)

    ' Open the source file to read from.

    SourceFile = FreeFile

    Open Source For Input As SourceFile Len = 1

    ' Open the destination file to write to.

    DestFile = FreeFile

    Open Destination For Output As DestFile Len = 1

    ' Get the operating system file handles.

    DestDOS = FileAttr(DestFile, 2)

    SourceDOS = FileAttr(SourceFile, 2)

    Do

       ' Read and write nBuff worth of data.

       AmtRead = fRead(SourceDOS, ByVal lpBuff, nBuff)

       ApiErr = fWrite(DestDOS, ByVal lpBuff, AmtRead)

       AmountCopied = AmountCopied + AmtRead

    Loop Until AmtRead = 0

    Close SourceFile, DestFile

    ' Unlock and free the file buffer memory.

    lpBuff = GLobalUnlock(hMem)

    hMem = GLobalFree(hMem)

    CopyFile = AmountCopied

Bye_CopyFile:

    Exit Function

Err_CopyFile:

    CopyFile = -1 * Err

    Resume Bye_CopyFile

End Function

The CopyFile() function can be tested from the Immediate window, as

follows:

1. Create or open a module in Microsoft Access.

2. From the View menu, choose Immediate Window.

3. Type the following and press ENTER:

      ? CopyFile(C:\WINDOWS\CHESS.BMP", "C:\CHESS.BMP")

   The CopyFile() function can be invoked from an Access Basic

   function

      Dim RetVal As Long

      RetVal = CopyFile("C:\WINDOWS\CHESS.BMP", "C:\CHESS.BMP")

   or by using the RunCode macro action:

      RunCode

      Function Name: CopyFile("C:\WINDOWS\CHESS.BMP", "C:\CHESS.BMP")

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to Build a Repeating String

Article ID: Q109941

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates a sample Access Basic function called

Replicate() that you can use to build a string with repeating

characters.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

The Replicate() function requires two arguments. These arguments are a

string expression and an integer representing the number of times you

want to repeat the string expression. For example, if you supply the

string expression ABC and the integer 3 to the Replicate() function, it

will return the string:

   ABCABCABC

The Replicate() function is similar to the String$() function, except

that the String$() function only repeats the first character of the given

string expression.

To create the Replicate() function, type the following code in a new or

existing module:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   '******************************************************

   'Declarations Section of Module

   '******************************************************

   Option Explicit

   '======================================================

   ' Purpose: To build a string of replicated characters.

   ' Accepts: A string expression to be replicated.

   '          An integer representing the number of times

   '          the string expression is to be repeated.

   ' Returns: A string.

   '======================================================

   Function Replicate (Number As Integer, StringExpr As String)

      Dim RepString As String, i As Integer

      For i = 1 To Number

         RepString = RepString & StringExpr

      Next i

      Replicate = RepString

   End Function

To test the Replicate() function, type the following in the Immediate

window, and then press ENTER:

   ? Replicate(3,"ABC")

The following will be printed in the Immediate window:

   ABCABCABC

You can substitute any integer and any string expression for the

arguments in the above example.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, "For...Next

Statement," pages 198-199

Additional reference words: 1.00 1.10 2.00 replicate function ab string

KBCategory:

KBSubcategory: ExrOthr


INF: Sample Function to Capitalize Words and Phrases

Article ID: Q110391

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample user-defined function called Proper() that

you can use to capitalize the first character of a word or set of words.

There are two variations of the Proper() function:

 - One variation is used in the AfterUpdate property of a control on a

   form, primarily for data entry.

 - The other variation is used in calculated query fields, calculated

   controls on forms and reports, macro SetValue expressions, and Access

   Basic expressions.

NOTE: Microsoft Access version 2.0 includes a sample Proper() function in

the sample database SOLUTION.MDB. The Proper() function is located in the

Proper module.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual.

MORE INFORMATION

================

To create the Proper() function, enter the following code in a module:

'**********************************************************

'Declarations section of the module

'**********************************************************

   Option Explicit

'==========================================================

'The following function is designed for use in the AfterUpdate

' property of form controls.

'Features:

'    - Leading spaces do not affect the function's performance.

'    - "O'Brian" and "Wilson-Smythe" will be properly capitalized.

'Limitations:

'    - It will change "MacDonald" to "Macdonald."

'    - It will change "van Buren" to "Van Buren."

'    - It will change "John Jones III" to "John Jones Iii."

'==========================================================

Function Proper (AnyValue As Variant) As Variant

   Dim ptr As Integer

   Dim TheString As String

   Dim currChar As String, prevChar As String

   If IsNull(AnyValue) Then

      Exit Function

   End If

   TheString = CStr(AnyValue)

   For ptr = 1 To Len(TheString)         'Go through each char. in string.

      currChar = Mid$(TheString, ptr, 1) 'Get the current character.

      Select Case prevChar               'If previous char. is a letter,

                                         'this char. should be lowercase.

         Case "A" To "Z", "a" To "z"

            Mid(TheString, ptr, 1) = LCase(currChar)

         Case Else

            Mid(TheString, ptr, 1) = UCase(currChar)

      End Select

      prevChar = currChar

   Next ptr

   AnyValue = CVar(theString)

End Function

How to Use This Function in the AfterUpdate Property of a Control

-----------------------------------------------------------------

1. Create a form based on a table or query.

2. Type the following in the AfterUpdate property of a text box

   control:

      =Proper(<control name>)

   For example, if the ControlName is [Full Name], type the following:

      =Proper([Full Name])

How to Modify This Function for Expressions and Calculated Controls

-------------------------------------------------------------------

1. Enter the code shown above to create the Proper() function.

2. Modify the following section of code

         AnyValue=CVar(theString)

      End Function

   To read as follows:

         Proper=CVar(theString)

      End Function

Examples

--------

The examples below all require the second version of the Proper()

function.

Using Proper() in a Query:

   Field: Full Name:Proper([Last Name] & " " & [First Name])

   This will concatenate the first and last names and capitalize the

   first letter of each.

Using Proper() in a Calculated Control on a Form or Report:

   TextBox

   ---------------------------------

   ControlName: AddressP

   ControlSource: =Proper([Address])

   NOTE: In calculated fields, the ControlName must be unique.

Using Proper() in a Macro:

   Action: SetValue

   Item: Screen.ActiveControl

   Expression: Proper(Screen.ActiveControl)

   NOTE: You can call this macro from the AfterUpdate property of a control

   on a form. This has the same affect as the first version of the Proper()

   function.

REFERENCES

==========

For more information about methods of calling a function, please see the

following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q97514

   TITLE     : INF: Writing Functions Called from Events or Expressions

For more information about manipulating text strings, please see the

following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q115915

   TITLE     : INF: Sample Expressions to Extract Portion of Text String

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to Determine the Access Startup Directory

Article ID: Q88174

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not have a built-in command to return the Microsoft

Access startup directory. However, you can accomplish this by making

Windows application programming interface (API) calls in Access Basic.

This article describes the steps involved in creating a function that

returns the Microsoft Access startup directory.

MORE INFORMATION

================

The Access Basic CurDir$() function returns the current directory.

Because Microsoft Access can be started from a directory other than the

current directory or the current directory can be changed with the ChDir

statement, the CurDir$() function cannot be used to determine the

startup directory.

The following sample program module makes use of the Windows API functions

GetModuleHandle() and GetModuleFileName(). With the module handle, the

path can be obtained with the GetModuleFileName() function.

Creating the Module

-------------------

The following steps demonstrate how to create the sample Access Basic

function that returns the startup directory:

1. From the File menu, choose New, and select Module.

2. In the Declarations section of the module, enter the following

   Declare statements:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Option Explicit

      Declare Function GetModuleHandle% Lib "kernel" (ByVal FileName$)

      Declare Function GetModuleFileName% Lib "kernel" (ByVal hModule%,_

                          ByVal FileName$, ByVal nSize%)

3. Enter the following to create the function:

      Function StartUp_Dir ()

      Dim hModule%, Buffer$, Length%, Msg$

         hModule% = GetModuleHandle("MSACCESS.EXE")

         Buffer$ = Space$(255)

         Length% = GetModuleFileName(hModule%, Buffer$, Len(Buffer$))

         Buffer$ = Left$(Buffer$, Length%)

         Msg$ = "Startup path and filename: " & Buffer$

         MsgBox Msg$

      End Function

4. From the Run menu, choose Compile Loaded Modules in Microsoft Access

   version 1.x, or choose Compile All in version 2.0.

5. Save the module as Startup Directory.

6. From the View menu, choose Immediate window. Type the following in

   the Immediate window, and then press ENTER:

      ? StartUp_Dir()

   The Microsoft Access startup directory should be displayed in the

   Immediate window.

Uses and Variations

-------------------

The Startup directory is displayed when the following command is issued in

the Immediate window:

   ? StartUp_Dir()

This function can also be incorporated into other program modules, and can

be used in expressions. For example, entering =Startup_Dir() as the OnPush

or OnClick property of a button on a form returns the startup directory of

Microsoft Access whenever the button is chosen.

NOTE: You can change the MSACCESS.EXE argument for the Windows API

GetModuleHandle() function so that the function returns the startup

directory of another program started in the Windows environment.

Furthermore, you can pass a program name as a variable to the Windows API

function, giving even more flexibility to the function.

REFERENCES

==========

For more information on Windows API calls, query on the following words

here in the Microsoft Knowledge Base:

   handle and api and dll and kernel and user and gdi

"Microsoft Windows Software Development Kit," Microsoft Press, 1992

"Programming Windows: the Microsoft Guide to Writing Applications for

Windows 3," Charles Petzold, Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to

Programming Reference," Volumes 1 - 6, Microsoft Press, 1992

Additional reference words: 1.00 1.10 2.00 On Push

KBCategory:

KBSubcategory: PgmApi


INF: Sample Function to Determine the Existence of a Query

Article ID: Q88170

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to determine the existence of a query with

Access Basic code.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

Microsoft Access does not have a function to determine the existence

of a specific query. Using Access Basic code, you can determine if a query

exists in the database.

You can use the following sample function to return the existence of

a query:

1. Open the sample database NWIND.MDB and create a new module with the

   following function:

'********************************************************

'Declarations section of the module

'********************************************************

Option Compare Database

Option Explicit

'===============================================================

' The following function is named IsQuery().  It accepts a string

' argument and returns either True(-1) or False(0).

'================================================================

Function IsQuery (QueryName As String) As Integer

    Dim DB As Database

    Dim Snap As Snapshot

    Set DB = CurrentDB()

    Set Snap = DB.ListTables()

    Snap.MoveFirst

    IsQuery = False

    Do Until Snap.eof

        If Snap![Name] = QueryName And Snap![TableType] = DB_QUERYDEF Then

            IsQuery = True

        End If

        Snap.MoveNext

    Loop

    Snap.Close

End Function

2. From the View menu, choose Immediate Window. Enter the following

   command, and then press ENTER:

      ?IsQuery("Order Information")

3. "-1" should be displayed in the Immediate window (-1 represents

   True in Microsoft Access).

4. Experiment by calling the function with a nonexistent query. This

   should display "0" (which represents False).

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to Find File Associations

Article ID: Q109931

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates a sample Access Basic function that you can use

to obtain the executable filename associated with a document filename by

calling the Microsoft Windows API function FindExecutable().

MORE INFORMATION

================

The following sample function requires a path string parameter and a

filename string parameter. The function returns the path of the associated

file.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   ' *** Declarations Section ***

   Option Explicit

   Declare Function FindExecutable% Lib "Shell" (ByVal lpszFile$, _

      ByVal lpszDir$, ByVal lpszResult$)

   Function GetAssociation (Path As String, FileName As String)

      Dim Result As String, X As Integer

      Result = Space$(256)

      X = FindExecutable(FileName, Path, Result)

      GetAssociation = Result

   End Function

To find the path and name of the executable file associated with a file

called MYDB.MDB that is located in the root directory on the D drive you

could type the following in an Immediate window:

   ? GetAssociation ("D:\", "MYDB.MDB")

The function would return

   D:\ACCESS.100\MSACCESS.EXE

if the MYDB.MDB file was associated with the MSACCESS.EXE executable file

located in the ACCESS.100 directory on the D drive.

REFERENCES

==========

Microsoft Windows Software Development Kit "Programmer's Reference,

Volume 2: Functions," Version 3.1, pages 303-305

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to Generate a Random Temporary File Name

Article ID: Q88929

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use a sample function to generate a

random file name that can be used for a temporary file.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

Sometimes it is necessary for an application to create a file that is

used temporarily, then deleted. The name of temporary files are

important because you do not want your application to inadvertently

overwrite an existing file.

In such cases, you can create and use the user-defined function called

MakeTempFileName(). This function accepts a file extension and returns a

string representing a non-existent, random filename with the file extension

you specified. The filename includes a path to your Windows TEMP directory

so that the temporary file is placed in the same directory Windows uses to

write its temporary files. This is handy for those who perform periodic

maintenance on their hard drive and delete any leftover temporary files in

the Windows TEMP directory.

You can create the sample function MakeTempFileName() by entering the

following in a module:

   Function MakeTempFileName (Extension As String) As String

      On Error Resume Next

      IsFile% = False

      FHandle% = FreeFile

      Do

         WinTemp$ = Environ("TEMP") & "\"

         For Cntr% = 1 To 8

         WinTemp$ = WinTemp$ & Mid(LTrim(Str(CInt(Rnd * 10))), 1, 1)

         Next

         TF$ = Trim(WinTemp$) & "." & Extension

         Open TF$ For Input As #FHandle%

      Loop While Err > 0

      Close #FHandle%

      MakeTempFileName = TF$

   End Function

To test the function, type the following in the Immediate window. The

MakeTempFileName() function will return a name that is used as a text

file. The text file will fill with some text, and then be deleted:

   TempFileName$ = MakeTempFileName("TMP")

   Open TempFileName$ For Output As #1

   Print #1, "This is a line of text"

   Close #1

   Kill TempFileName$

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to List Groups in System Database

Article ID: Q109720

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample Access Basic function to list the groups in

your Microsoft Access system database.

Notes

-----

 - The technique described below relies on the use of tables stored with

   your SYSTEM.MDA file. These tables are undocumented and are subject to

   change in future versions of Microsoft Access. Use of the system tables

   is not supported by Microsoft.

 - This article assumes that you are familiar with Access Basic and with

   creating Microsoft Access applications using the programming tools

   provided with Microsoft Access. For more information on Access Basic,

   please refer to the "Introduction to Programming" manual in Microsoft

   Access version 1.x, or the "Building Applications" manual in version

   2.0.

MORE INFORMATION

================

The following function returns a comma-separated list of the groups in your

Microsoft Access system database. The function takes one argument that

specifies the complete path and filename for the SYSTEM.MDA file that you

want to query:

1. Add the following code to a new or existing module:

      '**********************************

      'Declarations section of the module

      '**********************************

      Option Explicit

      '****************************

      'The CurrentGroups() function

      '****************************

      Function CurrentGroups (SysDB As String)

         Dim DB As Database

         Dim DS As Dynaset

         Dim CurrUser As String, Groups As String

         Dim Counter As Integer

         Set DB = OpenDatabase(SysDB)

         Set DS = DB.CreateDynaset("MSysGroupList")

         DS.MoveLast

         DS.MoveFirst

         For Counter = 1 To DS.RecordCount

            Groups = Groups & IIf(Len(Groups) > 0, ",", "") & DS![Name]

            DS.MoveNext

         Next Counter

         DS.Close

         DB.Close

         CurrentGroups = Groups

      End Function

2. To call this function on a computer where the SYSTEM.MDA file is located

   in the ACCESS directory on drive C, type the following in the module's

   Immediate window:

      ? CurrentGroups("C:\ACCESS\SYSTEM.MDA")

   A system that has had no groups added will return the following list:

      Admins,Guests,Users

NOTE: In Microsoft Access version 2.0, you can use the Print Security

command from the Security menu to get a list of users and groups in the

current system database. You can use the sample function in this article to

list the groups in any other system database.

REFERENCES

==========

For more information about Microsoft Access security and groups, search for

"security: users/groups" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ScrtOthr


INF: Sample Function to Make ENTER Add Lines in a Text Box

Article ID: Q89590

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Text boxes in Microsoft Access do not support using the ENTER key to

add lines within a field. When ENTER is pressed in a text box, the next

field or control is selected. This article describes a sample function

that you can use to modify the action that results when you press ENTER so

that a line is added to the current field instead of selecting the next

field.

MORE INFORMATION

================

The following sample function changes the behavior of the ENTER key in

text boxes to allow adding lines instead of selecting a different field

or control. This code should be attached to the BeforeUpdate event of the

text box:

In the Declarations section of a module, enter the following:

   Option Explicit

   Declare Function GetKeyState% Lib "user.exe" (ByVal nKey%)

   Const VK_RETURN = &HD

The following is the sample function MakeEnterWork():

   Function MakeEnterWork()

      If GetKeyState(VK_RETURN) < 0 Then

         DoCmd CancelEvent

         SendKeys "^{ENTER}"

      End If

   End Function

NOTE: Some change must be made to the text box before this function

will work because Microsoft Access evaluates controls only after they

have been modified.

Additional reference words: 1.00 1.10 2.00 carriage return memo

KBCategory:

KBSubcategory: GnlGlobl


INF: Sample Function to Open a Form to a Particular Record

Article ID: Q109818

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a sample Access Basic function you can use to open a

form to a particular record using the InputBox() function.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

To create the sample function OpenFormWithInput(), enter the following

Declarations and function in a module:

  '==================================

  'Declarations section

  '==================================

  Option Compare Database   'Use database order for string comparisons

  Option Explicit

  '==================================

  'Code section

  '==================================

  Function OpenFormWithInput ()

  Dim Msg, Title, Defvalue, Answer

      Msg = "Enter a Customer ID (ALWAO, BABUJ, EASTC, FOODI, etc.)."

      Title = "OPEN CUSTOMERS FORM"

      Defvalue = "ALWAO"

      Answer = InputBox(Msg, Title, Defvalue)

      If Answer <> "" Then

         DoCmd OpenForm "Customers", , , "[Customer ID]='" & Answer & "' "

  Else

         DoCmd OpenForm "Customers"

      End If

  End Function

The OpenFormWithInput() function will open the form with the record whose

Customer ID matches the value entered in the input box as the only record

in its dynaset. If you change "=" to ">=" in the DoCmd OpenForm line in the

function, the form will open to the record you want and display subsequent

records to the chosen one as well.  For example, if "BABUJ" was the

customer entered in the input box, Customer ID "ALWAO" would not be

available, but "WOLVH" would.

To call the function, attach it to a command button's OnPush property, or

attach it to the form's OnOpen property. Choosing the input box's Cancel

button will cause the form to open at the default record with all of the

records available.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 22, "Using Macros

with Forms," pages 532-534, version 1.1, pages 536-537

Microsoft Access "Language Reference," version 1.0, "Input, Input$

Functions," pages 257-258, "OpenForm Action," pages 348-351

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to Provide Password for Attached Tables

Article ID: Q109829

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you first attach an external table you have the option to store the

User ID and password for the table locally. If you do not store the ID and

password locally you will be prompted later for the ID and password when

the table is opened (either manually or programmatically).

This article describes a sample function you can use in Microsoft Access

versions 1.1 and 2.0 to eliminate the login prompt when the table is

opened.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

===============

The following steps demonstrate how to eliminate the login prompt when you

open an attached table:

1. You must first provide your login information. To do this, use one of

   the four standard ODBC dialog boxes, or create your own custom login

   box.

2. Use the sample function below (or one similar to it) to establish

   the connection.

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Function Establish_Connection ()

         Dim db As Database, Dim dbcurr As Database, Dim ds As Dynaset

         Set dbcurr = CurrentDB()

         Set db = OpenDatabase("", False, False,"ODBC;DSN=_

          <servername>;UID=<UserID>;PWD=<Password>;DATABASE=_

          <database name>;")

         Set ds = db.CreateDynaset("<any table existing in the _

          database defined by DATABASE above>")

      End Function

   Substitute your own server name, password, database name, and table name

   in the function above.

When this function is run Microsoft Access will establish a connection with

the server specified in the function. The Connection Manager will then

store the connection information, enabling you to open other attached

tables on that server without being prompted for the login information each

time. The Connection Manager will retain the login information until you

quit Microsoft Access.

Additional reference words: 1.00 1.10 2.00 Attaching

KBCategory:

KBSubcategory: ObcOthr


INF: Sample Function to Remove Alphas from a Numeric Field

Article ID: Q99938

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a sample Microsoft Access function

called RemoveAlphas() to remove alpha, or nonnumeric, characters from an

alphanumeric string. All nonnumeric characters will be removed.

A common use for the RemoveAlphas() function is to remove the parentheses,

dashes, and spaces from a telephone number or social security number field.

The following strings contain parentheses, dashes, and spaces:

   "(206) 635-7050"

   "206-635-7050"

   "535-87-4529"

After the RemoveAlphas() function is run, these strings will be:

   "2066357050"

   "2066357050"

   "535874529"

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

The following example demonstrates how to create the RemoveAlphas()

function, and how to use it either while data is being entered, or in an

update query to remove nonnumeric characters from phone numbers in a

table.

How to Create the RemoveAlphas() Function

-----------------------------------------

1. Create a new module.

2. In the Module window, type "Option Explicit" (without the quotation

   marks).

3. From the Edit menu, choose New Procedure.

4. Type "RemoveAlphas" (without the quotation marks) in the Name box, and

   select Function in the Type box. Choose OK.

5. Type the following function in the Module window:

      Function RemoveAlphas (AlphaNum)

         Dim Clean As String

         Dim Pos, A_Char$

         Pos = 1

         For Pos = 1 To Len(AlphaNum)

            A_Char$ = Mid(AlphaNum, Pos, 1)

            If A_Char$ >= "0" And A_Char$ <= "9" Then

              Clean$ = Clean$ + A_Char$

            End If

         Next Pos

         RemoveAlphas = Clean$

         AlphaNum = Clean$

      End Function

6. Save the module with any unique name.

How to Use the RemoveAlphas() Function in Data Entry

----------------------------------------------------

You can use the RemoveAlphas() function to remove dashes or parentheses

while phone numbers are being typed into a field.

For a field called Phone, add the following AfterUpdate property to the

Phone text box on a form:

   =RemoveAlphas([Phone])

How to Use the RemoveAlphas() Function in an Update Query

---------------------------------------------------------

1. Create a new query based on the table with the phone number field.

2. Place the phone number field in the first column of the query grid.

3. From the Query menu, choose Update.

4. In the Update To row, enter the following for a field named Phone:

      RemoveAlphas([Phone])

5. Run the query.

Additional reference words: 1.00 1.10 2.00 AB ssn hyphens

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to Replace Special Characters

Article ID: Q109825

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you import a text file that contains tabs or other special

characters into Microsoft Access, the special characters are converted

and displayed as boxes. You cannot use the Find and Replace commands to

find these converted characters. This article describes a sample Access

Basic function you can use to find and replace the converted tabs and

other special characters.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The following steps can be used to find and replace converted

special characters:

1. Create a new module and add the following code:

      '************************************************************

      'Declarations section of the module

      '************************************************************

      Option Compare Binary

      Option Explicit

      '============================================================

      'The following function will:

      ' - Find the tabs in a text or memo field

      ' - Call another function to replace the tabs

      '============================================================

      Function FindTabs (WhichField As String) as String

         Dim x As Integer, Text As String

         Dim start As Integer

            start = 1

            x = 1

            Text = WhichField

            Do Until x = 0

               x = InStr(start, Text, Chr(9))

               start = x

               If x > 0 And Not IsNull(x) Then

                  Text = ReplaceTabs(x, Text)

               End If

            Loop

            FindTabs = Text

      End Function

      '==================================================================

      'The following function is called from the FindTabs() function. It

      'accepts two arguments, text and start. The function replaces tabs

      'with %. It returns the updated text.

      '==================================================================

      Function ReplaceTabs(start As Integer, text As String) As String

         Mid(text, start, 1) = "%"

         ReplaceTabs = text

      End Function

2. Create a query based on the table to which the text file was imported.

3. Add the field containing the special characters to the QBE grid.

4. Convert the query to an update query by choosing Update from the Query

   menu.

5. Add the following to the Update To line for the field(s) containing the

   special characters:

      FindTabs([fieldname])

6. Run the query.

REFERENCES

==========

For more information about special characters, search for "ANSI Character"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 find/replace recognize

KBCategory:

KBSubcategory: GnlFnd


INF: Sample Function to Return a Random Record

Article ID: Q108435

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access does not contain a built-in mechanism for returning a

random record from a set of records. This article describes a sample user-

defined Access Basic function you can use to return a random record.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The following sample function will return a random record using the

recordset name and field name that you supply. To create this function,

add the following to the Global Declarations section

   Option Explicit

and then enter the following in the module:

   Function FindRandom (RecordSetName$, Fieldname$)

       Dim MyDB As Database

       Dim MyDyna As Dynaset

       Dim SpecificRecord&, i&, NumOfRecords&

       Set MyDB = CurrentDB()

       Set MyDyna = MyDB.CreateDynaset(RecordSetName$)

       On Error GoTo NoRecords

       MyDyna.MoveLast

       NumOfRecords& = MyDyna.RecordCount

       SpecificRecord& = Int(NumOfRecords * Rnd)

       If SpecificRecord& = NumOfRecords Then

           SpecificRecord& = SpecificRecord& - 1

       End If

       MyDyna.MoveFirst

       For i = 1 To SpecificRecord&

           MyDyna.MoveNext

       Next i

       FindRandom = MyDyna(Fieldname$)

       Exit Function

   NoRecords:

       If Err = 3021 Then

           MsgBox "There Are No Records In The Dynaset", 16, "Error"

       Else

           MsgBox "Error - " & Err & Chr$(13) & Chr$(10) & Error,_

           16, "Error"

       End If

       FindRandom = "No Records"

       Exit Function

   End Function

To test the function, type the following in the module's Immediate window:

   ? FindRandom("<RecordSetName>", "<FieldName>")

Substitute the name of your recordset for <RecordSetName> and the name of

a field in your recordset for <FieldName>.

Each time you run the function, a different record will be returned.

REFERENCES

==========

For more information on returning random records using a query, query on

the following words here in the Microsoft Knowledge Base:

   return and random and record and rnd

For more information on the Int() function or the Rnd() function, search

for "Int" or "Rnd" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 ADK

KBCategory:

KBSubcategory: PgmOthr


INF: Sample Function to Return Variable's Data Type Name

Article ID: Q109945

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The built-in VarType() function returns a value that indicates a

variable's data type. This article describes a sample Access Basic

function you can use to return the data type's name.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic," in version 2.0.

MORE INFORMATION

================

To create the sample function DataTypeName(), type the following code in

a new or existing module:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code

in Access Basic.

   '******************************************************

   'Declarations Section of Module

   '******************************************************

   Option Explicit

   '======================================================

   ' Purpose: To return the data type name.

   ' Accepts: A data type value.

   '======================================================

   Function DataTypeName (MyValue)

      DataTypeName = Choose(VarType(MyValue) + 1, "Empty", _

         "Null", "Integer", "Long", "Single", "Double", _

         "Currency", "Date", "String")

   End Function

To try the DataTypeName() function, type the following in the module's

Immediate window, and then press ENTER:

   ? DataTypeName(2)

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, "Choose Function,"

page 65, and "VarType Function," page 494

Additional reference words: 1.00 1.10 2.00 function ab datatype vartype

KBCategory:

KBSubcategory: ExrOthr


INF: Sample Function to Use the COMMDLG Color Dialog Box

Article ID: Q109390

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Palette in Microsoft Access provides a limited selection of colors for

database objects and does not allow you to create custom colors. However,

the BackColor, ForeColor, and BorderColor properties of forms and reports

will accept any valid RGB color value.

This article lists a sample Access Basic function called ChooseColor() that

uses the Microsoft Windows standard Color dialog box so that you can choose

from a greater selection of colors or create your own custom color.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

To set up the sample function ChooseColor(), create a new module with the

following Declarations section and function:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   '********************************************************************

   ' MODULE DECLARATION SECTION

   '********************************************************************

   Option Explicit

   '

   ' Required COMMDLG Declarations

   '

   Type ChooseColor

      lStructSize As Long

      hwndOwner As Integer

      hInstance  As Integer

      RgbResult As Long

      lpCustColors As Long

      Flags As Long

      lCustData As Long

      lpfnHook As Long

      lpTemplateName As Long

   End Type

   Global Const CC_RGBINIT = &H1

   Global Const CC_FULLOPEN = &H2

   Declare Function ChooseColor_API Lib "COMMDLG.DLL" Alias _

      "ChooseColor" (pCHOOSECOLOR As ChooseColor) As Integer

   Declare Function CommDlgExtendedError Lib "COMMDLG.DLL" () As Long

   '

   ' Global Memory Declarations

   '

   Declare Function GlobalAlloc Lib "Kernel" _

      (ByVal wFlags As Integer, ByVal dwBytes As Long) As Integer

   Declare Function GlobalFree Lib "Kernel" _

      (ByVal hMem As Integer) As Integer

   Declare Function GlobalLock Lib "Kernel" _

      (ByVal hMem As Integer) As Long

   Declare Function GlobalUnlock Lib "Kernel" _

      (ByVal hMem As Integer) As Integer

   Global Const GMEM_MOVEABLE = &H2

   Global Const GMEM_ZEROINIT = &H40

   Global Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)

   Declare Sub hmemcpy Lib "Kernel" _

      (lpDest As Any, lpSource As Any, ByVal dwBytes As Long)

   '********************************************************************

   ' FUNCTION: ChooseColor

   '

   ' PURPOSE:

   '   Uses the standard Windows Color dialog box in COMMDLG.DLL to get

   '   a 256-color RGB value for use in Microsoft Access. The returned

   '   value can be used in the BackColor, ForeColor, or BorderColor

   '   properties.

   '

   ' ARGUMENTS:

   '   DefaultColor - The default RGB color to be selected.

   '                  Black, 0, is usually the default.

   '

   ' RETURN VALUE:

   '   >=0  The user-selected RGB value

   '   -1   Couldn't allocate global memory

   '   -2   Couldn't lock global memory

   '   -3   COMMDLG error occurred. A message box will display the

   '        number prior to this function exiting.

   '

   ' ********************************************************************

   Function ChooseColor (ByVal DefaultColor As Long) As Long

      Dim C As ChooseColor

      Dim MemHandle As Long

      Dim Result As Integer, i As Integer

      ' Define CustomColor array, address, size variables

      ReDim CustomColors(15) As Long

      Dim CustomColorsAddress As Long

      Dim CustomColorsSize As Integer

      ' Fill custom colors array with all white

      For i = 0 To UBound(CustomColors)

         CustomColors(i) = &HFFFFFF

      Next

      ' Get size of global memory needed for custom colors

      CustomColorsSize = Len(CustomColors(0)) * 16

      ' Get a global memory block to hold a copy of the custom colors

      MemHandle = GlobalAlloc(GHND, CustomColorsSize)

      If MemHandle = 0 Then

         ChooseColor = -1

         Exit Function

      End If

      ' Lock the custom color's global memory block

      CustomColorsAddress = GlobalLock(MemHandle)

      If CustomColorsAddress = 0 Then

         ChooseColor = -2

         Exit Function

      End If

      ' Copy custom colors to the global memory block

      Call hmemcpy(ByVal CustomColorsAddress, _

         CustomColors(0), CustomColorsSize)

      ' Initialize Choose Color structure

      C.lStructSize = Len(C)

      C.hwndOwner = 0&

      C.lpCustColors = CustomColorsAddress

      C.RgbResult = DefaultColor

      C.Flags = CC_RGBINIT Or CC_FULLOPEN

      ' Call the Choose Color COMMDLG routine

      Result = ChooseColor_API(C)

      ' Did an error occur?

      If Result = 0 And CommDlgExtendedError() <> 0 Then

         ChooseColor = -3

         MsgBox Str$(CommDlgExtendedError()), 16, "Choose Color Error"

      End If

      ' Copy the new custom colors to the CustomColors address locally

      ' .. CustomColor array will now contain list of new custom colors

      Call hmemcpy(CustomColors(0), _

         ByVal CustomColorsAddress, CustomColorsSize)

      ' Unlock and free the global memory block

      Result = GlobalUnlock(MemHandle)

      Result = GlobalFree(MemHandle)

      ' Return the selected color

      ChooseColor = C.RgbResult

   End Function

How to Use the ChooseColor() Function

-------------------------------------

The following sample Access Basic function demonstrates how to use the

ChooseColor() function:

   Function GetColor()

      MsgBox Str$(ChooseColor(0))

   End Function

The GetColor() function calls the ChooseColor() function and selects black

as the default color. A message box will display the color selected in the

Color dialog box.

The GetColor() function can be called from a command button by entering the

following for the button's OnPush property:

   =GetColor()

Additional reference words: 1.00 1.10 2.00 commdlg.dll

KBCategory:

KBSubcategory: PgmApi


INF: Sample Functions to Send MCI Commands from Access Basic

Article ID: Q109371

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to create sample Access Basic functions that

you can use to make calls to the media control interface (MCI) using the

mciSendString() function to run a CD player application from Microsoft

Access.

NOTE: These sample functions require that you use Windows version 3.1 or

Multimedia Windows version 3.0, and a CD-ROM drive that supports MCI.

MORE INFORMATION

================

The sample program below uses several functions to control basic CD-ROM

drive features such as stop, play, and eject. The functions can be used in

any CD-ROM application you create. The sample program below is not a

complete application, but is rather a basis you can use to create a full-

featured application.

The simplest way to use these functions is to create a form with five

command buttons on it. Have each of the buttons call one of the five sample

functions below with its OnPush property.

To create these functions, create a new Access Basic module and enter the

following Declarations and functions:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   '******* Declarations Section *******

   Option Compare Database

   Option Explicit

   Declare Function mciSendString% Lib "MMSystem" (ByVal Sound$,_

        ByVal RtnString$, ByVal RtnLength%, ByVal Hndl%)

   Dim RetInt As Integer

   Dim RetStr As String * 64

   Dim mciStatement As String

   Global gTrackCurrent As Integer ' stores current track on CD.

   Global gTrackCount As Integer   ' stores count of tracks on CD.

   '******* Play Function *********

   Function CDPlay () As Integer

      ' This function initializes the audio device

      ' with the first call to mciSendString(), and

      ' then starts the CD playing with the second call.

      RetInt = mciSendString("Open CDAudio", "", 0, 0)

      CDPlay = mciSendString("Play CDAudio", "", 0, 0)

   End Function

   '******* Stop Function **********

   Function CDStop () As Integer

      ' This function stops the CD with the first call

      ' to mciSendString(), and closes the audio device

      ' with the second call.

      RetInt = mciSendString("Stop CDAudio", "", 0, 0)

      CDStop = mciSendString("Close CDAudio", "", 0, 0)

   End Function

   '******** Previous Track Function **********

   Function CDTrackPrevious ()

      Dim TrackPrevious As Integer

      ' Set time format to Tracks, minutes, seconds, and frames.

      RetInt = mciSendString("Set CDAudio Time Format TMSF", "", 0, 0)

      ' Retrieve the track number that is currently playing, and

      ' the total number of tracks on the CD. Store these values

      ' in global variables so that they are available to the form.

      mciStatement = "Status CDAudio Current Track"

      RetInt = mciSendString(mciStatement, RetStr, 63, 0)

      gTrackCurrent = Val(RetStr)

      TrackPrevious = gTrackCurrent - 1

      mciStatement = "Status CDAudio Number of Tracks"

      RetInt = mciSendString(mciStatement, RetStr, 63, 0)

      gTrackCount = Val(RetStr)

      ' Check to see if the current track is the first track. If it

      ' is seek to the beginning of the current track and play it.

      ' Otherwise, move to the previous track and play from there to

      ' the end of the CD.

      If TrackPrevious > 0 Then

         mciStatement = "Play CDAudio from " & TrackPrevious

         mciStatement = mciStatement & " To " & gTrackCount

         CDTrackPrevious = mciSendString(mciStatement, "", 0, 0)

      Else

         mciStatement = "Seek CDAudio to " & TrackPrevious

         RetInt = mciSendString(mciStatement, "", 0, 0)

         CDTrackPrevious = mciSendString("Play CDAudio", "", 0, 0)

      End If

   End Function

   '********** Next Track Function **********

   Function CDTrackNext () As Integer

      Dim TrackNext As Integer

      ' Set time format to Tracks, minutes, seconds, and frames.

      RetInt = mciSendString("Set CDAudio Time Format TMSF", "", 0, 0)

      ' Retrieve the track number that is currently playing, and

      ' the total number of tracks on the CD. Store these values

      ' in global variables so that they are available to the form.

      mciStatement = "Status CDAudio Current Track"

      RetInt = mciSendString(mciStatement, RetStr, 63, 0)

      gTrackCurrent = Val(RetStr)

      TrackNext = gTrackCurrent + 1

      mciStatement = "Status CDAudio Number of Tracks"

      RetInt = mciSendString(mciStatement, RetStr, 63, 0)

      gTrackCount = Val(RetStr)

      ' Check to see if the current track is the last track. If it

      ' is seek to the beginning of the last track and play it.

      ' Otherwise, move to the next track and play from there to the end

      ' of the CD.

      If (TrackNext) < gTrackCount Then

          mciStatement = "Play CDAudio from " & TrackNext

          mciStatement = mciStatement & " To " & gTrackCount

          CDTrackNext = mciSendString(mciStatement, "", 0, 0)

       Else

          mciStatement = "Seek CDAudio to " & gTrackCurrent

          RetInt = mciSendString(mciStatement, "", 0, 0)

          CDTrackNext = mciSendString("Play CDAudio", "", 0, 0)

      End If

   End Function

   '********* Eject Function **********

   Function CDEject () As Integer

      ' This function is not supported by all CD devices.

      CDEject = mciSendString("Set CDAudio Door Open", "", 0, 0)

   End Function

   '********* Pause Function **********

   Function CDPause () As Integer

      CDPause = mciSendString("Stop CDAudio", "", 0, 0)

   End Function

Note that these functions are only a sample; there are many other functions

that can be implemented with mciSendString(). For example, the Position

command returns the current track number that is being played. By using the

Position command with the timer function described in article Q95924, "How

to Implement a Timer," you can create a dynamically updated readout of the

current track number being played.

REFERENCES

==========

Microsoft Windows Software Development Kit "Multimedia Programmer's

Reference," Chapter 7, "MCI Command Strings"

Additional reference words: 1.00 1.10 2.00 CDROM

KBCategory:

KBSubcategory: PgmApi


INF: Sample Macro for Repair/Compact Operations

Article ID: Q100923

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates a sample macro that repairs and compacts a

database.

MORE INFORMATION

================

To manually repair and compact a database from the File menu, you must

close the database and perform the compact and repair steps individually.

The sample macro in this article automates this process. It repairs a

database called MYDB and compacts it to a new database called NewDB. The

macro will only prompt for information if the name of the database it is

compacting to already exists.

NOTE: The macro must be run from a different database than the one you

want to repair and compact.

Sample Macro

------------

   MacroName   Action        Defined Below

   ---------------------------------------

   Test        SetWarnings       1

               SendKeys          2

               DoMenuItem        3

               SendKeys          4

               DoMenuItem        5

               SetWarnings       6

   Test Actions

   ------------------------------------------------------------------

   1. SetWarnings

          WarningsOn: No

   2. SendKeys

           Keystrokes: MYDB.mdb{enter}

           Wait: No

   3. DoMenuItem

           Menu Bar: Startup (in Microsoft Access version 1.x = Init)

           Menu Name: File

           Command: Repair Database

   4. SendKeys

           Keystrokes: MYDB.mdb{enter}NewDB{enter}

           Wait: No

   5. DoMenuItem

           Menu Bar: Startup (in Microsoft Access version 1.x = Init)

           Menu Name: File

           Command: Compact Database

   6. SetWarnings

           Warnings On: Yes

Notes

-----

 - In most cases this macro works fine. However, remember that keystrokes

   sent by the SendKeys action are buffered temporarily and that results

   may vary. A large database may take extra time to compact or repair; in

   this case, the macro may not exhibit expected behavior.

 - In Microsoft Access version 2.0, you can use new command-line options to

   create an icon in Program Manager to compact or repair your database.

   You can also use the new data access objects (DAO) methods

   CompactDatabase and RepairDatabase from Access Basic. For more

   information about these methods, search for "command line,"

   "CompactDatabase," and "RepairDatabase" using the Microsoft Access Help

   menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlCmp


INF: Sample Macro to Reset Page Number on Group Level Report

Article ID: Q104760

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

It is possible, using macro and report section properties, to design a

report that breaks the page for each new entry in a group and resets

the report page number. For example, the "List of Products by Category"

report in the sample database NWIND.MDB could be redesigned to break

the page for each new category and reset the page number to 1.

MORE INFORMATION

================

1. Create the following macro:

      Macro Name   Action

      ---------------------------------

      Pager        SetValue

      Macro Action Arguments

      ---------------------------------

      SetValue

         Item: Page

         Expression: 1

2. In the sample database NWIND.MDB, open the "List of Products by

   Category" report in Design view.

3. Select the Category Name header section and assign the Pager macro

   to the OnFormat property.

4. Select the Category Name header section and set the ForceNewPage

   property to Before Section.

Each category will now begin on a new page and the numbering of these

new pages will all begin with the number 1. In the Products table,

there currently are not enough records in each category to require

more than one page. However, if the Detail section of the "List of

Products by Category" report was enlarged to 1 inch, several of the

categories would require two pages and their page numbers would

continue to increase until the next category occurs.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 23, "Using Macros to

Print Reports or Transfer Data," pages 571-572

Microsoft Access "User's Guide," version 2.0, Chapter 26, "Using Macros to

Print Reports or Transfer Data"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory:  RptLayou


INF: Sample Table Design to Support Questionnaire Applications

Article ID: Q101675

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a table design suitable for an application

that tallies results from questionnaires and surveys.

MORE INFORMATION

================

The following examples outline nonrelational table design commonly

used for questionnaires and surveys and suggests an improved,

relational table design.

Nonrelational Table Design

---------------------------

When designing tables for questionnaire applications, many users begin

with a design that resembles the table below. Each record contains

multiple fields, called Question1 through Question<n>, that contain

responses to the questions.

   Table: Table1 (old)

   --------------------------------------

   FieldName: Respondent ID [Primary Key]

   FieldName: Question1

   FieldName: Question2

   FieldName: Question3

   .

   .

   .

   FieldName: Question<n>

Problems occur when you want to perform crosstab queries to summarize

and/or graph the questionnaire results.

Relational Table Design

-----------------------

A relational table design better supports summary queries, reports,

and graphs. In the table below, the Question ID field identifies the

question and the Response field contains the answer.

   Table: Table2 (new)

   ----------------------------------

   Field: Respondent ID [Primary Key]

   Field: Question ID   [Primary Key]

   Field: Response

How to Switch to Relational Database Design

-------------------------------------------

To convert data that has been entered in Table1 format, complete the

following six steps:

1. Create Table2 according to the above structure, using the following

   data type criteria:

    - All Respondent ID fields must be the same data type.

    - The Question ID field must be a Text data type.

    - The Response field must be the same data type as the Question<x>

      data types.

2. Create a new query based on Table1.

3. From the Query menu, choose Append. Select Table2 as the table to

   which you want to append the data. Design the query as follows:

      Query: Query1

      --------------------------

      Field: Respondent ID

         Append To: Respondent ID

      Field: Question1

         Append To: Response

      Field: "Question1"

         Append To: Question ID

4. Run Query1 to append to Table2 each participant's responses to

   Question1.

5. Repeat steps 2-4 above, replacing Question1 with Question2, and

   "Question1" with "Question2". You must re-create or modify this

   query for each question in Table1.

6. After running all the append queries, the result is a table

   (Table2) that can easily summarize your results in a crosstab

   query:

      Query: CrossTabExample

      ----------------------

      Field: Question ID

         Total: Group By

         Crosstab: Row Heading

      Field: Response

         Total: Group By

         Crosstab: Column Heading

      Field: Response

         Total: Count

         Crosstab: Value

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapters 1, 6, and 7

Additional reference words: 1.00 1.10 2.00 cross tab append questionaire

KBCategory:

KBSubcategory: TblDsign


INF: Screen Fonts May Not Match Printer Output Fonts

Article ID: Q96009

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Screen fonts and printer fonts can be different. When you create a new

form or report, the default font used to format the controls can be

set up to use only printer fonts. Using printer fonts will ensure that

the screen view and printed output are as close as can be to an exact

match. If you use TrueType fonts (supplied with Windows 3.1) the

screen view and printed output will also match. Forms that have been

saved as reports may need to be modified to ensure that you get the

correct output. By default, new reports use printer fonts but forms do

not. You can control which fonts are used by setting the

LayoutForPrint property in the form or report property sheet.

MORE INFORMATION

================

When you choose a font for a form or report, the characters on the

screen may not look exactly like those that appear on the printed page

because printer fonts and screen fonts can differ. If you select a

scalable font, such as a TrueType font, the screen and printer

characters will be the same.

When you design a form or report, you can set the LayoutForPrint

property to Yes in the form or report property sheet, and you will

only see printer fonts listed in the toolbar. The LayoutForPrint

property determines whether a screen font or printer font is used. If

LayoutForPrint is set to No, the fonts available on the toolbar

include screen fonts.

If LayoutForPrint is set to Yes, the fonts and point sizes on the

toolbar correspond to the fonts and sizes available on the printer you

chose in the Print Setup command from the File menu.

For reports, this property is set to Yes by default. This property must

be changed to Yes for forms.

In Microsoft Access, you can design a form and save it as a report. If

LayoutForPrint is set to No when the form is originally designed, you

may need to change the fonts from a screen font to a TrueType or

printer font in the report design mode.

To convert a form to a report, open the form in Design view and choose

Save As Report from the File menu.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, page 309

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: PtrPrev


INF: Security Settings for Modifying Data in a Query Dynaset

Article ID: Q96012

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can affect a user's ability to edit data in a query's dynaset by

altering the settings for the following two permissions:

 - Run With Owner's Permissions, for a query

 - Modify Data, for a query and any underlying tables

MORE INFORMATION

================

For a user to be able to edit a query's dynaset, one of the following must

be true:

 - The Run With Owner's Permissions check box must be selected. To select

   this check box, choose Query Properties from the View menu when the

   query is open in Design view.

 - The Modify Data check box must be selected for both the query and

   the underlying tables. To select this check box, choose Permissions from

   the Security menu in the Database window. You must repeat this step for

   each object for which you want to assign permissions.

The following table shows the possible combinations of these three

settings and how each affects the user's ability to edit the

query's dynaset:

   Permission       Permission       Run with

   to Modify Data   to Modify Data   Owner's       Edit

   in Table         in Query         Permission    Query?

   ------------------------------------------------------

   Yes              No               No            No

   Yes              Yes              No            Yes

   No               No               No            No

   No               Yes              No            No

   Yes              No               Yes           No

   Yes              Yes              Yes           Yes

   No               No               Yes           No

   No               Yes              Yes           Yes

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, chapter 25

Microsoft Access "User's Guide," version 1.0, pages 619-626

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: ScrtOthr


INF: Sending a MAPI Mail Message Using Access Basic

Article ID: Q99403

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The following example includes a Microsoft Access module that

demonstrates how to send a Mail Application Programming Interface

(MAPI) message to multiple TO recipients and carbon copies (CC).

MORE INFORMATION

================

The following procedure explains how to use this sample module:

1. Create a form with the following controls:

   Form:  Test

   -----------

   Caption:  TestForm

   Text box:  Subject

      ControlName:  Subject

   Text box:  To

      ControlName:  To

   Text box:  CC

      ControlName:  CC

   Text box:  Attach

      ControlName:  Attach

   Text box:  Message

      ControlName:  Message

   Command button: Button0

      Caption: Send Message

      OnPush: =Mail()

2. Open either a new module or a previously created module and enter

   the following code:

   NOTE: In the following sample code, an underscore (_) is used as a

   line continuation character for easier reading. Remove the

   underscore when re-creating this code in Access Basic.

'*************************************************************

'Declarations section of the module.

'*************************************************************

Option Explicit

Option Compare Database   'Use database order for string comparisons

Type MAPIMessage

   Reserved As Long

   Subject As String

   NoteText As String

   MessageType As String

   DateReceived As String

   ConversationID As String

   Flags As Long

   RecipCount As Long

   FileCount As Long

End Type

Type MapiRecip

   Reserved As Long

   RecipClass As Long

   Name As String

   Address As String

   EIDSize As Long

   EntryID As String

End Type

Type MapiFile

   Reserved As Long

   Flags As Long

   Position As Long

   PathName As String

   FileName As String

   FileType As String

End Type

Declare Function MAPISendMail Lib "MAPI.DLL" Alias "BMAPISendMail" _

(ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient _

As MapiRecip, File As MapiFile, ByVal Flags&, ByVal Reserved&) As Long

Global Const SUCCESS_SUCCESS = 0

Global Const MAPI_TO = 1

Global Const MAPI_CC = 2

Global Const MAPI_LOGON_UI = &H1

'*************************************************************

' End of declarations section

'*************************************************************

'*************************************************************

' FUNCTION NAME: Mail

'

' PURPOSE:

'   Passes information on the active forms To, Subject, CC,

'   Attach, and Message text boxes to the SendMail function.

'   It ensures that each box does not have a NULL value. It also

'   displays an error message if SendMail fails.

'   This function is called from the OnPush property of the form.

'

' INPUT PARAMETERS:

'   None

'

' RETURN

'   None

'*************************************************************

Function Mail ()

   Dim F As Form, Result

   Set F = Screen.ActiveForm

   ' Make sure user has something in the To: box

   If IsNull(F!To) Or F!To = "" Then Exit Function

   ' Make sure no Null values are in the other boxes

   If IsNull(F!Subject) Then F!Subject = ""

   If IsNull(F!CC) Then F!CC = ""

   If IsNull(F!Attach) Then F!Attach = ""

   If IsNull(F!Message) Then F!Message = ""

   ' Send the message, passing information from the form

   Result = SendMail((F!Subject), (F!To), (F!CC),_

               (F!Attach), (F!Message))

   ' Test the result for any errors

   If Result <> SUCCESS_SUCCESS Then

      MsgBox "Error sending mail: " & Result, 16, "Mail"

   Else

      MsgBox "Message sent successfully!", 64, "Mail"

   End If

End Function

'*************************************************************

' FUNCTION NAME: SendMail

'

' PURPOSE:

'   This is the front-end function to the MAPISendMail function. You

'   pass a semicolon-delimited list of To and CC recipients, a

'   subject, a message, and a delimited list of file attachments.

'   This function prepares MapiRecip and MapiFile structures with the

'   data parsed from the information provided using the ParseRecord

'   sub. Once the structures are prepared, the MAPISendMail function

'   is called to send the message.

'

' INPUT PARAMETERS:

'   sSubject: The text to appear in the subject line of the message

'   sTo:      Semicolon-delimited list of names to receive the

'             message

'   sCC:      Semicolon-delimited list of names to be CC'd

'   sAttach:  Semicolon-delimited list of files to attach to

'             the message

' RETURN

'   SUCCESS_SUCCESS if successful, or a MAPI error if not.

'*************************************************************

Function SendMail (sSubject As String, sTo As String, sCC As String, _

                   sAttach As String, sMessage As String)

   Dim i, cTo, cCC, cAttach          ' variables holding counts

   Dim MAPI_Message As MAPIMessage

   ' Count the number of items in each piece of the mail message

   cTo = CountTokens(sTo, ";")

   cCC = CountTokens(sCC, ";")

   cAttach = CountTokens(sAttach, ";")

   ' Create arrays to store the semicolon delimited mailing

   ' .. information after it is parsed

   ReDim rTo(0 To cTo) As String

   ReDim rCC(0 To cCC) As String

   ReDim rAttach(0 To cAttach) As String

   ' Parse the semicolon delimited information into the arrays.

   ParseTokens rTo(), sTo, ";"

   ParseTokens rCC(), sCC, ";"

   ParseTokens rAttach(), sAttach, ";"

   ' Create the MAPI Recip structure to store all the To and CC

   ' .. information to be passed to the MAPISendMail function

   ReDim MAPI_Recip(0 To cTo + cCC  - 1) As MapiRecip

   ' Setup the "TO:" recipient structures

   For i = 0 To cTo - 1

      MAPI_Recip(i).Name = rTo(i)

      MAPI_Recip(i).RecipClass = MAPI_TO

   Next i

   ' Setup the "CC:" recipient structures

   For i = 0 To cCC - 1

      MAPI_Recip(cTo + i).Name = rCC(i)

      MAPI_Recip(cTo + i).RecipClass = MAPI_CC

   Next i

   ' Create the MAPI File structure to store all the file attachment

   ' .. information to be passed to the MAPISendMail function

   ReDim MAPI_File(0 To cAttach) As MapiFile

   ' Setup the file attachment structures

   MAPI_Message.FileCount = cAttach

   For i = 0 To cAttach - 1

      MAPI_File(i).Position = -1

      MAPI_File(i).PathName = rAttach(i)

   Next i

   ' Set the mail message fields

   MAPI_Message.Subject = sSubject

   MAPI_Message.NoteText = sMessage

   MAPI_Message.RecipCount = cTo + cCC

   ' Send the mail message

   SendMail = MAPISendMail(0&, 0&, MAPI_Message, MAPI_Recip(0), _

                  MAPI_File(0), MAPI_LOGON_UI, 0&)

End Function

'*************************************************************

' FUNCTION NAME: CountTokens

'

' PURPOSE:

'   Given a string of delimited items and the delimiter, the number

'   of tokens in the string will be returned. This function is useful

'   for dimensioning an array to store the delimited items prior to

'   calling ParseTokens.

'

' INPUT PARAMETERS:

'   sSource: A delimited list of tokens

'   sDelim:  The delimiter used to delimit sSource

'

' RETURN

'   The number of tokens in sSource, which is the number of delimiters

'   plus 1. If sSource is empty, 0 is returned.

'*************************************************************

Function CountTokens (ByVal sSource As String, ByVal sDelim As String)

   Dim iDelimPos As Integer

   Dim iCount As Integer

   ' Number of tokens = 0 if the source string is empty

   If sSource = "" Then

      CountTokens = 0

   ' Otherwise number of tokens = number of delimiters + 1

   Else

      iDelimPos = InStr(1, sSource, sDelim)

      Do Until iDelimPos = 0

         iCount = iCount + 1

         iDelimPos = InStr(iDelimPos + 1, sSource, sDelim)

      Loop

      CountTokens = iCount + 1

   End If

End Function

'*************************************************************

' FUNCTION NAME: GetToken

'

' PURPOSE:

'   Given a string of delimited items, the first item will be

'   removed from the list and returned.

'

' INPUT PARAMETERS:

'   sSource: A delimited list of tokens

'   sDelim:  The delimiter used to delimit sSource

'

' RETURN

'   sSource will have the first token removed. The function

'   returns the token removed from sSource.

'*************************************************************

Function GetToken (sSource As String, ByVal sDelim As String) _

As String

   Dim iDelimPos As Integer

   ' Find the first delimiter

   iDelimPos = InStr(1, sSource, sDelim)

   ' If no delimiter was found, return the existing string and set

   ' .. the source to an empty string.

   If (iDelimPos = 0) Then

      GetToken = Trim$(sSource)

      sSource = ""

   ' Otherwise, return everything to the left of the delimiter and

   ' .. return the source string with it removed.

   Else

      GetToken = Trim$(Left$(sSource, iDelimPos - 1))

      sSource = Mid$(sSource, iDelimPos + 1)

   End If

End Function

'*************************************************************

' SUB NAME: ParseTokens

'

' PURPOSE:

'   Extracts information from a delimited list of items and places

'   it in an array.

'

' INPUT PARAMETERS:

'   Array(): A one-dimensional array of strings in which the parsed tokens

'            will be place

'   sTokens: A delimited list of tokens

'   sDelim:  The delimiter used to delimit sTokens

'

' RETURN

'   None

'*************************************************************

Sub ParseTokens (Array() As String, ByVal sTokens As String, ByVal _

                 sDelim As String)

   Dim i As Integer

   For i = LBound(Array) To UBound(Array)

      Array(i) = GetToken(sTokens, sDelim)

   Next

End Sub

REFERENCES

==========

Microsoft Mail "Technical Reference," Chapter 4

Additional reference words: 1.00 1.10 2.00 mail application programming

KBCategory:

KBSubcategory: PgmApi


INF: Set Focus to a Subform Control Using GoToControl Action

Article ID: Q95014

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can create a macro to move the focus to a control on a subform by

using the GoToControl macro action to move first to the subform, which

is a type of a control. Use the GoToControl action again to move to a

particular control on the subform.

MORE INFORMATION

================

The macro action GoToControl does not allow you to enter the full

syntax for the ControlName argument as:

   Forms![orders]![orders subform].form![Product ID]

If you enter this syntax, you will receive the following error:

   There is no control named 'Forms![orders]![orders

   subform].Form!Product id'.

To get around this, you need to set up a macro that first sets the

focus to the subform control, followed by a second action that sets

the focus to a specific control.

In the sample database Northwind Traders (NWIND.MDB), the Orders and

Orders Subform forms can be used as an example where you can have a

macro set the focus to the Product Id on the Orders Subform.

Create a new macro with two separate GoToControl actions, then attach

the macro to a button on the Orders form.

   Actions

   -------------------------------

   GoToControl

      Control Name: Orders Subform

   GoToControl

      Control Name: Product Id

When the button is clicked, the focus will move to the Product Id

control.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: McrActn


INF: Setting a Database's V1xNullBehavior Property

Article ID: Q114548

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access version 2.0, the behavior of Null and zero-length

strings is different than in Microsoft Access version 1.x. Microsoft Access

version 2.0 can distinguish between Null and zero-length strings, and

Microsoft Access version 1.x cannot.

Because of this, Microsoft Access version 2.0 has a new property called

V1xNullBehavior that you can use to cause Microsoft Access to convert zero-

length strings to Null. This property only applies to version 1.x databases

that have been converted to version 2.0. When you convert a database from

version 1.x to version 2.0, the V1xNullBehavior property is automatically

created.

MORE INFORMATION

================

The V1xNullBehavior property triggers these behaviors:

 - Assignments in Access Basic to DAO field objects will be implicitly

   converted from zero-length strings to Null if the field does not

   support zero-length strings.

 - The SetValue action has similar mappings.

It is important to set the V1xNullBehavior property to the setting you

want. Do not set the property if you do not fully understand the

ramifications of the setting.

You can set the V1xNullBehavior property on an existing database using the

following code in the database that you want to change:

   Sub SetV1XNullBehavior ()

     Dim db As Database, prop As Property

     Set db = DBEngine.Workspaces(0).Databases(0)

     Set prop = db.CreateProperty("V1xNullBehavior", DB_INTEGER)

     prop.Value = True

     db.properties.Append prop

     db.Close

   End Sub

REFERENCES

==========

For more information about the V1xNullBehavior property, search for

"V1xNullBehavior" then "V1xNullBehavior Property" using the Microsoft

Access Help menu.

Microsoft Access "Building Applications," Appendix C, "Conversion Issues

and New Features for Access Basic"

Microsoft Access "Building Applications," Chapter 7

Additional reference words: 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Shortcut Method for Creating an SQL Union Query

Article ID: Q114731

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates a shortcut method for creating an SQL union query

using a second "scratchpad" query to create the second half of the SQL

UNION statement.

MORE INFORMATION

================

The following example demonstrates how to create a union query that returns

all the customers and suppliers in London in the sample database NWIND.MDB:

 1. Start Microsoft Access and open NWIND.MDB.

 2. Create a new query and add the Customers table.

 3. Add the Company Name, Contact Name, and City fields to the query grid.

 4. In the Criteria row for the City column, enter "London" (without

    quotation marks).

 5. From the View menu, choose SQL. This creates the first half of the

    union.

 6. Leave the first query open and create a second new query. Add the

    Suppliers table. This will be the "scratchpad" query.

 7. Repeat steps 3 and 4.

 8. From the View menu, choose SQL. Select the entire SQL statement

    except for the ending semicolon (;).

 9. Press CTRL+C to copy the selected text to the Clipboard.

10. Close the scratchpad query without saving it, and then switch back

    to the original query.

11. Position the insertion point before the semicolon (;) at the end

    of the SQL statement. Type the keyword "UNION" (without quotation

    marks) with a space before and after it.

12. Position the insertion point before the semicolon (;) at the end of

    the statement. Paste the text from the Clipboard by pressing

    CTRL+V. This creates the second half of the union.

13. Run the query. Note that the title bar indicates that it is a union

    query, and that the Design view button on the toolbar is disabled.

Tips

----

To be able to tell which table the data comes from, switch back to the

query's SQL view and add the table name to the end of each SELECT

statement, as in the following example:

   SELECT DISTINCTROW Customers.[Company Name], Customers.[Contact

   Name], Customers.City, "Customers"

   FROM Customers

   WHERE ((Customers.City="London")) UNION SELECT DISTINCTROW

   Suppliers.[Company Name], Suppliers.[Contact Name], Suppliers.City,

   "Suppliers"

   FROM Suppliers

   WHERE ((Suppliers.City="London"));

When you run the query, a fourth column, "Expr1003," will be displayed. To

give the new column a more meaningful name, add an alias to it. Add the

alias to the first SELECT statement as follows:

   SELECT DISTINCTROW Customers.[Company Name], Customers.[Contact

   Name], Customers.City, "Customers" AS [Source Table]

   FROM Customers

   WHERE ((Customers.City="London")) UNION SELECT DISTINCTROW

   Suppliers.[Company Name], Suppliers.[Contact Name], Suppliers.City,

   "Suppliers"

   FROM Suppliers

   WHERE ((Suppliers.City="London"));

To sort your query, add an ORDER BY statement to the last SELECT clause in

the UNION statement, as in the following example:

   SELECT DISTINCTROW Customers.[Company Name], Customers.[Contact

   Name], Customers.City, "Customers" AS [Source Table]

   FROM Customers

   WHERE ((Customers.City="London")) UNION SELECT DISTINCTROW

   Suppliers.[Company Name], Suppliers.[Contact Name], Suppliers.City,

   "Suppliers"

   FROM Suppliers

   WHERE ((Suppliers.City="London")) ORDER BY [Contact Name];

REFERENCES

==========

For more information about union queries, search for "UNION (SQL)" then

"UNION Operation (SQL)" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 2.0, Chapter 12 "Advanced

Queries," pages 288-291

Additional reference words: 2.00 Queries SQL-Specific Short Cut

KBCategory:

KBSubcategory: ObcOthr


INF: Showing All Records (Including Null) in a Parameter Query

Article ID: Q103181

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are running a query that takes its parameters from a form, no

records are returned by the query if you leave the field blank. If you

type an asterisk (*) in the field, only records with non-Null values

are returned.

This article describes a method for returning all records, including

those with Null values, when you leave the parameter blank.

MORE INFORMATION

================

The following example is based on the sample database NWIND.MDB and

assumes that you are familiar with Microsoft Access form, macro, and

query design.

1. Create the following unbound form:

      Form: Pick Employees

      --------------------

         Control: Textbox

            ControlName: Region

         Control: Command Button

            Caption: Run Query

            OnPush: Run Employee Query

Note: In Access 2.0 use OnClick instead of OnPush

2. Create the following macro:

      Macro: Run Employee Query

      -------------------------

         Action: OpenQuery

            Query Name: Employee Query

            View: Datasheet

            Data Mode: Edit

3. Create the following query based on the Employees table:

      Query: Employee Query

      ---------------------

         Field: First Name

            Show: True

         Field: Last Name

            Show: True

         Field: Region

            Show: True

            Criteria: Like Forms![Pick Employees]!Region & "*"

            Or: <leave blank>

         Field: Forms![Pick Employees]!Region

            Show: False

            Criteria: <leave blank>

            Or: Is Null

4. Open your query in Design view. From the Query menu, choose

   Parameters. Type "Forms![Pick Employees]!Region" (without the

   quotation marks) as the parameter name, with Text as the data type.

5. Open the Pick Employees form, type "WA" (without the quotation

   marks) in the Region field, and choose the Run Query button. The

   dynaset will contain five employee names.

6. Open the Pick Employees form, clear the Region field, and choose

   the Run Query button again. The dynaset now contains nine employee

   names, four with blank region codes.

By adding the parameter as a field, we can test the parameter and

control the other criteria. The equivalent SQL Where condition is the

following:

   Where Region Like Forms![Pick Employees]!Region & "*"

      Or Forms![Pick Employees]!Region Is Null

Additional reference words: 1.00 1.10 2.00 SQL Queries query

KBCategory:

KBSubcategory:  QryParm


INF: Shrinking Empty or Null OLE Object on Report

Article ID: Q90855

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If a report has object linking and embedding (OLE) objects that are

empty or null, you can set up the report so that empty or null OLE

objects will not appear.

MORE INFORMATION

================

To illustrate how this is done, we will use the sample database NWIND.MDB:

 1. Start Microsoft Access and open NWIND.MDB. You may want to make a copy

    of NWIND.MDB before proceeding.

 2. From the View menu, choose Table. Open the Employees table and add

    a few records without pictures to the end of the table. Close the

    table.

 3. From the View menu, choose Macros. Create a new macro and enter

    the lines below. Save the macro as Macro99.

       Condition                                 Action

       --------------------------------------------------

       Reports![Report1]![photo] Is Null         SetValue

       Reports![Report1]![photo] Is Not Null     SetValue

       Macro99 Actions

       ------------------------

       SetValue

          Item: [photo].visible

          Expression:  False

       SetValue

          Item: [photo].visible

          Expression:  True

    Line 1 of this macro checks to see if the OLE object is null or

    empty. If it is, the Visible property is set to 0 (False), making

    the object invisible. For Line 2, if the OLE object is not null or

    empty, the Visible property will be set back to -1 (True) and the

    picture will be visible.

 4. From the View menu, choose Report.

 5. In the Database window, choose the New button.

 6. When prompted, base the report on the Employees table and select

    Blank Report instead of the Report Wizard.

 7. Drag Employee ID, Last Name, First Name, and Photo from the list

    of fields and place them in the detail section of the report.

 8. If the property sheet is not showing, choose Properties from the

    View menu, or click the Properties button on the toolbar.

 9. Click the detail section bar (the bar labeled "Detail"). On the

    property sheet, change the following properties:

       OnFormat: Macro99

       CanShrink: Yes

10. In the toolbox, click the text box button. Add an unbound text box

    to your report that completely overlaps the OLE object. The text

    box is necessary to cause the items below it to be pulled up.

11. For this unbound text box, change the following properties:

       Visible: NO

       CanShrink: YES

12. From the Layout menu, choose Send To Back. The OLE object should

    now be on top of the unbound text box.

13. Save the report as Report1.

14. Scroll through the pages of the report in print preview. Scroll

    to the last page and note how the CanShrink property works with

    null or empty OLE objects.

    When an OLE object is visible, the CanShrink property will prevent

    the empty text box from shrinking. When the OLE object is

    invisible, the text box will shrink to nothing.

Additional reference words: 1.00 1.10 2.00 container remove delete erase

can

KBCategory:

KBSubcategory: RptProp


INF: Snapshot and Underlying Table Updated Until Snapshot Full

Article ID: Q103402

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

A snapshot, along with its underlying table, continues to update until the

snapshot is completely filled with data. The link to the snapshot's

underlying table is not "severed" until you move to the end of the

snapshot's recordset.

When you first create a snapshot recordset, memory is allocated to store

data. In order to optimize memory, Microsoft Access does not load all the

table's records at once, meaning that you have only a partial recordset in

memory. When you move to the end of the snapshot, the data is then

"severed" from the live table.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

Steps To Reproduce Behavior

---------------------------

The first function, Udate(), creates a snapshot of a table, adds a new

record to the table, and then prints the snapshot to the Immediate window.

The snapshot includes the new record in its output.

The second function, NoUdate(), also creates a snapshot of a table, moves

to the end of the snapshot, adds a new record to the table, and then prints

the snapshot. In this example, the snapshot does not include the new record

since the MoveLast command is executed before the new record is added.

Function Udate()

----------------

1. Open the sample database NWIND.MDB.

2. Copy the Categories table to a table called Cat.

3. Create a new Access Basic module and add the following function:

   Function Udate ()

      Dim MyDB As Database, MyTable As Table, MySnap As Snapshot

      Set MyDB = CurrentDB()

      Set MyTable = MyDB.OpenTable("Cat")

      Set MySnap = MyTable.CreateSnapshot()

      MyTable.AddNew

         MyTable.[Category Name] = "TEST"

         MyTable.[Description] = "Still being updated"

      MyTable.Update

      Debug.Print "Category Name / Description"

      MySnap.MoveFirst

      Do While Not MySnap.EOF

         Debug.Print MySnap.[Category Name] & " / " & MySnap.[Description]

         MySnap.MoveNext

      Loop

   End Function

4. In the Immediate window, type the following:

      ?Udate()

The snapshot contains the new record.

Function NoUdate()

------------------

1. Open the Cat table in Datasheet view.

2. Delete the TEST record added above.

3. Add the following function to the module you created in step 2 of

   the previous procedure:

   Function NoUdate ()

      Dim MyDB As Database, MyTable As Table, MySnap As Snapshot

      Set MyDB = CurrentDB()

      Set MyTable = MyDB.OpenTable("CAT")

      Set MySnap = MyTable.CreateSnapshot()

      MySnap.MoveLast

      MyTable.AddNew

         MyTable.[Category Name] = "TEST"

         MyTable.[Description] = "Still being updated"

      MyTable.Update

      Debug.Print "Category Name / Description"

      MySnap.MoveFirst

      Do While Not MySnap.EOF

         Debug.Print MySnap.[Category Name] & " / " & MySnap.[Description]

         MySnap.MoveNext

      Loop

   End Function

4. In the Immediate window, type the following:

      ?NoUdate()

Note that since the snapshot was filled (MoveLast was executed) before the

new record was added, the snapshot does not contain the new record added to

the Cat table.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, "CreateSnapshot

Method," pages 91-92

For more information on creating a snapshot, search for "CreateSnapshot"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 tables snap shot

KBCategory:

KBSubcategory: PgmObj


INF: Sort Order of Union Queries Affected by ALL Predicate

Article ID: Q117164

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

The rows of a union query's subqueries are sorted automatically, or

interfiled, according to values in the first column, even when none of the

subqueries contains an ORDER BY clause. This behavior results from the

union query's sorting of all the subquery rows to determine their

distinctness. Union queries group by rows; duplicate rows are not returned

unless a subquery contains the ALL predicate. However, when the ALL

predicate is used, the union query's rows are returned unsorted unless an

ORDER By clause in included in the last select statement.

MORE INFORMATION

================

If you want to see the union query's subqueries displayed distinctly, keep

the following tips in mind when you are designing your queries:

 - If any subquery from the second through last subquery does not have the

   ALL predicate with its UNION clause, the subquery's rows will be sorted

   with the rows of all the preceding subqueries.

 - Any subquery that has the ALL predicate and is not followed by another

   subquery omitting the ALL predicate will have its rows appended to the

   rows of the previous subquery, instead of sorted within the rows of the

   previous subquery.

The following example demonstrates how to create a union query that returns

a sorted recordset, based on the first tip above:

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new query that is not based on any table.

3. From the Query menu, choose SQL Specific then choose Union.

4. Enter the following SQL statement in the Union Query window.

   NOTE: The blank lines in the following sample SQL statement have no

   effect on the query itself, but are meant to improve readability.

   Similarly, the column for Employees1, Employees2, and Customers is

   included to identify each row's subquery source. The Customers subquery

   is restricted to contact names beginning with "K" in order to limit the

   number of records returned.

      SELECT [First Name] & " " & [Last Name] as Fullname, "Employees1"

      FROM Employees

      UNION ALL SELECT [First Name] & " " & [Last Name] , "Employees2"

      FROM Employees

      UNION SELECT [Contact Name], "Customers"

      FROM Customers

      WHERE [Contact Name] LIKE "K*";

5. From the Query menu, choose Run.

Note that the rows from all three subqueries are sorted in a single

alphabetical sequence by Fullname. In this example, the subquery without an

ALL predicate in the UNION clause is the last query.

The next example returns an unsorted recordset, based on the second tip

above:

1. Reverse the second and third subqueries in the above example so that the

   SQL statement looks like the following statement. Note that the

   semicolon (;) should only appear at the end of the statement.

      SELECT [First Name] & " " & [Last Name] as Fullname, "Employees1"

      FROM Employees

      UNION SELECT [Contact Name], "Customers"

      FROM Customers

      WHERE [Contact Name] LIKE "K*"

      UNION ALL SELECT [First Name] & " " & [Last Name] , "Employees2"

      FROM Employees;

2. From the Query menu, choose Run.

Note that the order of the rows is changed. The two Customers rows are

sorted within the rows from the first subquery (Employees1), and the rows

from the last subquery (Employees2) are appended, in their own sort order,

to the rows of the first two subqueries.

REFERENCES

==========

For more information about union queries, search for "UNION (SQL)" then

"UNION Operation (SQL)" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 2.0, Chapter 12, "Advanced

Queries," pages 290-291

Additional reference words: 2.00

KBCategory:

KBSubcategory: QryOthr


INF: Sorting String Values Based on their Numeric Values

Article ID: Q96112

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

To preface this article, I have a database that contains a product

code column. It is a text data type but I store numbers from 1 to 999

and each code can have a single letter for a suffix. For instance, I

might have the following codes: 10a, 1d, 100b, 24c, 24a, 1, 89b, and

14. I want to view this data so that it is sorted on the code. It

should appear like this: 1, 1d, 10a, 14, 24a, 24c, 89b, and 100b.

This article discusses one method for doing this. It requires basic

knowledge of Microsoft Access queries and functions.

MORE INFORMATION

================

You need to use a query to view your data so that it is sorted on the

code. This will work as long as the numbers do not exceed 1000 (if

they do, you can add to this solution to accept larger numbers), there

can be only one character digit after the number (that is, a, b, c;

not aa, bc, cde), and numbers cannot have leading zeros (that is, 01,

02, 03, and so forth).

The query grid appears as follows:

   Query: Query1

   ---------------------------------------------

   Field: ID

      Show: Yes

   Field: PRE: Val([ID])

      Sort: Ascending

   Field: SUF: IIF(Val([ID])<10,Mid([ID],2,1),_

               IIF(Val([ID]) between 10 and 99,_

               MID([ID],3,1),Mid([ID],4,1)))

          Sort: Ascending

This separates the numeric value (PRE) and the string value (SUF) into

two separate (temporary) fields in the query. The query sorts on the

individual pieces but shows only the true ID field (assuming your

field name is ID).

Additional reference words: 1.00 1.10 2.00 alphanumeric sort

KBCategory:

KBSubcategory: QryOthr


INF: Sorting Titles Without Leading Articles (The, An, etc.)

Article ID: Q98665

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to sort titles in text fields without

including the leading articles "the," "an," or "a."

MORE INFORMATION

================

The following is a list of book titles:

   Aztec Indians

   The Ant People

   Beast Man

   The Baseball Club

   An Attempt At Fun

   Apple Valley

If you sort the above list using a custom Microsoft Access function in

a query, the following new list results:

   The Ant People

   Apple Valley

   An Attempt At Fun

   Aztec Indians

   The Baseball Club

   Beast Man

Create the following Access Basic function that returns a book title

without the leading article:

     Option Explicit

     Function Gettitle (Titles) As String

         sp = InStr(1, Titles, Chr$(32))

         If sp > 0 Then

             Select Case Left(Titles, sp - 1)

                 Case "An", "A", "The"    ' add any other articles here!

                     Gettitle = Mid(Titles, sp + 1)

                 Case Else

                     Gettitle = Titles

             End Select

         Else

             Gettitle = Titles

         End If

     End Function

To sort a table on the Titles field, create a query with the following

two columns in the query grid:

   Query

   -----

   Field: Sorted List: Gettitle([Titles])

      Sort: Ascending

      Show: Yes

   Field: [Titles]

      Show: No

The first column is a calculated field that extracts the text of the

Titles field, but omits the leading article. The results of this

calculation are sorted in ascending order. The second Show check box

is cleared so that the query result is not displayed.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 276-277 and 404

Additional reference words: 1.00 1.10 2.00 titles sort strip left

KBCategory:

KBSubcategory: PgmOthr


INF: Sorting/Grouping a Query Using a Portion of Field's Value

Article ID: Q88927

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can sort or group a query using only a portion of a field's value.

For example, in the sample database NWIND.MDB, you can create a query

based on the Employees table that uses the Mid() function to sort by

six characters, beginning with the fourth character in the Last Name

field. You can use the Left() and Right() functions to return the

first and last characters of a string argument.

MORE INFORMATION

================

The following procedure explains how to use the Mid() function to sort

data using only a portion of a field's value:

1. Enter the following in the Field row in the first column of the

   query grid:

      Sort String:Mid([Last Name],4,6)

2. Select the Sort cell in the Last Name column and choose Ascending

   or Descending.

3. Choose the Totals button on the toolbar. Group By now appears in

   the Totals row of the query grid.

4. Switch to Datasheet view. "Sort String" appears as the name of the

   column, but you can change this header to any other name.

   Note that the employee records are sorted by the fourth letters of

   the employees' last names.

This technique is useful if a field contains values with a set number

of leading or trailing characters that are insignificant to your

sorting task. An example of this is a part number field called PartNo

that contains the following values:

   PartNo

   ------

   A-453-34567

   A-123-45675

   B-234-75658

   B-645-65759 and so forth

To sort these part numbers by the third through fifth characters only,

use the following expression:

   Expr:MID([PartNo]),3,3)

REFERENCES

==========

For more information on string functions and related functions, search

for "String," "Left," "Right," and "Len" using the Help menu.

Additional reference words: 1.00 1.10 2.00 String Function

KBCategory:

KBSubcategory: QryOthr


INF: SQL Server Triggers and Key Values to and from MS Access

Article ID: Q91179

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

If a Microsoft Access procedure sends a record to a SQL Server to insert

into a SQL Server table, and the unique key for the record is created by

a trigger on that table, the Microsoft Access procedure will lose reference

to the record.

MORE INFORMATION

================

When information is sent to a SQL Server table, Microsoft Access looks at

the record and determines a unique key value using the information in that

record. When the data is passed to a SQL Server backend to be inserted

into a table and a trigger creates a unique key value for the record,

Microsoft Access will lose reference to that record because the unique key

stored by Microsoft Access is different than the unique key created by the

trigger on SQL Server. Until it is queried on using the new unique key

value, Microsoft Access views the record just sent to SQL Server as having

been deleted.

REFERENCES

==========

For more information on SQL Server, search for "SQL Server" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 XPROD

KBCategory:

KBSubcategory: ObcOthr


INF: SQL Server Views Read-Only When Attached

Article ID: Q98786

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft SQL Server versions 1.x and 4.2

---------------------------------------------------------------------

Microsoft SQL Server supports updatable views. Microsoft Access can

only attach these views as read-only because SQL Server views do not

have indexes. Microsoft Access requires a unique index on the attached

object for update/delete/insert capability.

Please refer to Knowledge Base article Q90100 for more information on

Microsoft Access and updating attached SQL Server tables.

Additional reference words: 1.00 1.10 2.00 SQL Server attach table view

KBCategory:

KBSubcategory: ObcOthr


INF: Storing SQL Database Login IDs and Passwords Locally

Article ID: Q101084

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Storing SQL database login IDs and passwords locally requires that the

database administrator create a unique table on the server.

MORE INFORMATION

================

In Microsoft Access version 1.0, if you attach a SQL database table,

you can choose whether you want Microsoft Access to store your login

ID and password locally. If you do not, Microsoft Access prompts you

for your login ID and password each time you connect to the SQL

database containing the table.

If you want Microsoft Access to store the connection information in

your Microsoft Access database so you do not have to type it each time,

you can select the Save Login ID and Password Locally check box in the

Attach Tables dialog box when you attach the SQL database table.

This feature is also present in Microsoft Access version 1.1. For

Microsoft SQL Server, Sybase SQL Server, and ORACLE Server databases,

however, your SQL database administrator can now choose to disable

this feature, requiring all users to enter their login IDs and

passwords each time they connect to a SQL database.

To disable the ability to store login IDs and passwords locally, your

SQL database administrator must create a table called MSysConf in the

SQL database. When a user connects to the SQL database, Microsoft

Access looks for this table in the database and, if it finds it,

queries the table. If the values in the table correctly specify that

local storing of login IDs and passwords should be disabled, Microsoft

Access does so regardless of whether the Save Login ID and Password

Locally check box is selected. If the table is not present or does not

specify disabling of the feature, users can store login IDs and

passwords locally.

The SQL database table MSysConf should have the following structure.

   Column name   Data type                                 Allows Null?

   --------------------------------------------------------------------

   Config        A data type that corresponds to a         No

                 2-byte integer

   chValue       VARCHAR(255)                              Yes

   nValue        A data type that corresponds to a

                 4-byte integer                            Yes

   Comment       VARCHAR(255)                              Yes

If the data source you are working with is case-sensitive, use the

table and column names exactly as shown. All users must have

permission to use the SELECT statement on this table and only the

system administrator can have permission to use the DELETE statement

on this table.

In Oracle, there are a few things that are different. For instance,

the word "Comment" is reserved in Oracle, so you will need to change

it to "Comments." The other change relates to a difference in

data types. Here is how the table would appear in an Oracle database:

   CONFIG          NUM(4,0)         NOT NULL

   CHVALUE         VARCHAR(255)

   NVALUE          NUM(5,0)*

   COMMENTS        VARCHAR(255)

Nvalue can have a precision of up to Num(9,0).

To disable password and login ID storage, the table should have only one

row as follows:

   Column name     Value    Explanation

   --------------------------------------------------------------------

   Config          101      This is the only valid value for Microsoft

                            Access version 1.1.

   chValue         NULL     This is reserved for future use.

   nValue          0 or 1   Use 0 to prevent the password and login ID

                            from being stored; use 1 to permit

                            password and login ID storage as in

                            version 1.0. The default is 1.

   Comment                  Allow storage of passwords and login IDs in

                            Microsoft Access.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: Summary List of Known Issues for Version 2.0

Article ID: Q118369

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article contains a list of confirmed, documented problems with

Microsoft Access version 2.0 as of July 14, 1994. This list contains

identification numbers (Q numbers), titles, and brief summaries from the

articles in the Microsoft Knowledge Base that fully document the problems.

MORE INFORMATION

================

Q115877   PRA: RunningSum Text Box in Report Not Accumulating Values

When a text box in a report that uses the RunningSum property is based

on another control in the report, it does not accumulate the running

sum. Instead, it reflects only the value of the control it references.

-------------------------------------------------------------------

Q115124   PRA: Mailing Label Wizard Creates One-Page Report

A mailing label report created with the Mailing Label Wizard contains

only one page, no matter how many records are in the underlying table or

query. This problem occurs if your default printer is a laser printer,

and you are using any of the following Avery mailing labels:

   4145, 4162, 4163, 4249, 4250, 4251, 4253, 4254, or 5615

-------------------------------------------------------------------

Q116144   PRA: Find Does Not Locate Existing Item in dBASE Database

When you search for a string in an attached dBASE database, the string

is not found, even though the string does exist in the dBASE database.

-------------------------------------------------------------------

Q117169   PRB: Installing MS Access with NT Creates New Program Group

When you install Microsoft Access version 2.0 on a computer running

Microsoft Windows NT version 3.1, and you choose to install the

Microsoft Access icons in an existing common group such as

Applications (Common), Microsoft Access Setup creates a new group

called Applications (Common)(Common) and places the Microsoft Access

icons in this group, instead of in the group you chose.

-------------------------------------------------------------------

Q113562  PRA: Report Section with Subreport Not Included In Output

         File

When you use the Output To command to output a report to a file, any

section of a report that includes a subreport is not included in the

output file.

-------------------------------------------------------------------

Q117168   PRA: Ownership of 1.x Objects Can Be Changed with 2.0 DAO

You can use data access objects (DAO) in Microsoft Access version 2.0

to change the ownership of database objects (such as tables, forms,

and reports) in unprotected Microsoft Access version 1.x databases,

even though you cannot view or change the ownership of these objects

using Microsoft Access version 1.x.

-------------------------------------------------------------------

Q109313   PRB: Changing Show Ruler Option Changes Existing Forms

Changing the Show Ruler option in the Form & Report Design section of

the Options dialog box overrides this setting in existing forms and

reports.

-------------------------------------------------------------------

Q114514   PRA: Changes to Print Setup Not Saved with Form or Report

After you change your form or report to print in a different paper

orientation (such as landscape), it does not print in the orientation

you chose. When you check the Print Setup dialog box, you find that

none of the changes you made were saved.

-------------------------------------------------------------------

Q113929   PRA: Code Called from OnFormat Creates Endless Formatting

A report that calls code from its OnFormat property may not ever

finish formatting, becoming stuck in an internal page formatting loop.

This problem may be more common in databases that have been converted

from Microsoft Access version 1.x to version 2.0.

-------------------------------------------------------------------

Q116061   PRA: Extra White Space Between Last Section and Report

          Footer

Extra white space is printed on your report after the last detail

record or section of the report, before the report footer section. The

extra white space is as tall as the last section printed before the

report footer. Note that this problem will not occur on reports that

do not have a report footer section.

-------------------------------------------------------------------

Q117609   PRA: Paradox Password Protection Bypassed by Multiple Users

When you attach a password-protected Paradox table nonexclusively to a

Microsoft Access version 2.0 database, the table behaves normally,

allowing you to view the table's contents after you supply the correct

password. However, once the password has been supplied by a user, any

other user can then open the attached table and view its contents

without supplying a password.

-------------------------------------------------------------------

Q117614   PRA: Error Adding Zero-Length String to SQL NOT NULL Column

When you attach a SQL Server table that was created with a NOT NULL

restriction on a column, then try to enter a zero-length string in the

table, you receive the error message:

   [Microsoft][ODBC SQL Server Driver][SQL Server] The column <column

   name> in table <table name> may not be null. (#233)

-------------------------------------------------------------------

Q117616   PRA: Error Deleting Value from Attached SQL Server Table

When you attach an SQL Server table that has a column with a NOT NULL

restriction to Microsoft Access, add a value to the restricted column

in the attached table, then delete the value and attempt to commit the

record, you receive the error message:

   [Microsoft][ODBC SQL Server Driver][SQL Server] The column <column

   name> in table <table name> may not be null. (#233)

-------------------------------------------------------------------

Q117610   PRA: GPF Closing Data Outline Control Properties Box

When you add a data outline control to a form or report, then edit the

control's properties, the Properties dialog box is normally modal,

meaning that you cannot select anything outside the dialog box.

If, however, you click the property sheet for the form or report

containing the data outline control, the property sheet gets the

focus, and the modality of the data outline control's Properties

dialog box is lost. You can then select anything in the database.

When the modality of the control's Properties dialog box is broken as

outlined above, your mouse pointer may disappear, and you may receive

a general protection (GP) fault.

-------------------------------------------------------------------

Q117612   PRA: TransferDatabase Fails in Code, Not in Immediate Window

When you use the TransferDatabase action within a transaction in an

Access Basic function, you receive the error message:

   Couldn't update, locked by another user on this system.

However, if you set a breakpoint in the function and single-step

through it, you do not receive the error message.

-------------------------------------------------------------------

Q117615   PRA: GPF Using List Box Fill Function with Requery Method

When you fill a list box using an Access Basic function, and the

function returns a static variable upon receiving the close code (8),

and you then use the Requery method to requery the list box, you

receive a general protection (GP) fault.

-------------------------------------------------------------------

Q114549   PRA: Empty Recordset Report Hangs with Group KeepTogether

Microsoft Access stops while you are previewing a report, and may mark

the database as corrupt. Running Repair Database on the database will

eliminate the error message that says that the database is corrupt.

-------------------------------------------------------------------

Q117611   PRA: GPF Using GetChunk Method as Argument for Put Statement

When you use the GetChunk method in the third parameter of a Put

statement, you get a general protection (GP) fault.

-------------------------------------------------------------------

Additional reference words: 2.00

KBCategory:

KBSubcategory: GnlPrfm


INF: System Objects Retain System Object Properties

Article ID: Q94597

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

A system object always retains the original system object attributes.

Operations performed on system objects such as Import, Rename, and

Copy preserve the flags in MSysObjects.

MORE INFORMATION

================

Operations such as Import, Rename, Copy, and Paste do not change the

flags in MSysObjects. In order to get a copy of a system table without

retaining the system settings, use a make-table query.

Steps to Reproduce Behavior

---------------------------

1. From the View menu, choose Options. Set the argument for Show

   System Objects to Yes.

2. In Micrososft Access version 2.0, import the MSysToolbars table from the

   SYSTEM.MDA. In Microsoft Access version 1.x, import the MSysAccounts

   table from the SYSTEM.MDA.

3. Rename the imported table to TableNew.

4. From the View menu, choose Options. Set the argument for Show

   System Objects to No.

The table TableNew disappears from the Database window because it has

the attributes of a system object.

REFERENCES

==========

For more information about system objects, search for "system objects"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 system

KBCategory:

KBSubcategory: TblFldp


INF: Table Permissions Changes Not Effective with Open Form

Article ID: Q109934

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

========

Removing Read Data permissions on a table does not take effect while a form

based on that table is open in Design view.

No error or warning message is issued while the Permissions dialog box

is being used. The open form will still display data. However the

permission assignment change will not become effective until after the

form is closed.

MORE INFORMATION

================

Microsoft Access maintains an open connection to the table(s) the form

is based on while it is in Design view.

The purpose of this is so Microsoft Access does not have to reopen the

tables when the form is re-run to optimize performance.

Make sure that reports, forms and queries which use the table being

modified are closed before removing Read Data permissions.

Steps to Reproduce Behavior

---------------------------

 1. Log in as Admin and open the sample database NWIND.MDB as shared.

 2. Add User1 to the Users Group

 3. Make sure that the Users Group has Read Data Permissions

    on the Customers table.

 4. Minimize NWIND.

 5. Open a second instance Microsoft Access and log in as User1.

 6. Create a form bound to the Customers table.

 7. Open the form in Datasheet view, and view the data.

 8. Return to design view of the form.

 9. Minimize this second instance of Microsoft Access

10. Reopen the first instance of Microsoft Access.

11. Revoke the Users Group Read Data permissions for the Customers

    table.

12. Reopen the second instance. Switch to the Datasheet view

    of the form.

Result: Data is displayed even though Read Data permissions for the

underlying table were taken away from User1. If you close the form you

will not be able to reopen it, because the Read Data permissions

revocation will have taken effect.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 25, "Administering a

Database System," pages 614-627

Additional reference words: 1.00 1.10 2.00 rights

KBCategory:

KBSubcategory: ScrtOthr


INF: Temporarily Disabling a Macro Action

Article ID: Q90167

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Programming languages (such as Access Basic), typically provide a way

to temporarily disable any syntax on a line of code. For example, in

Access Basic, you can place a REM command at the beginning of a line

of code so that it is not executed. This feature is useful when you

are debugging several lines of code because it allows you to determine

which line is causing an error by disabling one line at a time until

the error no longer occurs.

This method can also be useful for debugging macros. This article

describes how you can temporarily disable a macro line.

MORE INFORMATION

================

To disable a macro action line without deleting it:

1. Open the macro sheet containing the line you want to disable.

2. If there is no Conditions column, choose Conditions from the

   View menu to open the Conditions column.

3. In the Conditions column, on the line you want to disable, type

   "False" (without quotation marks) if there is nothing in the column

   for that line, or "False And" (without quotation marks) if a

   condition is already entered in the column.

Now, when you run the macro, the Condition for the macro action will

be evaluated as false and the line will be ignored.

Additional reference words: 1.00 1.10 2.00 remark

KBCategory:

KBSubcategory: McrCond


INF: Three Methods for Testing the VBCL

Article ID: Q114679

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Once you have installed the Visual Basic Compatibility Layer (VBCL),

there are several test methods you can use in Visual Basic version 3.0

to verify that it is working correctly:

 - Using the Data Manager window. (This is the simplest method.)

 - Using the Data Access control.

 - Using the Visual Data (VisData) sample application (Visual Basic

   Professional Edition only).

MORE INFORMATION

================

Using The Data Manager Window

-----------------------------

1. Start Visual Basic and choose Data Manager from the Window menu.

2. From the File menu, choose Open Database, then choose Microsoft Access.

3. Select the sample database NWIND.MDB, and then choose OK.

If the VBCL is installed correctly, you will see a list of all the tables

in NWIND.MDB. If the VBCL is not installed, or is not installed correctly,

you will receive the error message "Incompatible database version."

Using the Data Access Control

-----------------------------

1. Start Visual Basic and place a data access control and a text box

   control on a new form.

2. Set the following properties for the data access control:

      DatabaseName: C:\ACCESS\SAMPAPPS\NWIND.MDB

      RecordSource: Employees

3. Set the following properties for the text box control:

      DataSource: Data1

      DataField: Last Name

4. From the Run menu, choose Start.

If the VBCL is installed correctly, you will see the name "Davolio" in the

text box. Also, you will be able to step back and forth through the names

using the arrows on either side of the data access control.

If the VBCL is not installed, or is not installed correctly, you will

receive the error message "Incompatible database version."

Using the Visual Data (VisData) Sample Application

--------------------------------------------------

1. Start Visual Basic and open the VISDATA.MAK file in the

   SAMPLES\VISDATA subdirectory.

2. From the Run menu, choose Start.

3. From the File menu, choose Open Database, then choose Microsoft Access.

4. Select NWIND.MDB.

If the VBCL is installed correctly, you will see a list of tables and

queries from the NWIND database. Otherwise, you will receive the error

message:

   Incompatible database version

   Number: 3041

To test the VBCL further, enter the following statement in the SQL window:

   SELECT * FROM Employees

If the VBCL is installed correctly, you will see a window titled "Dynaset:

Employees" with the first employee's data showing.

Additional reference words: 2.00 ADT Attaching Testing

KBCategory:

KBSubcategory: DcmNwd


INF: Tile, Cascade Menu Options Inconsistent with Prog Manager

Article ID: Q98800

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The order in which the Tile and Cascade options appear on the Window

menu in Microsoft Access are not the same as in Microsoft Windows

Program Manager. Also, SHIFT+F4 and SHIFT+F5 are not shown as shortcut

key combinations for Tile and Cascade, respectively.

MORE INFORMATION

================

The Tile and Cascade menu options function in exactly the same way in

Microsoft Access as they do in Program Manager.

REFERENCES

==========

For more information on shortcut key combinations, search for "shortcut

keys" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 WinIss ui shorcut quickkey

hotkey

KBCategory:

KBSubcategory: EvnOs


INF: Tips for Debugging Access Basic Code

Article ID: Q108438

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article contains tips to help you debug your Access Basic code. This

article assumes that your code compiles correctly, but does not perform as

you expect.

MORE INFORMATION

================

The general procedure for debugging Access Basic code is to break larger

procedures apart into smaller sub-procedures, verify that the individual

steps in each sub-procedure work correctly, and then combine the sub-

procedures one by one until the code works correctly.

Using The Immediate Window

--------------------------

You can use the Immediate window to execute individual lines of Access

Basic code, or to check the values of variables. Therefore, you can use the

Immediate window to:

 - Test and debug Function and Sub procedures.

 - Check the value of a field, control, property setting, variable, or

   expression.

 - Display the result of an expression when the code is running.

The following steps demonstrate how to use the Immediate window to debug

your Access Basic functions:

1. Open the module containing your function in Design view.

2. From the View menu, choose Immediate Window.

3. Run your function in the Immediate window by typing "?<FunctionName>()"

   (without the quotation marks) and then pressing ENTER. Substitute the

   name of your function for <FunctionName>, and be sure to place all

   arguments expected by your function inside the parentheses.

For more information on the Immediate window, search for "immediate window"

then "Immediate Window" using the Microsoft Access Help menu.

Using Breakpoints with the Immediate Window

-------------------------------------------

A breakpoint suspends execution of the code, allowing you to check the

values of variables. You can use the Immediate window with breakpoints to

pinpoint code problems quickly.

For example, if the first part of your code runs correctly, but other parts

do not, you can follow the sample steps below to find the malfunctioning

part:

1. Set a breakpoint right after the part that you know works correctly. To

   set a breakpoint:

   a. Move your cursor to the line of code where you want to set the

      breakpoint.

   b. Click the Breakpoint button (the five-fingered hand) on the tool bar.

      Or, press F9, or choose Toggle Breakpoint from the Run menu. The line

      will appear in bold type, indicating that there is a breakpoint set

      at that line.

2. Run the function in the Immediate window (see "Using The Immediate

   Window" above). When code execution reaches the breakpoint, processing

   is suspended and the breakpoint line is selected. You can then check the

   value of variables in the code.

For example, to check the value of a variable called MyName, type the

following in the Immediate window and then press ENTER:

   ?MyName

The value of MyName is displayed in the Immediate window. If the value is

correct, check other variables. If the value is incorrect, check the

previous lines of code to see where this variable is assigned an incorrect

value.

Using the Debug.Print Statement

-------------------------------

You can use the Debug.Print statement in your code to display the values of

your variables in the Immediate window. Good places to include Debug.Print

statements include:

 - The beginnings of functions, to check the arguments passed to the

   function. For example, to check the values of two arguments passed to

   the DoSomeCalcs() function, place the following sample Debug.Print

   statement at the beginning of the function:

      Function DoSomeCalcs(Arg1, Arg2)

         Debug.Print "Function DoSomeCalcs " & Arg1 & " " & Arg2

   When the DoSomeCalcs() function is run, the text "Function DoSomeCalcs"

   and the values of the two arguments Arg1 and Arg2 will be displayed in

   the Immediate window. If the values of the arguments are not correct,

   the problem is occurring before the function is run.

   You can also use the Debug.Print statement at the beginning of each

   function if you have a complex application and you are not sure which

   function might be causing the problem. This allows you to check the

   Immediate window to see the order in which functions were called, and

   determine which was the last function called.  In Access 2.0, you can

   also select Calls from the View menu to list the current function

   call stack, and show the order that functions were called.

 - Decision structures, to check that you are using the correct logic

   for the function. For example, the sample code on page 23 of the

   Microsoft Access "Introduction to Programming" manual uses a Select

   Case statement. You can add a Debug.Print statement to this sample

   code, as demonstrated below, to verify that the code is doing what

   you expect:

      Function DueDate (anyDate)

      Debug.Print "Function DueDate " & anyDate

      Dim Result

         If Not IsNull(anyDate) Then

            Result = DateSerial(Year(anyDate), Month(anyDate) + 1, 1)

            Debug.Print "Result: " & Result

            Debug.Print "Weekday(Result): " & Weekday(Result)

            Select Case Weekday(Result)

               Case 1:      'Sunday

                  Debug.Print "Case 1"

                  DueDate = Result + 1

               Case 7:      'Saturday

                  Debug.Print "Case 7"

                  DueDate = Result + 2

               Case 6:      'Friday

                  Debug.Print "Case 6"

                  DueDate = Result - 1

               Case Else

                  Debug.Print "Case Else"

                  DueDate = Result

            End Select

         Else

            Result = Null

         End If

      End Function

   Run this function in the Immediate window by typing the following

   and then pressing ENTER:

      ?DueDate(#10/1/93#)

   The following results will be displayed in the Immediate window:

      Function DueDate 10/1/93

      Result: 11/1/93

      Weekday(Result): 2

      Case Else

      11/1/93

   These results show that you are using the correct logic for this

   function. If you had received different results (the wrong case, for

   example) you could then check the values of other values and expressions

   to determine where the problem is.

 - In loops, to check the values of variables. If you use a breakpoint

   to check the value of a variable in a loop, you cannot see how the

   value of the variable changes as the loop executes. However, if you

   include the statement "Debug.Print MyName" (without the quotation marks)

   in your loop structure, the value of variable MyName will be displayed

   in the Immediate window each time the function cycles through the loop.

   This method is also a good way to verify that the loop is executing

   the number of times you expect. If the loop executes four times, you

   should see four values for the value in the Immediate window.

 - Where clauses, to check the values of criteria in SQL statements.

   For example, the following sample function creates a dynaset from

   a SQL statement. If there is a problem in a SQL statement (such as

   in this function), it can be difficult to locate the problem. However,

   this function uses the Debug.Print statement to display the SQL

   statement as Microsoft Access sees it and uses it:

      Function TestMe()

         Dim db As Database, ds As Dynaset

         Dim empnum As Long

         Dim sql As String

         Set db = CurrentDB()

         empnum = 5

         sql = "select * from orders where [employee id]=empnum;"

         Debug.Print sql

         Set ds = db.CreateDynaset(sql)

      End Function

   Run this function in the Immediate window by typing the following

   and then pressing ENTER:

      ?TestMe()

   The following result is displayed:

      select * from orders where [employee id]=empnum;

   Note that the Where condition shows [employee id] = empnum, not

   [employee id] = 5, as you assigned it. To fix this particular problem,

   change the Where condition to concatenate the empnum variable, as

   follows:

      Function testme()

         Dim db As Database, ds As Dynaset

         Dim empnum As Long

         Dim sql As String

         Set db = CurrentDB()

         empnum = 5

         sql = "select * from orders where [employee id]=" & empnum & ";"

         Debug.Print sql

         Set ds = db.CreateDynaset(sql)

      End Function

   When you run the corrected function, the following statement will be

   displayed:

      select * from orders where [employee id]=5;

Stepping Through the Code

-------------------------

Stepping through your code means executing the code one line at a time.

This is sometimes referred to as tracing. Access Basic has two ways of

stepping through code: single stepping, and procedure stepping.

Single stepping executes each step of a called procedure, stopping at each

line in the procedure. Procedure stepping executes a called procedure all

at once, then returns to the next line in the current procedure.

To step through your code:

1. Set a breakpoint in your code at the line where you want to begin

   stepping. (See "Using Breakpoints with the Immediate Window", above).

   To step through an entire function, set the breakpoint on the first

   line of the function.

2. Start the function. When program execution reaches the breakpoint, the

   line with the breakpoint will be selected in the function's module.

3. To single step, click the Single Step button (single foot) on the

   toolbar. Or, press F8, or choose Single Step from the Run menu. The

   selected line of code will be executed, and then the next line of code

   will be selected. You can continue through your code one line at at time

   in this fashion.

If your code calls other functions or procedures you will single step

through them as well. If you do not want to single step through these other

procedures, click the Procedure Step button (double foot) on the toolbar.

Or, press SHIFT+F8, or choose Procedure Step from the Run menu.

Note that as you step through your code, you can check the values of

variables in the Immediate window (see "Using the Immediate Window",

above).

If you want to continue running your code normally (without single or

procedure stepping), click the Run button (exclamation point) on the

toolbar. Or, press F5, or choose Continue from the Run menu.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.x, Chapter 4,

"Debugging Your Access Basic Code"

Microsoft Access "Building Applications," version 2.0, Chapter 9,

"Debugging"

Additional reference words: 1.00 1.10 2.00 AB trouble shoot

KBCategory:

KBSubcategory: PgmOthr


INF: Tips for Improving Combo and List Box Performance

Article ID: Q112745

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists several things you can do to improve the speed and

performance of combo and list boxes in your Microsoft Access version 2.0

applications.

MORE INFORMATION

================

To improve combo and list box performance:

 - Include only fields from the record source that are absolutely

   necessary. Extra fields can decrease combo or list box performance.

 - Index the first field that is displayed in the combo or list box.

 - Index any other fields used for criteria (such as when a combo or list

   box is based on a criteria query).

 - In combo boxes, set the AutoExpand property to No if it is not needed.

 - Do not hide the combo box's bound column by setting its width to 0 in

   the ColumnWidth property.

 - Create a default value for combo boxes. Combo boxes try to match

   whatever is entered in them, so if there is no default value for the

   combo box, the combo box tries to match a null value when it is first

   opened. An example of a default value for a combo box is:

      =[combobox].ItemData(0)

   In the example above, [combobox] is the name of the combo box, and

   ItemData(0) refers to the first row of the combo box. The default

   value of the combo box becomes the value in its first row.

 - Use unbound subforms to display data when there is a large number of

   records.

 - The first non-hidden column in your combo box should have a text data

   type, not numeric.  In order to find a match in the list, Microsoft

   Access will have to convert the numeric value to text to do the

   character by character match.  If the data type is text, Microsoft

   Access does not have to do this conversion.

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsCmbo


INF: Tips for Improving Subform Performance

Article ID: Q112747

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article lists several things you can do to improve the speed and

performance of subforms in your Microsoft Access version 2.0 applications.

MORE INFORMATION

================

To improve subform performance:

 - If you can, base your subforms on queries rather than tables. Include

   only fields from the record source that are absolutely necessary. Extra

   fields can decrease subform performance.

 - Index all the fields on the subform that are linked to the main form.

   Indexes help speed the search process to find the matching subform

   records.

 - Index any fields used for criteria (such as when a subform is

   based on a criteria query).

 - If you are linking on multiple fields, add a calculated field to the

   main form that concatenates the fields. Then, create a calculated column

   in the subform's RecordSource property query with the same expression.

   For example, to link to the subform on an Employee ID field and an

   Order ID field, create a text box on the main form with the following

   properties:

      Name: EmployeeIDOrderID

      ControlSource: =[Employee ID] & [Order ID]

   Next, add the following field to the query that the subform is based

   on:

      EmployeeIDOrderID: [Employee ID] & [Order ID]

   Then, link the main form and the subform on the concatenated field

   rather than on the two individual fields. The subform properties might

   look like:

      LinkChildFields: EmployeeIDOrderID

      LinkMasterFields: EmployeeIDOrderID

   Since Microsoft Access only has to compare one criteria to return

   the subform's recordset, the subform's performance should be improved.

 - Set the subform's DefaultEditing property to ReadOnly if the records

   in the subform are not going to be edited.

REFERENCES

==========

For general performance and indexing recommendations, search for

"performance" and "Rushmore technology" using the Microsoft Access Help

menu.

Additional reference words: 2.00 Forms Subforms Speeding Slow

KBCategory:

KBSubcategory: FmsSubf


INF: Tips for Optimizing Queries on Attached SQL Tables

Article ID: Q99321

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Special considerations must be made for performance optimization of

queries built on attached SQL database tables. An SQL database, for

this article, is defined as any client/server database that supports

some level of ANSI SQL as an intrinsic part of the database's

programming language. Optimal query strategy for these queries is to

ensure that all query operations are performed on the server. This

article outlines tips on how to ensure that queries against attached

SQL database tables are performed on the server.

This article assumes a basic understanding of client/server computing

environments and architectures.

MORE INFORMATION

================

The key to improving query performance on attached SQL database tables

is to ensure that no data is filtered on the client. Filtering data on

the client increases network traffic and does not allow for leveraging

of advanced server hardware, essentially turning a client/server

system into a file server system. To this end, keeping the query

evaluation on the server reduces overhead and keeps an application

running as fast as possible.

Generic query optimization techniques should not be ignored when you

are using attached SQL database tables. "WHERE clause" restrictions,

such as equality or range comparisons, and sorting should still be

performed on indexed fields. For more information on query

optimization, call Microsoft Sales Information Center at

800) 426-9400 to order a "white paper" on SQL Server optimization. Other

SQL database vendors may provide the same information for their customers.

Use care when implementing intrinsic or user defined functions (UDFs)

in query fields or when using criteria that are not supported on the

server. Generally, SQL databases have functionality that corresponds

to most standard Microsoft Access functions, but each server will be

different.

Many intrinsic Microsoft Access functions have direct back-end

correspondents. Microsoft Access asks the ODBC driver about intrinsic

function support and performs the appropriate mappings.

You can use UDFs and Microsoft Access intrinsic functions without server

equivalents when they are accompanied by server-capable restrictions

that restrict the data. For example, the following query

   Query1a: SELECT * FROM MillionRowTable WHERE Funk1(col1) = 10

returns the whole table and evaluates Funk1(col1) = 10 locally, whereas

the following query

   Query1b: SELECT * FROM MillionRowTable WHERE Funk1(col1) = 10

                      AND LastName BETWEEN 'g' AND 'h'

sends the BETWEEN 'g' AND 'h' restriction to the server, returns the

qualifying rows, and evaluates Funk1(col1) on only those rows.

Non-remote-capable SELECT list items do not force a query to be

executed locally, unless they are used with unique values or a totals

query (DISTINCT/GROUP BY). For example, the following query

    Query2a: SELECT * FROM MyTable WHERE Format(col1, ...) = 10

returns the whole table and causes the WHERE clause to be evaluated

locally. However, the following query

    Query2b: SELECT Format(col1,...) FROM MyTable WHERE col2 = 10

sends "SELECT col1 FROM MyTable WHERE col2 = 10" to the server,

presumably returning far less data over the network. It then locally

evaluates Format() on the col1 values returned.

Of the following two queries, Query3a is sent completely to the

server. Query3b sends "SELECT col1 FROM MyTable" and performs the

Format() function, and therefore the DISTINCT clause, locally.

    Query3a: SELECT DISTINCT col1 FROM MyTable

    Query3b: SELECT DISTINCT Format(col1,...) FROM MyTable

The following two queries are performed as follows: Query4a is sent

completely to the server. Query4b sends "SELECT col1 FROM MyTable" and

performs the StdDev() aggregate function locally, since it's not a SQL

standard function.

    Query4a: SELECT Sum(col1) FROM MyTable

    Query4b: SELECT StdDev(col1) FROM MyTable

Crosstab queries present unique restrictions, some pertinent to all

queries, some to crosstab queries only:

1. Only standard aggregate functions, such as Count(), Sum(), Min(),

   Max(), and Avg(), can be used.

2. Aggregate functions cannot be used as row or column headers.

3. Only one aggregate function can be used in the "value."

4. Nothing can be sorted.

5. If a fixed-value list of column headers is supplied, the value

   cannot be embedded in an expression.

Restriction #1 applies to all queries against SQL databases from

Microsoft Access. Except for #4, the others are uncommon and are

crosstab/SQL database specific. Crosstab queries are not SQL standard,

and are not generally supported on SQL database servers. However, if

the rules above are not violated (which is the case for most simple

crosstab queries), Microsoft Access can reformulate the query as a

standard GROUP BY query, send it remotely, return only the aggregation

result, and transform it into a crosstab locally.

Open-ended restrictions do not use indexes on SQL databases.

Typically, a SQL WHERE clause reading

   WHERE col1 > 1000

will be slower than

   WHERE col1 between 1000 and 1000000000

This is a server problem, not a Microsoft Access problem, but it can

affect Microsoft Access performance when a SQL database is used as a

back end.

When you are using wildcard characters, take special care to ensure

that the correct wildcards are used. SQL Server supports the use of %

and _ rather than ? and * for wildcards. For more information, query

on the following words in the Microsoft Knowledge Base:

   parameter and queries and wildcards and SQL

Additional reference words: 1.00 1.10 2.00 SQL server attach query

performance

KBCategory:

KBSubcategory: ObcOthr


INF: Tips on How to Troubleshoot Microsoft Access Macros

Article ID: Q89610

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article presents five methods of troubleshooting a Microsoft

Access macro. When a macro fails to perform correctly, there are

several tools that can be used to help isolate where the problem is:

 - Single Stepping - This feature steps through a macro one action at

   a time with a pause between each action. To activate single step

   mode, choose the Single Step button on the toolbar or choose

   Single Step from the Macro menu. When any macro is run, it will

   execute in single step mode until you turn this feature off or

   choose the Continue button in the Macro Single Step dialog box.

   This feature make it easy to determine if the action items are

   listed in the correct sequence. During single step mode, Microsoft

   Access displays the Macro Single Step dialog box, which displays

   the macro name, the name of the first action in the macro, and the

   arguments for this action. To continue macro execution, you can

   choose the Step, Halt, or Continue button.

 - Action Failed Dialog Box - This feature displays an error message

   caused by an invalid action. The same information displayed by the

   Single Step dialog box is displayed in this dialog box. To return

   to the Macro window and correct the problem, choose the Halt

   button.

 - MsgBox Action - Insert the MsgBox action in your macro wherever you

   want to display the value of a control. The action argument for the

   message will be the name of the control you want to check. For

   example, to display the value of an unbound control named Field1 in

   Form1, enter the expression "=Forms!Form1!Field1" (without

   quotation marks) for the message.

 - StopMacro Action - This macro action takes no arguments and will

   stop the macro. Use this action to check the results that have been

   calculated so far. Use this feature together with the Immediate

   window to display calculated values.

 - Immediate Window - This tool can be used to display any values that

   have been declared. The Immediate window is associated with module

   objects. To display the Immediate window, open an existing module,

   or create a new module, then choose Immediate window from the View

   menu. To display a value, type a question mark, then the variable

   name, and then press the ENTER key.

   For information on displaying the Immediate window without displaying

   the Module window, search on the following words in the Microsoft

   Knowledge Base:

      immediate and findwindow and showwindow

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 523-524

Additional reference words: 1.00 1.10 2.00 debugging

KBCategory:

KBSubcategory: McrOthr


INF: Topics Supported by Microsoft Access as a DDE Server

Article ID: Q89586

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access supports dynamic data exchange (DDE) as both a client

(destination) and a server (source) application. This article lists the DDE

topics that Microsoft Access supports as a DDE server, and the valid DDE

items for each topic.

Notes

-----

 - In this article, an asterisk (*) indicates a feature that is not

   available in Microsoft Access version 1.0.

 - All the examples below require that you have the sample database

   NWIND.MDB open.

MORE INFORMATION

================

As a DDE server, Microsoft Access supports the following topics:

 - The System topic

 - The name of a database, table, or query

 - A Microsoft Access SQL statement

The System Topic

----------------

The System topic is a standard topic for all Microsoft Windows-based

DDE server applications, and returns information about the topics

supported by the application. The System topic supports the following

Microsoft Access data items:

 - SysItems: A list of items supported by the System topic in Microsoft

             Access

 - Formats:  A list of formats Microsoft Access can copy to the Clipboard

 - Status:   "Busy" or "Ready"

 - Topics:   A list of all open databases

Note that any information returned from any item used with the System topic

is tab delimited.

The following sample Microsoft Word for Windows WordBasic macro

demonstrates how to use the System topic to get information on available

topics from Microsoft Access:

   Chan = DDEInitiate("MSAccess", "System")

   Topics$ = DDERequest$(Chan, "Topics")

   DDETerminate Chan

   MsgBox Topics$, "Topics", 64

The Database Topic

------------------

The database topic is the filename of an existing database. After you

initiate a DDE conversation with the database, you can request a list of

objects in that database. This list of information is tab delimited. Note

that you cannot query the SYSTEM.MDB database using DDE.

The database topic supports the following items:

 - TableList

 - QueryList

 - FormList

 - ReportList

 - MacroList

 - ModuleList

The following sample Word for Windows WordBasic macro demonstrates how to

retrieve a list of table names in the NWIND database:

   Chan = DDEInitiate("MSAccess", "NWIND")

   TableList$ = DDERequest$(Chan, "TableList")

   DDETerminate Chan

The TABLE TableName, QUERY QueryName, and SQL SQLString Topics

--------------------------------------------------------------

The TABLE, QUERY, and SQL DDE topics are used to retrieve information

from Microsoft Access tables. The returned information is tab delimited.

The syntax for these topics is as follows:

   <DatabaseName>; TABLE <TableName>

   <DatabaseName>; QUERY <QueryName>

   <DatabaseName>; SQL <SQLString>

Description of Syntax:

<DatabaseName>   The name of the database to which the table or query

                 belongs or the SQL statement applies, followed by

                 a semicolon (;). The database name can be either the

                 base name only (for example, NWIND), or its full path

                 and .MDB extension (for example, C:\ACCESS\NWIND.MDB).

<TableName>      The name of an existing table.

<QueryName>      The name of an existing query.

<SQLString>      A valid SQL SELECT statement of up to 255 characters,

                 ending with a semicolon (;). Note that you can exchange

                 more than 255 characters by omitting the <SQLString>

                 statement and using successive DDEPoke() statements to

                 build an SQL statement. For example, the following

                 WordBasic code uses the DDEPoke() function to build an

                 SQL statement and request the results of the query:

                   Chan = DDEInitiate("MSAccess", "NWIND;SQL")

                   DDEPoke Chan, "SQLText", "SELECT * FROM Orders "

                   DDEPoke Chan, "SQLText", "WHERE [Order Amount] > 1000;"

                   Results = DDERequest$(Chan, "Data")

                   DDETerminate Chan

Note that you cannot initiate a DDE link with Microsoft Access using an

action query. Action queries, such as Append (INSERT INTO), Update

(UPDATE...SET), Delete (DELETE...FROM), and Make-table (SELECT...INTO)

perform an action on data. A Select query, which finds and returns data,

can be used as the topic of a DDE conversation.

*You can perform SQL action queries using DDE by running the RunSQL macro

action using the DDEExecute() function.

The following is a list of valid DDE items for the TABLE TableName,

QUERY QueryName, and SQL SQLString DDE topics:

   All              All data in the table, including field names.

   Data             All rows of data, without field names.

   *FieldNames      A single-row list of field names.

   FieldNames;T     Two data records, the first a list of field names,

                    and the second a list of data types. The data types

                    are:

                     0    Invalid

                     1    True/False (non-NULL)

                     2    Unsigned byte (Byte)

                     3    2-byte signed integer (Integer)

                     4    4-byte signed integer (Long)

                     5    8-byte signed integer (Currency)

                     6    4-byte single-precision floating point (Single)

                     7    8-byte double-precision floating point (Double)

                     8    Date/Time (date is integer, time is fraction)

                     9    Binary data, 255-byte maximum

                    10    ANSI text, not case sensitive, 255-byte

                          maximum (Text)

                    11    Long binary (OLE Object)

                    12    Long text (Memo)

   NextRow          The data in the next row in the table or query.

                    When you first open a channel, NextRow returns the

                    data in the first row. If the current row is the last

                    record and you execute NextRow, the request fails.

   PrevRow          The data in the previous row in the table or query.

                    If PrevRow is the first request on a new channel, the

                    data in the last row of the table or query is

                    returned. If the first record is the current row, the

                    request fails.

   FirstRow         The data in the first row of the table or query.

   LastRow          The data in the last row of the table or query.

   FieldCount       The number of fields in the table or query.

   *SQLText         An SQL statement representing the table or query.

                    For tables, this item returns an SQL statement in the

                    format "SELECT * FROM table;".

   *SQLText;<n>     An SQL statement in <n>-character chunks that

                    represents the table or query, where <n> is an

                    integer lower than 255. For example, for a query

                    represented by the SQL statement "SELECT * FROM

                    Orders;" the item "SQLText;7" would return the

                    following tab-delimited chunks:

                       SELECT

                       * FROM

                       Orders;

The following sample WordBasic macro demonstrates how to get information

from the Employees table in NWIND.MDB:

   Chan1 = DDEInitiate("MSAccess", "NWIND;TABLE Employees")

   ' Get a count of the number of Employee records.

   SQL$ = "SELECT Count([Employee ID]) AS [CountOfEmployees] "

   SQL$ = SQL$ + "FROM Employees;"

   Chan2 = DDEInitiate("MSAccess", "NWIND;SQL " + SQL$)

   EmployeeCount =  Val(DDERequest$(Chan2, "FirstRow"))

   DDETerminate Chan2

   ' Quit if there are no records.

   If EmployeeCount <> 0 Then

      Msg$ = "NWIND Employee Information:"

      Msg$ = Msg$ + "       Record Count:" + Str$(EmployeeCount)

      MsgBox Msg$

      ' Request the first row of data from the Employees table.

      Data$ = DDERequest$(Chan1, "FirstRow")

      ' Display the records.

      For i = 1 To EmployeeCount

         MsgBox Data$

         ' Get the next row of data, if not at the end.

         If i <> EmployeeCount Then

            Data$ = DDERequest$(Chan1, "NextRow")

         End If

      Next i

   End If

Executing Macros and Commands in Microsoft Access Using DDE

-----------------------------------------------------------

When you are using Microsoft Access as a DDE server, you can use the

DDEExecute() function to instruct your application to execute a

command. Microsoft Access recognizes any of the following valid

commands:

 - The name of a macro in the currently open database. A macro

   can be executed on a channel with any of the five topics described

   above.

*- Any action that you can execute in Access Basic using the DoCmd()

   statement. You cannot execute the following macro actions: AddMenu,

   MsgBox, RunApp, RunCode, SendKeys, SetValue, StopAllMacros,

   and StopMacro.

*- The OpenDatabase and CloseDatabase actions, executed only for DDE

   operations using the System topic.

Note that when you specify an action as a DDEExecute command, the action

and any arguments follow the DoCmd() syntax and must be enclosed in

brackets ([]). However, applications that support DDE do not recognize

intrinsic constants, such as A_NORMAL, in DDE operations. Therefore,

you must use the actual number as an argument. Also, string arguments

must be enclosed in quotation marks only if the string contains a

comma. Otherwise, quotation marks are not required.

The following sample macro opens the Categories form, first minimized and

then restored:

   Chan = DDEInitiate("MSACCESS", "System")

   AppActivate "Microsoft Access"

   DDEExecute Chan, "[OpenForm Categories,,,,,2]"

   DDEExecute Chan, "[OpenForm Categories]"

   DDETerminate Chan

*Using the OpenDatabase and CloseDatabase Commands

--------------------------------------------------

The following commands can be executed on a channel opened to the System

topic. These commands facilitate the remote opening and closing of

databases in Microsoft Access from the client application.

 - OpenDatabase <DatabaseName> [, Exclusive[, ReadOnly]]

 - CloseDatabase

   <DatabaseName>   A string expression that is the name of an existing

                    database. This can include the fully qualified

                    MS-DOS path.

   [Exclusive]      A Boolean value that is True (-1) if the database is to

                    be opened with exclusive (nonshared) access and False

                    (0) if the database is to be opened with shared access.

                    The default is shared access.

   [ReadOnly]       A Boolean value that is True if the database is to be

                    opened with read-only access and False if it is to be

                    opened with read/write access. The default is

                    read/write access.

The following sample WordBasic macro demonstrates how to use the

OpenDatabase actions to remotely open NWIND.MDB and then open the Employees

form:

   Chan = DDEInitiate("MSACCESS", "System")

   DDEExecute Chan, "[OpenDatabase NWIND.MDB]"

   DDEExecute Chan, "[OpenForm Employees,0,,,1,0]"

   DDETerminate Chan

REFERENCES

==========

For more information on using Microsoft Access as a DDE server, search for

"DDE" then "Using Microsoft Access As a DDE Server" using the Microsoft

Access Help menu.

For more information on using DDE with Microsoft Access, query on the

following words here in the Microsoft Knowledge Base

   dde and <the name of the other application in the conversation>

Microsoft Access "User's Guide," Chapters 9 and 13

The README.TXT file that is shipped with Microsoft Access version 1.0

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: IntpDde


INF: TraceSQLMode Setting Helps Debug SQL Queries to ODBC

Article ID: Q113918

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can create a log file of all the SQL queries sent to ODBC for

processing by setting the TraceSQLMode setting to 1 in your MSACCESS.INI

file (Microsoft Access version 1.1) or in your MSACC20.INI file (Microsoft

Access version 2.0).

MORE INFORMATION

================

To create a log file of all the SQL queries sent to ODBC for processing,

set the TraceSQLMode setting in the [ODBC] section of your .INI file to 1.

The line will be:

   [ODBC]

   TraceSQLMode=1

NOTE: After setting this option, you must restart Microsoft Access for the

change to take effect.

Microsoft Access will record all SQL commands in a file called SQLOUT.TXT

in the Microsoft Access directory. SQL commands will continue to be

recorded in the file as long as the TraceSQLMode setting is set to 1.

To turn the TraceSQLMode option off, change the setting from 1 to 0. The

line will be:

   [ODBC]

   TraceSQLMode=0

NOTE: After setting this option, you must restart Microsoft Access for the

change to take effect.

The following is an example of an SQLOUT.TXT file:

   ================= Open the attached dbo.authors ==================

   SQLExecDirect: SELECT dbo.authors.au_id FROM dbo.authors

   SQLPrepare: SELECT au_id ,au_lname ,au_fname ,phone ,address ,city

   ,state ,zip ,contract  FROM dbo.authors WHERE au_id = ?

   SQLExecute: (GOTO BOOKMARK)

   SQLPrepare: SELECT au_id ,au_lname ,au_fname ,phone ,address ,city

   ,state ,zip ,contract  FROM dbo.authors WHERE au_id = ? OR au_id =

   ? OR au_id = ? OR au_id = ? OR au_id = ? OR au_id = ? OR au_id = ?

   OR au_id = ? OR au_id = ? OR au_id = ?

   SQLExecute: (MULTI-ROW FETCH)

   SQLExecute: (MULTI-ROW FETCH)

   SQLExecute: (MULTI-ROW FETCH)

   ===================================================================

REFERENCES

==========

Search for "Setting ODBC options in the MSACCESS.INI file" in the

README.TXT file in Microsoft Access version 1.1.

Search for "ODBC Settings" then "Customizing MSACC20.INI Settings" using

the Microsoft Access version 2.0 Help menu.

Additional reference words: 1.10 2.00 queries tracing sqltrace

troubleshoot sql

KBCategory:

KBSubcategory: ObcOthr


INF: Transparent Text Boxes Not Supported

Article ID: Q91045

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

The default label control associated with a text box control has a

BackStyle property that can be changed to Clear on the color palette,

but the text box itself has no such property and cannot be changed to

Clear on the color palette.

To work around this limitation, change the BackColor property of the

text box to the same color as the background it overlays.

Additional reference words: 1.00 1.10 2.00 back color style

KBCategory:

KBSubcategory: FmrColr


INF: Trapping SQL Server RAISERROR() Function Values

Article ID: Q101678

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft SQL Server users often create triggers or stored procedures that

perform specific functions that are fired during certain events. Often, a

custom-generated error value is desired to indicate the status of such

events. This article describes a way to trap that value in Microsoft

Access.

NOTE: This article assumes that the user is running Microsoft Access

version 1.1, since that version corrects a problem to allow the SQL

Server RAISERROR() function to return a value to Microsoft Access.

MORE INFORMATION

================

1. Create the following stored procedure based on the sample database

   PUBS in Microsoft SQL Server:

      CREATE PROCEDURE TestProc

      AS

        RAISERROR 25000 'This is a test error'

2. Create a trigger on the table from which you want this stored

   procedure to run:

   NOTE: Stored procedures cannot be executed directly from Microsoft

   Access 1.1, unless they are triggered from a SQL Server trigger or the

   SQL pass-thru .DLL file (SPT110.DLL) is used. However, when using

   version 2.0, you can invoke a stored procedure using an SQL pass-

   through query. For this example, you will use a trigger that fires when

   a record is updated.

      CREATE TRIGGER TestTrig

      ON Authors

      FOR UPDATE

      AS

        EXECUTE TestProc

3. Add the following code to an Access Basic module. The subprocedure

   updates the Authors table (the attached table dbo_authors) in some

   way, and traps the error value that is passed by the RAISERROR()

   function:

      Sub TrapIt ()

          Dim db As Database, Mydyna As Dynaset

          Dim Xerr As String, Xval As Integer,

          Dim Xstart As Integer, Xlen As Integer

          On Error GoTo ErrorHandler

          Set db = CurrentDB()

          Set Mydyna = db.CreateDynaset("select * from dbo_authors;")

          Mydyna.Edit

          Mydyna!au_fname = Mydyna!au_fname

          Mydyna.Update

          Mydyna.MoveNext

          Exit Sub

      ErrorHandler:

      'This routine parses the error string returned from ODBC and

      'extracts only the error value you assigned with the RAISERROR()

      'function in SQL Server.

      'traps the error message

          xerror = Error$

      'finds start of error value

          Xstart = InStr(1, xerror, "#") + 1

      'finds length of error value

          Xlen = InStr(Xstart, xerror, ")") - Xstart

      'extracts error value from string

          Xval = Mid(xerror, Xstart, Xlen)

          MsgBox ("You have encountered error #" & CStr(Xval))

          Resume Next

      End Sub

Additional reference words: 1.10 2.00

KBCategory:

KBSubcategory: IsmPdox


INF: Troubleshooting Setup and Installation Problems

Article ID: Q96109

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains the following troubleshooting techniques that you

can use to resolve Microsoft Access Setup and installation problems:

 - Checking the installation disks

 - Checking the TEMP directory

 - Checking what loads when you start Microsoft Windows

 - Clean booting your system

Note that you can use many of these techniques to troubleshoot problems

that occur after installation.

MORE INFORMATION

================

Checking the Installation Disks

-------------------------------

The following steps help determine whether your problem is related to

a bad installation disk. To check a specific disk:

1. Exit completely from Microsoft Windows.

2. At the MS-DOS command prompt, type the following:

      md \disktest

3. Put the suspect disk in the floppy disk drive, then type the

   following:

      copy <drive>:*.* c:\disktest

   where <drive> is the appropriate floppy disk drive letter.

4. If the disk is copied successfully, the MS-DOS command prompt will

   return and no error message will appear. This means that this disk

   is not the problem, and you should continue troubleshooting.

   If an error message is displayed, call Microsoft Sales Information

   Center at (800) 426-9400 and request a replacement disk.

5. Delete the temporary DISKTEST directory and any files in it by

   typing:

      erase c:\disktest\*.*

   Answer "Y" (without quotation marks) when you are asked if you really

   want to erase everything.

   Then type

      rd c:\disktest

   to remove the directory.

Checking the TEMP Directory

---------------------------

1. Exit completely from Windows.

2. At the MS-DOS command prompt, type the following:

      set

3. Change to the directory pointed to by the TEMP variable. For

   example, if you are at the root of your C drive when you type SET

   and "TEMP=C:\WINDOWS\TEMP" is displayed, type the following command:

      cd \windows\temp

   If an "invalid directory" message is displayed when you change to

   the TEMP directory, you must create the TEMP directory using the

   MS-DOS Make Directory (MD) command.

4. There should be no *.TMP files in your TEMP directory when Windows

   is not running. If there are *.TMP files in this directory, you

   should erase them. To see whether there are any .TMP files in your

   TEMP directory, type the following command:

      dir *.tmp

   If there are *.TMP files in the TEMP directory, erase them by typing

      erase *.tmp

   For more information on the TEMP directory, query on the following

   words here in the Microsoft Knowledge Base:

      windows and temporary and files and definition

5. Use the MS-DOS CHKDSK command to check your hard drive. At the

   command prompt, type:

      chkdsk

   NOTE: Refer to your Microsoft MS-DOS "User's Guide and Reference"

   if you have lost allocation units, lost clusters, or cross-linked

   files.

6. Check the amount of free space on your hard drive by looking at the

   line that says "bytes available on disk." If this number is less than

   4000000 bytes (4 MB), free up some additional hard drive space by

   removing unnecessary files.

Checking What Loads When You Start Windows

------------------------------------------

For troubleshooting purposes, it is important that you have a clean

Windows configuration before you boot from a clean, bootable floppy

disk (refer to "Clean Booting Your System" below). The following

steps ensure a clean Windows configuration:

1. Using a text editor, such as the MS-DOS Editor or Windows Notepad,

   open the WIN.INI file. Check the following two lines:

      load=

      run=

   If there is anything to the right of the equal sign (=) on either of

   these two lines, place a semicolon (;) at the beginning of line.

   For example:

      ;load=c:\mydir\myprogram.exe

   The semicolon causes Windows to ignore that line.

2. Save your changes and exit the text editor.

3. When you are clean booting, you do not want anything to load

   automatically from your Startup group. To temporarily disable this

   functionality, hold down the SHIFT key as soon as you see the Windows

   logo screen. Keep the SHIFT key depressed until Windows is completely

   loaded.

4. Make sure that you are using a Windows video driver. To do this,

   exit Windows. At the C:\WINDOWS> prompt, type:

      setup

   Windows displays a System Information screen that indicates the

   type of display that you are using. If the Display field does not

   show EGA or VGA, follow the instructions on your screen to change

   the display to VGA.

   NOTE: If you receive a Welcome To Windows Setup screen, you were not

   at the Windows prompt when you typed SETUP.

Clean Booting Your System

-------------------------

A clean boot eliminates many variables that may be related to your

Setup or installation problem. Follow these steps to clean boot your

system:

1. Create a bootable floppy disk by putting a blank floppy disk in your

   A drive, and then typing the following at the MS-DOS command prompt:

         format a: /s

2. Use a text editor, such as MS-DOS Editor or Windows Notepad, to

   create a CONFIG.SYS file on the bootable floppy disk that you

   created in step 1.

   A simple CONFIG.SYS contains the following:

      files=50

      buffers=20

      device=c:\windows\himem.sys

      <third-party disk partitioner>

      <third-party disk compression driver>

      <Other third-party driver if necessary to boot your computer>

      shell=c:\<valid path>\command.com /p

   NOTE: If you have the following line in your current CONFIG.SYS file,

   you should include it in your clean boot CONFIG.SYS file:

      device=c:\windows\smartdrv.sys /double_buffer

   For more on SMARTDRV.SYS, query on the following words here in the

   Microsoft Knowledge Base:

      SMARTDrive and 4.0 and design and overview

   NOTE: If there is hard disk partitioning, disk compression, or

   other third-party software required to boot your computer, these

   files must be included in your CONFIG.SYS file.

3. Using a text editor, create an AUTOEXEC.BAT file on the bootable

   floppy disk that you created in step 1. A simple AUTOEXEC.BAT

   contains the following:

      prompt $p$g

      path=c:\windows

      set temp=c:\<valid path>

4. Exit from the text editor.

5. With the clean, bootable floppy disk in drive A, reboot your

   system.

6. If you still experience Setup problems, try starting Windows in

   standard mode by typing

      win /s

   at the A prompt. Windows does not try to create any virtual memory

   in standard mode. If running in standard mode resolves your problem,

   contact Windows Product Support for further assistance.

   For more information on the clean booting your system, query on the

   following words in the Microsoft Knowledge Base:

      clean and boot and windows

Additional reference words: 1.00 1.10 2.00 tshoot

KBCategory:

KBSubcategory: StpOthr


INF: Troubleshooting Tips for Error Values

Article ID: Q112103

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You see any of the following error values in a field on a table, query,

form, or report:

   #Error, #Num!, #Name?, #Div/0!, #Deleted, or #Locked

CAUSE

=====

Microsoft Access places an error value in a field when it cannot find

necessary information, execute an expression, or store a value within the

limits for the field.

RESOLUTION

==========

The sections below explain what the error values mean, and list some

reasons why Microsoft Access might display them:

#Error

------

This value means that Microsoft Access cannot evaluate the expression. For

example, you may have supplied incorrect or too few arguments for an

aggregate function, used a parameter query as the domain for an aggregate

function, or the expression may contain a circular reference.

The following three examples demonstrate possible causes for the #Error

value:

   Aggregate function:

      =DAvg("[Sales]","Employe")

In the above example, the table name should be "Employee," not "Employe."

   Circular reference: (Query)

      FirstName: [FirstName] & " " & [LastName]

The alias FirstName is also part of the expression in the example above.

   Circular reference: (Forms and Reports)

      Name: FirstName

      ControlSource: =[FirstName] & " " & [LastName]

The text box name is also part of the expression in this example.

In a table or form, this error can also occur when the DefaultValue

property setting for a field or control is not appropriate for the DataType

or FieldSize property setting, or when an expression includes a bound

control defined using the Trim() function and the underlying field contains

no data. The following example demonstrates a field whose DefaultValue

property setting is not appropriate for its FieldSize setting:

   Field: State (Text, FieldSize = 2)

   DefaultValue: ="Cal" (3 characters)

In a query, this error can occur when the value of a calculated field is

greater than the value allowed by the field's FieldSize property setting.

For example, if you add or multiply two Integer values and the resulting

Integer is greater than the value permitted in an Integer field, Microsoft

Access displays the #Error value in the field. The following example

demonstrates a value that is larger than is permitted for the field:

   Field: Age (Integer, current record value = 50)

   Expr1: [Age] * 1000

#Num!

-----

This error value means that the value in the field is too large (either

positively or negatively) to be stored in the field, based on the field's

DataType or FieldSize property setting.

#Name?

------

This error means that the name entered as the source of the value in the

field is invalid. The name may be misspelled, you may have omitted the

equal sign (=) before the expression, or the source itself may have been

deleted.

The following example demonstrates a missing equal sign (=) in an

expression:

   ControlSource: [FirstName] & " " & [LastName]

   Should be: =[FirstName] & " " & [LastName]

The next example demonstrates an invalid ControlSource property name:

   ControlSource: =[FirstNam] & " " & [LastName]

   Should be =[FirstName] & " " & [LastName]

When you are referring to a control on a subform or subreport, you must

refer to it via the main form or report using the following syntax:

   =Forms![<MainFormName>]![<SubFormName>].Form![<ControlName>]

   -or-

   =Reports![<MainReportName>]![<SubReportName>].Report![<ControlName>]

<MainFormName> or <MainReportName> is the name of the form or report that

contains the subform or subreport.

<SubFormName> or <SubReportName> is the name of the subform or subreport.

Note that this name does not have to be the same name as the name of the

subform or subreport itself. To verify this name, check the Name property

of the subform or subreport.

<ControlName> is the name of the control on the subform or subreport. To

verify this name, check the Name property of the control.

Some other causes for the #Name? error value include:

 - A field name on the form or report does not match the name of the field

   in the underlying table.

 - A control name is the same as one of the fields on the underlying table.

 - An expression designed to calculate a sum for a control might include a

   Sum() function. (The Sum() function can be used to calculate sums only

   for fields, not for controls.)

#Div/0!

-------

This value means that you are trying to divide a number by zero, either

directly in an expression (for example, 8/0), or by using a value from a

field whose value is zero.

#Deleted

--------

This value means that the record being referred to has been deleted.

#Locked

-------

The value can be caused by any of the following situations:

 - The record has been locked by another user and Microsoft Access cannot

   read the data.

 - There are two or more instances of Microsoft Access running on the

   same computer. Microsoft Access treats each open copy of the database as

   a separate user.

 - Access Basic code has opened a recordset and has a lock on a record.

It is important to note that Microsoft Access uses "page locking" instead

of "record locking." Microsoft Access stores records in groups of 2048

bytes, called pages. A single page may hold only one record, or it may hold

many records. If each record only requires 200 bytes, then up to 10 records

might be stored on a page. When Microsoft Access places a lock on a record,

it locks that record's page. If there are 10 records on the page, then all

10 records on that page will be locked.

Additional reference words: 2.00 pounderror poundname tshoot

KBCategory:

KBSubcategory: ExrOthr


INF: Two Functions to Calculate Age in Months and Years

Article ID: Q100136

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article explains how to create a function to calculate the age of

a person or thing based on a given date.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

MORE INFORMATION

================

Enter the following code in a module:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   '==========================================================

   ' General Declaration

   '==========================================================

   Option Explicit

   '*************************************************************

   ' FUNCTION NAME: Age()

   '

   ' PURPOSE:

   '    Calculates age in years from a given date to today's date.

   '

   ' INPUT PARAMETERS:

   '    StartDate: The beginning date (for example, a birth date).

   '

   ' RETURN

   '    Age in years.

   '*************************************************************

   Function Age (varBirthDate As Variant)

      Dim varAge As Variant

      If IsNull(varBirthdate) then Age = 0: Exit Function

      varAge = DateDiff("yyyy", varBirthDate, Now)

      If Date < DateSerial(Year(Now), Month(varBirthDate),_

                           Day(varBirthDate)) Then

         varAge = varAge - 1

      End If

      Age = varAge

   End Function

   '*************************************************************

   ' FUNCTION NAME: AgeMonths()

   '

   ' PURPOSE:

   '    Compliments the Age() function by calculating the number of months

   '    that have expired since the last month supplied by the given date.

   '    If the given date is a birthday, the function returns the number of

   '    months since the last birthday.

   '

   ' INPUT PARAMETERS:

   '    StartDate: The beginning date (for example, a birthday).

   '

   ' RETURN

   '    Months since the last birthday.

   '*************************************************************

   Function AgeMonths(ByVal StartDate As String)

      Dim tAge As Double

      tAge = (DateDiff("m", StartDate, Now))

      If (DatePart("d", StartDate) > DatePart("d", Now)) Then

          tAge = tAge - 1

      End If

      If tAge < 0 Then

         tAge = tAge + 1

      End If

      AgeMonths = tAge Mod 12

   End Function

Testing the Age() and AgeMonths() Functions

-------------------------------------------

The following steps describe how to test the Age() and AgeMonths()

functions:

1. Open a module or create a new one.

2. From the View menu, choose Immediate Window.

3. Assume your friend's birth date was November 15, 1967 and today is

   June 3, 1993. Type the following in the Immediate window and press

   ENTER:

      ? Age("11/15/67")

   Microsoft Access responds with the value 25 (years).

4. Type the following and press ENTER:

      ? AgeMonths("11/15/67")

   Microsoft Access responds with the value 6, indicating that six

   months have passed since this person's last birthday. Your friend

   is 25 years and six months old.

Using the Age() and AgeMonths() Functions

-----------------------------------------

The following procedure explains how to mark old orders by placing the

age value in a new control:

1. In the sample database NWIND.MDB, enter the Age() and AgeMonth()

   functions in a new module.

2. Open the Orders form in Design view and add an unbound text box.

3. Type the following in the ControlSource property of the new

   control:

      =Age([Order Date]) & " ys " & AgeMonths([Order Date]) & " mo"

4. Switch to Form view. The age of the order is displayed in the new

   control.

Additional reference words: 1.00 1.10 2.00 birth birthday birthdate age abc

KBCategory:

KBSubcategory: PgmOthr


INF: Two Methods to Refer to a Field in a Previous Record

Article ID: Q101081

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Sometimes a field in a previous record must be referred to in a later

record, such as in a checkbook program or a mileage log. This article

explains how to refer to such a record.

NOTE: The procedures provided require a unique, sequential, numeric

field, such as a Counter field or a transaction number.

MORE INFORMATION

================

This section provides two sets of examples for database objects

(forms, reports, and queries): one using the DLookup() function, the

other using the sample database NWIND.MDB.

DLookup() Function Examples

---------------------------

Use the DLookup() function for the following database objects, as in

the following examples:

In a Form

---------

Type the following in the ControlSource of the text box:

   =DLookUp("[Field]","Table","[ID]=Forms![Form1]![ID]-1")

In a Report

-----------

Type the following in the ControlSource of the text box:

   =DLookUp("[Field]","Table","[ID]=Reports![Report1]![ID]-1")

In a Query

----------

Type the following in the Field row of the query grid:

   Expr1: DLookUp("[Field1]","Table","[ID]=|[ID]|"&-1)

The "-1" indicates the previous record. This number can be changed to

reference a different record.

Northwind Traders Examples

--------------------------

The following examples use the sample database NWIND.MDB:

In a Form

---------

1. Create a blank form based on the Suppliers table.

2. Add the Supplier ID and Company Name fields.

3. Create an unbound text box.

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

   Form:  Form1

   ------------

   RecordSource: Suppliers

   Form1 Controls

   --------------

   Text Box:

      ControlName: Supplier ID

      ControlSource: Supplier ID

   Text Box:

      ControlName: Company Name

      ControlSource: Company Name

   Text Box:

      ControlName: Field2

      ControlSource:

         =DLookUp("[Company Name]","Suppliers","[Supplier ID] = _

          Forms![Form1]![Supplier ID]-1")

In a Report

-----------

1. Create a blank report based on the Suppliers table.

2. Add the Supplier ID and Company Name fields.

3. Create an unbound text box.

   Report:  Report1

   ----------------

   RecordSource: Suppliers

   Report1 Controls

   ----------------

   Text Box:

      ControlName: Supplier ID

      ControlSource: Supplier ID

   Text Box:

      ControlName: Company Name

      ControlSource: Company Name

   Text Box:

      ControlName: Field2

      ControlSource:

         =DLookUp("[Company Name]","Suppliers","[Supplier ID] = _

          Reports![Report1]![Supplier ID]-1")

In a Query

----------

1. Create a new query.

2. Add the Suppliers table.

   Query: Query1

   -------------

   Type: Select Query

   Field: Supplier ID

   Field: Company Name

   Field: Expr1: DLookUp("[Company Name]","Suppliers","[Supplier ID] = _

                  |[Supplier ID]|"&-1)

Additional reference words: 1.00 1.10 2.00 next

KBCategory:

KBSubcategory: ExrOthr


INF: Understanding Event Order in MS Access 2.0

Article ID: Q118762

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

In order to automate tasks in Microsoft Access successfully, it is

helpful to have an understanding of the Microsoft Windows event model.

Objects in Microsoft Access respond to many types of events, such as

mouse events and keyboard events. Events are also triggered in

response to record movements. There are several ways to determine the

order of events for forms, reports, subforms, and subreports in

Microsoft Access.

MORE INFORMATION

================

There is a special version of the Orders form in the sample database

NWIND.MDB called the Show Events form that records each event as it

occurs. When you open the Show Events form, an accompanying form

called Event History opens as well. The Event History form lists the

events that occur in the Show Event form. As you use the mouse or

keyboard to select or change controls in the Show Events form, the

list in the Event History form changes to show all the events that

have occurred. Note the events that occur as you use the mouse and

keyboard to manipulate objects in the Show Events form. The Show

Events and Event History forms can help you to understand the concept

of events, and the order in which they occur.

The recording of events in the Show Events form is accomplished by a

function called ShowEvent(). The ShowEvent() function is called in the

event procedures of all the event properties of all the controls on

the Show Events form. The ShowEvent() function sets the value of the

text control to include the event that just occurred.

REFERENCES

==========

For more information about event order, search for "order of events"

then "Order of Events" using the Microsoft Access Help menu. The Order

of Events topic includes the following topics:

 - Events for Controls on Forms

 - Events for Records on Forms

 - Events for Forms

 - Events for Keyboard and Mouse

 - Events for Reports and Report Sections

 - Events and Saving Data

Microsoft Access "Building Applications," version 2.0, Chapter 8,

"Events," pages 184-201

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmrHowto


INF: Unexpected Stored Procedures Found in SysObjects Table

Article ID: Q96898

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Unexpected stored procedures with the general format ODBC#<login ID>nnnnnnn

are found when you query the SysObjects table in SQL Server. For example,

if you issue the following query from SQL Administrator Facility (SAF)

   SELECT * FROM SysObjects WHERE Name LIKE "ODBC%"

you see stored procedures such as:

   ODBC#sa24518

   ODBC#sa2334

   ODBC#sa17854

This article describes what these stored procedures are and how to delete

them.

MORE INFORMATION

================

When Microsoft Access executes a parameter query, it calls the ODBC

function SQLPrepare(), which creates and compiles stored procedures. These

stored procedures pass the proper parameter arguments to ensure proper

execution of the query.

These stored procedures are normally deleted once the ODBC connection is

closed. However, if any action, including the following, causes the ODBC

connection to be dropped abnormally, the stored procedures may not be

deleted:

  - The client (Microsoft Access) system is rebooted

  - SQL Server is shutdown using the "with no wait" command

  - The network connection breaks

You can use SAF to drop the stored procedures manually. The command syntax

is

   DROP PROCedure [owner.]procedure_name[, [owner.]procedure_name...]

where procedure_name is the procedure you are removing. For example

   DROP PROC ODBC#sa24518, ODBC#sa2334

removes two stored procedures, ODBC#sa24518 and ODBC#sa2334.

If there are a number of stored procedures to delete, you can automate the

process somewhat by using SQL Server to create a script to issue the DROP

PROC statements.

The example below assumes that you have a number of stored procedures

created by a user logged in as "Joe." To delete them:

1. Create a file called DROP_GEN.SQL:

      use <dbname>

      go

      select char(13) + char(10) + "go" +

         char(13) + char(10)+ "drop procedure " + name +

         char(13) + char(10) + "go" +

         char(13) + char(10)

      from sysobjects

      where name like "ODBC%"

      go

     NOTE: By adding the GO statement before and after the drop

     statement, you eliminate the need to edit the output file of the

     column header information.

2. Run this script using ISQL:

      ISQL -S<server> -Usa -P<password> -iDROP_GEN.SQL -oDROPPROC.SQL

3. This creates an output file containing:

      1> 2> 1> 2> 3> 4> 5> 6> 7>

      ----------------------------

      go

      drop procedure odbc#JOE61375

      go

      go

      drop procedure odbc#JOE65224

      go

      go

      drop procedure odbc#JOE67088

      go

      go

      drop procedure odbc#JOE69907

      go

4. Finally, run the output file generated in step 3 through ISQL to drop

   the procedures:

      ISQL -S<server> -Usa -P<password> -iDROPPROC.SQL

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: Updating One Table with Data from a Second Table

Article ID: Q103269

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to create a query that will update a record

in one table with data from another table.

MORE INFORMATION

================

The sample query below adds data from the Current Week table to the

records in the Yearly Rainfall table.

NOTE: This type of query will not work if the data being added is the

result of a totaling or grouping query. For more information on how to

update a record with the result of a totaling or grouping query, query

on the following words here in the Microsoft Knowledge Base:

   access and update and dlookup

1. Create a new table with the following fields and save it as Yearly

   Rainfall:

      City      Inches   Last Updated

      -------------------------------

      Baroda     0.5     4/2/93

      Basildon  22.0     4/2/93

      Beaver    18.0     4/2/93

2. Create a new table with the following fields and save it as Current

   Week:

      City      Inches   Week Of

      --------------------------

      Baroda     0.1     4/9/93

      Basildon   2.0     4/9/93

      Beaver     2.5     4/9/93

3. Create a new query based on the tables Yearly Rainfall and Current

   Week. Join the tables on the City field.

4. From the Query menu, choose Update.

5. Drag the Last Updated and Inches fields from the Yearly Rainfall

   table to the query grid.

6. Create the following entries in the Update To row of the query

   grid:

      Field: Last Updated

         Update To: [Current Week].[Week Of]

      Field: Inches

         Update To: [Yearly Rainfall].[Inches]+[Current Week].[Inches]

7. Save and then run the query.

The data in the table Yearly Rainfall will now be:

      City      Inches     Last Updated

      ---------------------------------

      Baroda     0.6       4/9/93

      Basildon  24.0       4/9/93

      Beaver    20.5       4/9/93

Additional reference words: 1.00 1.10 2.00 Total Archive History

KBCategory:

KBSubcategory: QryMktbl


INF: Updating, Troubleshooting Novell NetWare VLM Installation

Article ID: Q117918

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to update specific Novell NetWare drivers on

your system to the latest Novell virtual loadable module (VLM) drivers, so

that Microsoft Access will run correctly on your Novell network.

MORE INFORMATION

================

Steps to Update Novell Network Drivers

--------------------------------------

Microsoft Access requires specific versions (or later) of certain Novell

network files to run correctly. The following steps describe how to be sure

that the correct versions of these files are installed on your system:

1. Obtain the following files:

 - WINUP9.EXE and DOSUP9.EXE (from Novell). These files are available on

   Novell's CompuServe NOVLIB forum. To obtain them, log on to

   CompuServe and type GO NOVFILES, or contact Novell technical support

   at (800) 638-9273. These files are also available through NetWire and

   authorized Novell resellers.

 - WW0863.EXE (from Microsoft). This file is available on the Microsoft

   Software Library (MSL). You can download it from the MSL on the

   following services:

   - Microsoft Download Service (MSDL)

        Dial (206) 936-6735 to connect to MSDL

        Download WW0863.EXE from WINDOWS\31\APPNOTES

   - Internet (anonymous FTP)

        ftp ftp.microsoft.com

        Change to the SOFTLIB\MSLFILES subdirectory

        Get WW0863.EXE

   - CompuServe

        GO MSL

        Search for WW0863.EXE

        Display results and download

2. Run WW0863.EXE, which is a self-extracting file. When you run this file,

   it will expand into the following three files: VIPX.386, VTDA.386, and

   README.TXT. Follow these steps to install the new files:

   a. Rename or back up your original VIPX.386 file. To rename the file,

      type the following line at the command prompt:

         ren vipx.386 vipx.bak

   b. Copy the VTDA.386 file to your WINDOWS\SYSTEM subdirectory. To copy

      the file, type the following line at the command prompt:

         copy <drive>:\<sourcedir>\vtda.386 c:\windows\system

   c. Using any text editor (such as Windows Notepad), open the SYSTEM.INI

      file in your Windows directory. Add the following lines to the

      [386Enh] section of the file, or change them to match these lines if

      they already exist:

         InDOSPolling=FALSE

         TimerCriticalSection=10000

         ;device=*vtd

         device=vtda.386

   d. Save and then close the SYSTEM.INI file.

3. DOSUP9.EXE and WINUP9.EXE are self-extracting files. Run both of these

   files to produce the following files:

      LSL.COM       v2.05      9-10-93   17805

      IPXODI.COM    v2.12      10-7-93   30247

      VLM.EXE       v1.10      12-9-93   36525

      VIPX.386      v1.17     10-11-93   23855

      NETWARE.DRV   v3.02     11-24-93  146736

   Copy the first three files, LSL.COM, IPXODI.COM, and VLM.EXE, to

   your NWCLIENT directory. (NOTE: C:\NWCLIENT is the default

   directory. Your directory location may differ, depending on your

   installation.) Copy the other two files, VIPX.386 and NETWARE.DRV,

   to your WINDOWS\SYSTEM subdirectory.

   NOTE: There is one version of the NETWARE.DRV file for VLM, and another

   version for NETX. You must be sure to use the version for VLM. If you

   use the wrong version, network problems can occur.

   These files add to or replace your existing network files. To see which

   version of each .EXE or .COM file you are currently running, type the

   name of the file and press ENTER. If the file is already loaded, you

   will get a message that states that the file is already loaded, and

   displays the version number of the currently loaded file.

4. Modify the NET.CFG file (or the SHELL.CFG file, depending on your

   network setup) by adding the following entry:

      READ ONLY COMPATIBILITY = OFF

5. Quit and then restart Microsoft Windows.

6. Make sure that every workstation on the network has the correct versions

   of the files listed in this article and has the .INI file entries

   listed in this article.

Troubleshooting Tips

--------------------

If, after following the above steps, you still encounter network problems,

try the following tips:

 - Make sure that everyone on the network who uses Microsoft Access has the

   necessary network rights. All Microsoft Access users must have File Scan

   and Read rights for the WINDOWS and ACCESS directories on the network.

   Also, users must have File Scan, Read, Write, Create, Erase, and Modify

   rights for the ACCESS\WORKDIR subdirectory.

 - Use the network Supervisor or Admin account to run the Microsoft

   Access network Setup (SETUP /A) and the first workstation Setup.

 - If the ACCESS directory on the server is marked as Read-Only, make sure

   that the ACCESS\WORKDIR subdirectory is marked as Create/Erase/

   FileScan/Modify/Read/Write for all users.

 - Load NETX.EXE instead of VLM.EXE when you start the network. If you do

   this, make sure to change the NETWARE.DRV driver from the VLM version to

   the NETX version before you start Windows. To do this, make sure the

   following files are present in the WINDOWS\SYSTEM subdirectory:

      NETX.EXE       v3.32     11-17-93   78654

      NETWARE.DRV    v2.02     10-27-92   126144

Multiuser Database Corruption or Locking Issues

-----------------------------------------------

If you experience multiuser database corruption or locking issues, perform

the following steps:

1. On the NetWare server, create the following setting:

      SET MAXIMUM RECORD LOCKS PER CONNECTION = 10000

2. On each workstation, add the following line to the [ISAM] section of

   the MSACC20.INI file in the Windows directory:

      PageTimeout=300

3. If you are running Novell NetWare version 3.11, obtain the TTSFIX patch

   file described in the following article (and in the ACREADME.HLP file):

      ARTICLE-ID: Q102522

      TITLE     : PRB: "Record Lock Threshold Exceeded" with Large

                  Action Query

NetWare is manufactured by Novell Inc., a vendor independent of Microsoft;

we make no warranty, implied or otherwise, regarding this product's

performance or reliability.

Additional reference words: 2.00 networking

KBCategory:

KBSubcategory: EvnNtw


INF: Upper Limit for QueryTimeout and LoginTimeout Parameters

Article ID: Q100176

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes the maximum limit allowed for the QueryTimeout

and LoginTimeout parameters.

MORE INFORMATION

================

As the README.TXT file for Microsoft Access 1.1 states, the two

settings in the [odbc] section of the MSACCESS.INI file are as

follows:

Entry               Value   Effect

-------------------------------------------------------------------

QueryTimeout         S      Wait S seconds for queries sent to

                            ODBC, then stop trying to process

                            the query results (for asynchronous

                            queries only). Default: 60 seconds.

LoginTimeout         S      Wait S seconds for ODBC login response,

                            and then stop trying to connect to a

                            server. Default: 20 seconds.

The README.TXT file does not state the limits for these parameters.

Since the values for QueryTimeout and LoginTimeout are unsigned 4-byte

values (long integers), the maximum value is +/- 2,147,483,648. If the

value is set to zero, the timeout is disabled and the query or login

never times out.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: Use a Query to Parse a Full Name into Two Fields

Article ID: Q95608

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

The following query parses a field containing a full name in which the

last and first names are separated by commas. For example a name could

be entered as: Smith, John. The query would return two columns named

Last: and First:. The query uses the Left$ and Right$ functions and

searches for the comma using the InStr function.

   Query: QueryTest

   ----------------

   Field: Last: Left$([Name],InStr(1,[Name],",")-1)

      Show: True

   Field: First: Right$([Name],Len([name])-InStr(1,[Name],",")-1)

      Show: True

You can modify the query to account for spaces in the name field. For

example if the name field contained Smith,John with no spaces, you

would remove the -1 for the first name field.

Additional reference words: 1.00 1.10 2.00 expressions

KBCategory:

KBSubcategory: QryMktbl


INF: Use Append Query to Set Initial Value of Counter Field

Article ID: Q94821

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can change the starting value of a Counter field to a number other

than 1 by using an append query.

MORE INFORMATION

================

By design, Microsoft Access always numbers Counter fields beginning

with the number 1. You cannot edit a Counter field or change its

starting value.

However, you can force Microsoft Access to number a Counter field with

a number you choose by doing the following:

1. Create a new table containing a single Number field. Set FieldSize

   to Long Integer.

2. Give the new Number field a name identical to the name of the

   Counter field in your original table.

3. Use an append query to join this new record to your original table.

   This action forces Microsoft Access to number any new Counter

   fields with your number + 1.

For the expanded procedure, see the "How to Renumber the Counter

Field" section below.

Your original table has the following properties:

   Table: Receiving

   ---------------------

   FieldName: ID Number

      Data Type: Counter

   FieldName: Description

      Date Type: Text

How to Renumber the Counter Field

---------------------------------

1. Create a new table with the following structure and save it as

   Sending:

      Table: Sending

      -----------------------

      FieldName: ID Number

      Data Type: Number

      FieldSize: Long Integer

2. Open the Sending table in Datasheet view. Add a new record by

   inserting a value in the Number field. The value you enter must be

   1 less than the starting value you want for the Counter field in

   your original table. For example, if you want the Counter value in

   your original table to start at 100, enter 99 in the Number field.

3. Create a new append query to append the single record from the new

   table (Sending) to your original table (Receiving). To do this,

   choose Query, then choose New and select the Sending table. Save

   the query as AppendCounter.

4. From the Query menu, choose Append. Select Receiving from the

   Append To Table Name combo box, then choose OK.

   At this point, you have instructed Microsoft Access to append (or

   join) a field (or fields) from the Sending table to the Receiving

   table. Now you need to tell Microsoft Access which field or fields

   to append.

5. Append the ID Number field from the Sending table to the Receiving

   table either by selecting ID Number from the Field combo box in the

   query grid or by dragging the ID Number field from the Sending

   table to the query grid.

   Because Microsoft Access recognizes that the two fields in Sending

   and Receiving have identical names, it automatically places ID

   Number in the Append To field of the query grid, as follows:

      Query: AppendCounter

      --------------------

      FieldName: ID Number

      AppendTo: ID Number

6. Run the query by choosing the exclamation point (!) button on the

   toolbar. The following message is displayed:

      1 Row(s) will be appended.

   Choose OK to append the record to the Receiving table.

7. Delete the Sending table, then delete the newly appended row from

   the Receiving table.

   You are now ready to add a new record to your original table. The

   Counter will start at the number you have chosen.

   NOTE: Do not compact the database before adding a new record to the

   original table. If you do, Microsoft Access will reset the Counter

   value to the number 1.

REFERENCES

==========

For more information on append action queries and Counter fields,

search on the following words here in the Microsoft Knowledge Base:

   counter and append

For more information on customizing Counter fields, search on the

following words here in the Microsoft Knowledge Base:

   counter and custom

Microsoft Access "User's Guide," version 1.0, page 174

Additional reference words: 1.00 1.10 2.00 appending starting initial

KBCategory:

KBSubcategory: QryMktbl


INF: Use AutoLookup Technique to Look Up Info. Automatically

Article ID: Q95048

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can create a query or form that automatically looks up information

in the one-side table of a one-to-many relationship based on an entry

in a many-side field. This process is sometimes called AutoLookup.

You can use AutoLookup to have a query automatically look up

information in other tables and display it on a form or report.

You can look up information by using any one of the following three

techniques:

1. Use AutoLookup. For more information on AutoLookup, see the "More

   Information" section below.

2. Use multiple DLookup() functions in forms and reports. For more

   information on the DLookup() function, query on the following

   words here in the Microsoft Knowledge Base:

      DLookup and forms and reports

3. Use the Column property of a multiple-column combo box to update a

   text box control with new information as focus moves from row to

   row in the combo box. For more information on this, query on the

   following words here in the Microsoft Knowledge Base:

      Column and property and combo and Update

MORE INFORMATION

================

Use AutoLookup when you want Microsoft Access to automatically look up

information in the one-side table based on an entry in a many-side field.

The AutoLookup technique works in a query or in a form. AutoLookup also

works with tables that have a one-to-one relationship if you use a left

outer join. For more information on what data is updatable, search for

"Underlying table or query," then "When is a query updatable?" using the

Microsoft Access Help menu.

For example, the Categories and Products tables in the sample database

NWIND.MDB have a one-to-many relationship. Each category may appear

several times in the Products table. The Products table contains the

Category ID field, which is the foreign key that identifies the

category for a product.

When AutoLookup updates records, Microsoft Access automatically

recalculates any totals or expressions that are dependent on the

updated information.

Microsoft Access version 1.1 has additional online Help topics for

AutoLookup issues. In this context, the term "AutoLookup" is synonymous

with the term "dynamic lookup." For more information, search for "dynamic

lookup", then "Displaying Fields from Another Table or Query (Common

Question)" using the Help menu. In Microsoft Access version 2.0, search for

"AutoLookup."

The following two examples demonstrate how AutoLookup works:

Example 1: Create a Query That Uses AutoLookup

----------------------------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new query. Add the Products and Categories tables.

   Products is the many-side table and Categories is the one-side

   table. The two tables have a many-to-one relationship based on the

   Category ID field (meaning there are many identical Category ID

   values in Products for each unique Category ID value in

   Categories).

3. Add the following fields from the Products table:

      Product ID

      Product Name

      Category ID

4. Add the following fields from the Categories table:

      Category Name

      Description

5. Save the query as AutoLookup Example.

6. View the results of the query. To verify that the query performs

   AutoLookup, move to the end of the query and create a new record.

   Enter a valid Category ID value in the Category ID field. Microsoft

   Access will automatically look up the values associated with that

   Category ID value in the Categories table.

This process works because the Category ID field located in the query

comes from the many-side table (Products). Microsoft Access performs

AutoLookup on one-side tables when you enter identifying data in the

many-side table. When you enter a valid value in the Products table's

Category ID field, Microsoft Access knows that Category ID is the key

field for the one-side table (Categories), so it looks up the

information from Categories based on the Category ID value and

automatically displays it in the query.

Example 2: Create a Form That Uses AutoLookup

---------------------------------------------

1. Create a new form based on the query that you created in Example 1.

2. Locate the fields from the Products table on "one" side of the form

   and those from the Categories table on the "many" side of the form.

3. Create a combo box bound to the Category ID field. Set the

   RowSource property to the Categories table. Display a single

   column, [Category ID], in the combo box.

4. Switch to Form view. When you enter new records and select a

   category from the Category ID combo box, all related information

   about that Category is displayed.

Note that if you had included the primary key value from the one-side

table (Categories), you would not have been allowed to add new records

to the query or to change the Category ID value. For this reason, you

must drag the Category ID field from the Products table, rather than

from the Categories table.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 10, "Creating

Forms Based on More than One Table," page 282

Microsoft Access "User's Guide", version 2.0, Chapter 11, "Designing Select

Queries"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryJoin


INF: Use SendKeys Macro Action to Open Combo Box Automatically

Article ID: Q98225

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

When you are entering a large amount of data and want to open a combo

box, it is inconvenient to have to press additional keys or stop to

use the mouse. This article presents a generic macro that opens a

combo box when you set the focus on the control by pressing the

TAB key.

MORE INFORMATION

================

A macro with a single action, SendKeys, is shown below. You can use

this macro for all combo boxes on your form.

1. Create a macro called Open Combo Box, as follows:

      Macro: Open Combo Box

      ----------------------

      Action: SendKeys

         Keystrokes: %{DOWN}

         Wait: Yes

2. Open your form in Design view.

3. Add the above macro to the OnEnter property of your combo box.

To manually open the combo box, type ALT+DOWN ARROW.

REFERENCES

==========

For more information on automatically sending keystrokes, search for

"SendKeys" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 SendKeys combo box

KBCategory:

KBSubcategory: FmsCmbo


INF: Users Can Edit but Not Commit Read-Only OLE Objects

Article ID: Q93026

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Users are allowed to edit OLE objects in a database that has been

opened as read-only, or in a form that is read-only. However, when a

user attempts to move to the next record or chooses Save Record from

the File menu, Microsoft Access displays a message indicating that the

record cannot be updated.

To prevent users from attempting to edit OLE objects in read-only

forms, set the Enabled property of the object frame to No.

MORE INFORMATION

================

In a read-only database, a user is allowed to edit and update OLE

objects but is not allowed to commit a record with these changes. At

the point the record is committed, the following message appears:

   Can't save changes to this object because you don't have

   permission to write to the record. Copy the object to the

   Clipboard if you want to save it, then choose Undo Field.

The user must undo the changes before the record can be committed. To

save the changes, the user must copy the object to the Clipboard

before choosing Undo Field.

Additional reference words: 1.00 1.10 2.00 object linking embedding alert

KBCategory:

KBSubcategory: IntpOle


INF: Using "<", ">", and "=" Operators in Query Parameters

Article ID: Q96463

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes a simple, non-programmatic way to allow a user

to type the comparison operators "<", ">", and "=" in query parameters.

Due to the nature of the method, query criteria should be kept as

simple as possible. For more complex criteria, you will have to use

Access Basic code.

MORE INFORMATION

================

1. Create a table called Names with the following fields:

      Table: Names

      -----------------

      Field: First Name

      DataType: Text

      Field: Last Name

      DataType: Text

      Field: Age

      DataType: Number

      Format: Single

2. Enter the following data:

      First Name   Last Name   Age

      ----------------------------

      Tom          Smith        35

      Anne         Howard        7

      Jim          Bowie        20

      Sue          Thomas       44

3. Create the following query based on the Names table:

      Query: List Names

      -----------------

      Field: First Name

      Field: Last Name

      Field: Age

         First Criteria Line: =Mid([Enter Age],2)

         Second Criteria Line: <Mid([Enter Age],2)

         Third Criteria Line: >Mid([Enter Age],2)

         Fourth Criteria Line: <leave blank>

         Show: True

     Field: Expr1:Left([Enter Age],1)

        First Criteria Line: "="

        Second Criteria Line: "<"

        Third Criteria Line: ">"

        Fourth Criteria Line: Is Null

        Show: False

The criteria are entered on successive lines (that is, "Criteria 1" is

entered on the "Criteria" line, "Criteria 2" is entered on the "Or"

line, and "Criteria 3" and "Criteria 4" are entered on the blank lines

below that).

Save the query and run it. Sample output is given for each of the four

types of input:

   [Enter Age]     Output

   ------------------------------------------

   <leave blank>   Tom          Smith      35

                   Anne         Howard      7

                   Jim          Bowie      20

                   Sue          Thomas     44

   <21             Anne         Howard      7

                   Jim          Bowie      20

   >21             Tom          Smith      35

                   Sue          Thomas     44

   =7              Anne         Howard      7

NOTE: The query is not designed to allow combinations of "<", ">", and

"=", such as ">=20". You must always use one of the three operators,

no more, no less, or you must leave the whole parameter blank.

The SQL for the query is given below:

   SELECT DISTINCTROW

      [First Name], [Last Name], Age

   FROM

      Names

   WHERE

      (Age=Mid([Enter Age],2) AND Left([Enter Age],1)="=")

   OR

      (Age<Mid([Enter Age],2) AND Left([Enter Age],1)="<")

   OR

      (Age>Mid([Enter Age],2) AND Left([Enter Age],1)=">")

   OR

      (Left([Enter Age],1) Is Null)

   WITH OWNERACCESS OPTION;

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryParm


INF: Using "Name" in Expressions

Article ID: Q112130

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

All Microsoft Access version 2.0 objects have a Name property, but

Microsoft Access version 1.x objects do not. A Microsoft Access 1.x

database will not run correctly in Microsoft Access 2.0 if you refer to

Name as an ambiguously qualified object in the 1.x database. To correct

this, Microsoft Access treats Name as a special case when you are using a

1.x database.

MORE INFORMATION

================

With the advent of Microsoft Access 2.0 and data access objects (DAO), all

objects have a Name property. Name is also a very common field name. This

creates a conflict when you are running a 1.x database in Microsoft Access

2.0. When you refer to an ambiguously qualified object, both Microsoft

Access 1.x and 2.0 have a predetermined search path to locate the object.

The search order is as follows:

   Properties, controls, fields

If a field has the same name as a property, the value of the property will

be returned instead of the value of the field. In order to deal with the

new Name property, the search order when referring to Name changes to:

   Controls, fields, properties

Note that this only applies to Name and not to any other property.

Listed below is acceptable ambiguous syntax in Microsoft Access 1.x and

unambiguous syntax in Microsoft Access versions 1.x and 2.0. Microsoft

Access 2.0 will handle the ambiguous syntax correctly when you are using an

Access 1.x database.

Acceptable (Ambiguous) 1.x Syntax

---------------------------------

 - In a text box on a report:

      ControlSource: =[Name]

 - In a macro:

      SetValue

         Item: [Name]

         Expression: UCase([Name])

 - In a DLookup() expression:

      DLookup("[ID]","MyTable","[Name]=Form.Name")

 - In Access Basic using ListTables(), ListFields(), and so on:

      Set MySnap = MyDB.ListTables()

      Debug.Print MySnap.Name

Unambiguous 1.x and 2.0 Syntax

------------------------------

 - In a text box on a report:

      ControlSource: =Report![Name]

 - In a macro:

      SetValue

         Item: Form![Name]

         Expression: UCase(Form![Name])

 - In a DLookup() expression:

      DLookup("[ID]","MyTable","[Name]=Form!Name")

 - In Access Basic using ListTables(), ListFields(), and so on:

      Set MySnap = MyDB.ListTables()

      Debug.Print MySnap!Name

Note the explicit use of the form or report object and the use of the

exclamation point (!) instead of the period (.) to refer to fields. This

tells Microsoft Access to search controls and fields and to ignore

properties. If you use the period (.), properties are assumed and searched

before controls and fields.

Using Naming Conventions

------------------------

Ambiguously referenced objects can also be correctly referenced by using a

naming convention that includes a standard prefix or suffix that can be

attached to object names. For example, ctlName could indicate a control,

and fldName could indicate a field.

Converting to Microsoft Access 2.0

----------------------------------

When you are converting a Microsoft Access 1.x database to 2.0 format, you

must use the unambiguous method to reference fields and controls that have

the same names as properties.

REFERENCES

==========

For more information about identifiers in expressions, search for

"identifiers in expressions" using the Microsoft Access 2.0 Help menu.

Additional reference words: 2.00 DAO

KBCategory:

KBSubcategory: ExrOthr


INF: Using a Conditional Macro to Confirm Changes to a Field

Article ID: Q99400

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to prompt the user to confirm changes to a

field using a conditional macro.

MORE INFORMATION

================

This following procedure uses the Employees form in the sample

database NWIND.MDB:

1. Create the following new macro by choosing the Macro button in the

   Database window and then choosing New:

   Macro Name  Condition                      Action       Defined Below

   ---------------------------------------------------------------------

   AreYouSure  MsgBox("Commit changes?",1)=2  CancelEvent        1.

                     ...                      SendKeys           2.

     AreYouSure Actions

     ------------------

     1. CancelEvent

     2. SendKeys

           Keystrokes: {esc}

           Wait: NO

   NOTE: The ellipsis in the Condition column forces Microsoft Access

   to perform the action on that line if the condition on the

   preceding line is true. Microsoft Access evaluates macro conditions

   as true or false. If the expression is true, Microsoft Access

   performs the action; if it is false, Microsoft Access ignores the

   action.

2. Save the macro as AreYouSure.

3. Open the Employees Form in Design view by choosing the Form button

   in the Database window, selecting the Employees form, and choosing

   the Design button.

4. From the View menu, choose Property to display the property sheet.

5. Select the [Hire Date] text box control to display its properties.

6. Set the properties for the Employees form and [Hire Date] text box

   control as follows:

      Form:  Employees

         Caption:  Employees Form

         ControlSource:  Employees

      Text box: Hire Date

         ControlName:  Hire Date

         ControlSource:  Hire Date

         Before Update:  AreYouSure

7. From the View menu, choose Form. When the date in the [Hire Date]

   field is edited, a confirmation message appears. Choose

   OK to confirm your change, or Cancel to cancel your change.

NOTE: This example uses the MsgBox statement instead of the MsgBox

action. The MsgBox action has only an OK Button, whereas the MsgBox

statement can also include a Cancel button.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 316-320

Microsoft Access "User's Guide," version 1.0, pages 528-554

Additional reference words: 1.00 1.10 2.00 forms macros data validation

KBCategory:

KBSubcategory: McrCond


INF: Using a Form Reference Parameter Query in Access Basic

Article ID: Q105522

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Before you can run a parameter query in Access Basic, you must set the

values of all the parameters. If the parameters are not set, you will

receive the error message:

   # parameters were expected, but only 0 were supplied.

Below is a description of the syntax for setting the value of a

parameter that is a form reference. An example is also included.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

To set the value of a parameter that is a form reference, use the

following syntax:

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Dim MyDB As Database

   Dim MyQDef As QueryDef

   Set MyDB = CurrentDB()

   Set MyQDef = MyDB.OpenQueryDef("Parameter Query")

   MyQDef![Forms!Form Name!ControlName] = Forms![Form _

      Name]![ControlName]

In the example above, the definition variable, the exclamation point,

and the parameter, which is enclosed in brackets, are to the left of

the equal sign. Note that if the form name or control name in a form

reference contains spaces, it is usually enclosed in brackets. Do

not include the brackets if you are setting the value of the form

reference parameter. However, do include the brackets if you are

referencing the form listed to the right of the equal sign.

The next example demonstrates how to create a query that will prompt

you to enter the date when you run the query:

   Dim MyDB As Database

   Dim MyQDef As QueryDef

   Set MyDB = CurrentDB()

   Set MyQDef = MyDB.OpenQueryDef("Parameter Query")

   MyQDef![Please enter date:] = "#12/12/93#"

NOTE: If you have more than one parameter in the query, add a line

similar to the preceding line for each parameter.

The following example uses the Orders table from the sample database

NWIND.MDB:

1. Create the following query in the NWIND.MDB database:

      Query: Customer Orders Parameter Query

      -----------------------------------------------------

      Type: Select Query

      Field: Customer ID

         Table: Orders

         Criteria: [Forms]![Search Form]![Customer To Find]

      Field: Order ID

         Table: Orders

      Field: Order Date

         Table: Orders

2. Create the following form bound to the Orders table:

      Form: Search Form

      -----------------------------------

      Text box:

         ControlName: Customer To Find

         ControlSource: Customer ID

      Command button:

         ControlName: Button0

         Caption: ParamQD

         OnPush (or On Click): =ParamQD()

3. Create a new module and add the following code:

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      '****************************************************************

      ' Declarations Section

      '****************************************************************

      Option Compare Database

      Option Explicit

      '****************************************************************

      ' Function ParamQD()

      '

      ' Purpose: To demonstrate how to set the value of a parameter that

      '            is a form reference.

      '****************************************************************

      Function ParamQD()

         Dim MyDB As Database

         Dim MyQDef As QueryDef

         Dim MyDyna As Dynaset

         Set MyDB = CurrentDB()

         Set MyQDef = MyDB.OpenQueryDef("Customer Orders Parameter _

            Query")

         'Set the Value of the Parameter.

         MyQDef![Forms!Search Form!Customer To Find] = Forms![Search _

            Form]![Customer To Find]

         'Create the dynaset.

         Set MyDyna = MyQDef.CreateDynaset()

         MyDyna.MoveLast

         MsgBox MyDyna.RecordCount

         MyDyna.Close

         MyQDef.Close

      End Function

When you enter a Customer ID on the Orders form and choose the ParamQD

button, the ParamQD() function will run and a message box will display

how many orders that customer has.

REFERENCES

==========

Microsoft Access "Introduction to Programming," versions 1.0 and 1.1, pages

137-138

Microsoft Access "User's Guide," version 2.0, pages 274-277

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmObj


INF: Using Access Basic to Derive a Statistical Median

Article ID: Q95918

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes an Access Basic function that opens a table,

reads the data, and finds the statistical median. The median is a

measure of central tendency, another "middle" of a data set. The data

set consisting of the numbers 1, 2, 3, 6, and 100 has a median of 3,

the middle of the set. The data set consisting of the numbers 1, 2, 6,

and 10 has a median of 4, the middle of the set [(2+6)/2=4].

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

To create an Access Basic function that determines the statistical

median, open a new or previously created module and enter the

following code:

Note: In the following sample code, an underscore (_) is used as

a line-continuation character. Remove the underscore when

re-creating this code in Access Basic.

   '*************************************************************

   'Declarations section of the module.

   '*************************************************************

   Option Explicit

   '=============================================================

   ' Create the following Median() function in the module

   ' The following function will initialize:

   ' - A variable for the database object.

   ' - A variable for the snapshot.

   ' - Sets the database object to the opened database.

   ' - Creates a snapshot based on the database object.

   ' - A variable for the record count, the for statement,

   '      two field values and an offset. This function requires the

   '      table name and field to be analyzed to be include as argument

   '      strings.

   '=============================================================

   Function Median (tName$, fldName$) As Single

      Dim MedianDB As Database

      Dim ssMedian As Snapshot

      Dim RCount%, i%, x%, y%, OffSet%

      Set MedianDB = CurrentDB()

      Set ssMedian = MedianDB.CreateSnapshot("SELECT [" & fldName$ & _

                     "] FROM [" & tName$ & "] ORDER BY [" & fldName$ _

                     & "];")

      ssMedian.MoveLast

      RCount% = ssMedian.RecordCount

      x% = RCount% Mod 2

      If x% <> 0 Then

         OffSet% = ((RCount% + 1) / 2) - 2

         For i% = 0 To OffSet%

            ssMedian.MovePrevious

         Next i

         Median = ssMedian(fldName$)

      Else

         OffSet% = (RCount% / 2) - 2

         For i% = 0 To OffSet%

            ssMedian.MovePrevious

         Next i

         x% = ssMedian(fldName$)

         ssMedian.MovePrevious

         y% = ssMedian(fldName$)

         Median = (x% + y%) / 2

      End If

      ssMedian.Close

      MedianDB.Close

   End Function

How to Use the Median() Function

--------------------------------

Create a form with text box controls that will reflect all measures of

central tendency of a data set. In the ControlSource property for the

text box control, enter

   =Median("<TableName>", "<FieldName>")

The value of this control will be the median of the data set. Another

way to use this function is to call it from within another function

that compares the median from different data sets. For example,

   Function CompareMedians()

      Dim MyDB as Database

      .

      .

      .

      X = Median("<TableName>", "<FieldName>")

      Y = Median("<TableName>", "<FieldName>")

      If X > Y Then Debug.Print "The median for X is greatest."

   End Function

Additional reference words: 1.00 1.10 2.00 statistics

KBCategory:

KBSubcategory: PgmOthr


INF: Using Column Property of Combo Box to Update Text Box

Article ID: Q93138

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can display multiple fields in a combo or list box on a form or report

even when those fields come from a table that is not bound to the form or

report. You can also update controls such as text boxes with new

information based on what a user selects from a combo or list box.

MORE INFORMATION

================

To accomplish these objectives, use one of these techniques:

 - Use Row Fix-up in forms. For more information on Row Fix-up, query on

   the following words here in the Microsoft Knowledge Base:

      Row and Fix-up

 - Use multiple DLookup() functions in forms and reports. For more

   information on the DLookup() function, query on the following words

   here in the Microsoft Knowledge Base:

      DLookup and forms and reports

 - Use the Column property of a multiple-column combo box to update

   a text box control with new information as focus moves from row to

   row in the combo box. The next section describes this technique in

   detail.

Using the Column Property of a Combo Box

----------------------------------------

By assigning the Column property of a multiple-column combo or list box to

a text box, you can display one column from the current combo box selection

in the text box. Microsoft Access automatically updates the text box when a

selection is made from the combo box. The following example demonstrates

how to do this:

1. Create your form or report based on the appropriate table or query.

2. Create a combo or list box that retrieves information from more than

   one field. For example, you might use the following multiple-column

   Select statement as the RowSource for a combo or list box to display

   information from several columns in the Categories table:

      Select [Category Id], [Category Name], [Description] from

         Categories Order by [Category Name];

   For this example, set the ColumnCount property to 3, and set the

   ColumnWidth property to an appropriate size for the combo or list

   box. Once you have the combo or list box sized correctly and

   defined to return multiple fields, you can use the Column property

   to display the current selection in a text box control. Choose one

   entry in the list box first or it will return a null.

   The Column property uses a reference argument to refer to a specific

   column in the multiple-column combo or list box. Use Column(0) to

   refer to the first column, Column(1) to refer to the second column,

   and so on.

   This example uses Column(1) to refer to [Category Name]--the second

   column in the combo box.

3. To display the [Category Name] of the current combo box selection,

   create a text box control. Make the text box a calculated control by

   defining the following expression as the data source for the text box:

      =[<ComboControlName>].Column(1)

   <ComboControlName> is the name of the combo box. The Column property

   will make the text box (calculated control) read-only.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 9, "Designing Forms,"

pages 233-245

Microsoft Access "User's Guide," version 2.0, Chapter 16, "Customizing

Forms," "Creating a List Box or Combo Box with a Wizard"

For more information on the Column property, search for "combo box:

properties" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsCmbo


INF: Using Data from MS Access in a WordPerfect Mail Merge

Article ID: Q104916

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - WordPerfect for DOS, versions 5.1 and 6.0

 - WordPerfect for Windows, versions 5.1 and 5.2

---------------------------------------------------------------------

SUMMARY

=======

The following information describes how to use data contained in a

Microsoft Access database to perform a mail merge in WordPerfect for

DOS and WordPerfect for Windows.

MORE INFORMATION

================

WordPerfect for Windows and WordPerfect for DOS cannot read data from

Microsoft Access in its native format. To use data from a Microsoft

Access database in a WordPerfect mail merge, the data must first be

exported from Microsoft Access in a format that WordPerfect recognizes

as a valid mail merge data file (also called a "secondary file").

The following information discusses how to export data from Microsoft

Access for use in a WordPerfect mail merge. Further, information is

provided to demonstrate how to perform a simple mail merge with the

exported data in WordPerfect for DOS and WordPerfect for Windows.

Exporting Data from Microsoft Access for Use in WordPerfect

-----------------------------------------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. From the File menu, choose Export.

3. From the Data Destination list, select Text (Delimited), dBASE III or

   dBASE IV and then choose OK.

4. Select Customers and then choose OK.

   TIP: If you are not using Microsoft Access version 2.0, you can export

   data from a query to a delimited text file directly. For more

   information about this method, query on the following words here in the

   Microsoft Knowledge Base:

      export and query and text and file

5. In the File Name box, type the name that you want for the exported file.

   In the Directories box, select the directory that you want the file

   to be placed in. You may want to place the file in your WordPerfect

   directory.

6. If you selected the Text (Delimited) data destination, the Export Text

   Options will appear. Choose Options to see an expanded list of

   export options.

7. In the Text Delimiter box, select {none}.

8. In the Field Separator box, select {tab}.

   TIP: If you plan to regularly export data to WordPerfect, consider

   saving these Export Text Options with a specification name to prevent

   having to manually specify these options each time. A specification can

   be used with the TransferText macro action to automate the export

   process further. See the Microsoft Access "User's Guide" for more

   information on using export specifications and the TransferText macro

   action.

9. Choose the OK button. Microsoft Access begins the export process,

   placing the data in the file specified in step 5.

Performing a WordPerfect Mail Merge with Microsoft Access Data

--------------------------------------------------------------

A WordPerfect merge is the process of combining information from two

documents: a "primary file" (or form file) and a "secondary file" (or

data file) to create a single document.

The primary file, which is typically a form letter, is used to direct

the merging process. The secondary file contains records of

information, typically names and addresses, used to fill in places in

the primary file. The primary file contains placeholders (fields) that

indicate where specific information, such as a first name or an

address, from the secondary file should be merged in.

The placeholders appear in the primary file starting with {FIELD}

followed by a number indicating which field in the secondary file to

use. The placeholder ends with a tilde character (~). For example,

{FIELD}2~ would be the placeholder for the second field in the

secondary data file. In the CUSTOMER.TXT file exported earlier, this

is the Company Name field.

NOTE: In WordPerfect version 6.0 for DOS the field looks like FIELD(2).

The fields appear in the secondary file in the same order as they

appear in Microsoft Access. The fields in the Customers table in the

NWIND database are ordered as follows:

   1. Customer ID

   2. Company Name

   3. Contact Name

   4. Contact Title

   5. Address

   6. City

   7. Region

   8. Postal Code

   9. Country

  10. Phone

  11. Fax

Creating the WordPerfect Primary Form File

------------------------------------------

WordPerfect 5.1 for DOS:

1. Press F7, No, and then No again to create a new WordPerfect

   document.

2. Press SHIFT+F9, then press 1 (or F) for Field.

3. At the Enter Field: prompt, type the number indicating the field

   you want to reference from the secondary data file, then press ENTER.

4. Repeat steps 2 and 3 to create the following primary file:

      {FIELD}2~

      {FIELD}3~

      {FIELD}5~

      {FIELD}6~, {FIELD}7~ {FIELD}8~

      Dear {FIELD}3~,

      Thank you for your inquiry regarding Northwind Trader products...

      Sincerely,

      Andrew Fuller

      Vice President, Sales

5. Press F10. At the Document To Be Saved: prompt, type "PRIMARY.DOC"

   (without the quotation marks) and press ENTER.

WordPerfect 6.0 for DOS:

1. From the File menu, choose New to create a new WordPerfect

   document.

2. From the Tools menu, choose Merge, then choose Define.

3. Press 1 (or F) to choose Form and press OK.

4. The Merge Codes (Form File) dialog box is now displayed. Choose OK.

5. At the Field: prompt, type the number indicating the field you want

   to reference from the secondary data file, then press ENTER.

6. Repeat steps 2 and 3 to create the following primary form file:

      FIELD(2)

      FIELD(3)

      FIELD(5)

      FIELD(6), FIELD(7) FIELD(8)

      Dear FIELD(3),

      Thank you for your inquiry regarding Northwind Trader products...

      Sincerely,

      Andrew Fuller

      Vice President, Sales

7. From the File menu, choose Save As, type "PRIMARY.DOC" (without the

   quotation marks) in the Filename: box and then press ENTER.

WordPerfect 5.x for Windows:

1. From the File menu, choose New to create a new WordPerfect

   document.

2. From the Tools menu, choose Merge (CTRL+F12), then choose Field.

3. In the Insert Merge Code dialog box, type the number indicating the

   field you want to reference in the secondary file, then choose the OK

   button.

4. Repeat steps 2 and 3 to create the following primary file:

      {FIELD}2~

      {FIELD}3~

      {FIELD}5~

      {FIELD}6~, {FIELD}7~ {FIELD}8~

      Dear {FIELD}3~,

      Thank you for your inquiry regarding Northwind Trader products...

      Sincerely,

      Andrew Fuller

      Vice President, Sales

5. From the File menu, choose Save As, type "PRIMARY.DOC" (without the

   quotation marks) in the Save As box, and choose the Save button.

Merging the Primary and Secondary Files in WordPerfect

------------------------------------------------------

WordPerfect 5.1 for DOS:

 1. Press F7, No, then No again.

 2. Press CTRL+F9, then press 1 (or M) for Merge.

 3. Type "PRIMARY.DOC" (without the quotation marks) at the Primary

    file: prompt and press ENTER.

 4. When the prompt for the secondary file appears, press CTRL+F5 to

    activate the DOS Text Delimited File: prompt.

 5. Type "CUSTOMER.TXT" (without the quotation marks) and press ENTER.

    The Merge: DOS Text File menu screen is activated.

 6. Choose 1 (or F) for Field delimiters.

 7. At the Begin prompt, delete any contents that appear then press the

    DOWN ARROW key.

 8. At the End prompt, press the TAB key so that [Tab] appears, then

    press the DOWN ARROW key.

 9. Choose 2 (or R) for Record delimiters.

10. At the Begin prompt, delete any contents that appear, then press

    the DOWN ARROW key.

11. At the End prompt, press CTRL+M so that [CR] appears, then press

    the DOWN ARROW key.

12. Press ENTER to begin the merge.

WordPerfect 6.0 for DOS:

1. From the File menu, choose New.

2. From the Tools menu, choose Merge, then choose Run. The Run Merge

   dialog box appears.

3. Type "PRIMARY.DOC" (without the quotation marks) in the Form File:

   box.

4. Type "CUSTOMER.TXT" (without the quotation marks) in the Data File:

   box.

   NOTE: You may want to include the full drive and path with the file

   names in the Primary and Secondary File boxes if these files are not

   located in the WordPerfect directory.

5. Select DOS Delimited Text from the File Format list and choose the

   Select button. The Delimited Text Options dialog box appears.

6. Choose 1 (or F) for Field Delimiter:, press F5, select Tab, then

   press the DOWN ARROW key. ([Tab] should now appear in the box.)

7. In the Record Delimiter: field, make sure the selected value is

   [CR][LF]. Press F5 and select these items from the list if needed.

   Press the DOWN ARROW key.

8. In the Field Encapsulate Character: box, delete any entry and

   press the DOWN ARROW key until the OK button is selected.

   NOTE: You may want to select the Save Setup Options check box if you

   intend to merge on a regular basis to avoid having to reset these

   settings in the future.

9. Press the OK button, then press the Merge button to begin the

   merge.

WordPerfect 5.x for Windows:

1. From the File menu, choose New.

2. From the Tools menu, choose Merge, then choose Merge again. The

   Merge dialog box appears.

3. Type "PRIMARY.DOC" (without the quotation marks) in the Primary

   File: box.

4. Type "CUSTOMER.TXT" (without the quotation marks) in the Secondary

   File: box.

   NOTE: You may want to include the full drive and path with the file

   names in the Primary and Secondary File boxes if these files are not

   located in the WordPerfect directory.

5. Check the ASCII Delimited Text (DOS) check box, or press ALT+A.

6. Choose the OK button. The Text File Delimiters dialog box appears.

7. Under Field Delimiters, leave the Begin: box empty. In the End:

   box, delete the current contents and choose [TAB] from the list that

   appears pressing the "<" button located immediately to the right of

   the End: box.

8. Under Record Delimiters, leave the Begin: box empty. In the End:

   box, delete the current contents and choose [CR] from the list that

   appears pressing the "<" button located immediately to the right of

   the End: box.

9. Choose the OK button to begin the merge.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, chapter 9

Microsoft Access "User's Guide," version 1.x, chapter 4

"WordPerfect for DOS Reference," version 5.1, pages 420-431

"WordPerfect for DOS Workbook," version 5.1, pages 237-246

"WordPerfect for DOS Reference," version 6.0, pages 412-432

"WordPerfect for DOS Workbook," version 6.0, pages 195-204

"WordPerfect for Windows Reference," version 5.1, pages 300-308

"WordPerfect for Windows Workbook," version 5.1, pages 203-210

Additional reference words: 1.00 1.10 2.00 WP51 WPWIN print merge

KBCategory:

KBSubcategory:  IntpOthr


INF: Using Date/Time Data Type and Calculating Elapsed Time

Article ID: Q88657

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how Microsoft Access stores data with a Date/Time

data type, and demonstrates how to calculate elapsed time.

MORE INFORMATION

================

Microsoft Access uses double-precision, floating-point numbers (up to 15

decimal places) to store date/time values. Using this numbering system,

you can add, subtract, and compare date/time values as you would other

numeric values. The integer portion of the double-precision number

represents the date; the decimal portion represents the time.

The acceptable range for date information is January 1, 100 A.D.

(-657,434) through December 31, 9999 A.D. (2,958,465), where January

1, 1900 is 2. Negative numbers represent dates prior to December 30,

1899.

The acceptable range for time information is between 0:00:00 and

23:59:59, or 12:00:00 A.M. and 11:59:59 P.M., inclusive. Time values

representing 24 hours are stored internally as double-precision

fractional numbers between 0.0 and 0.99999. Below are some examples of

these fractional numbers:

   2.0 represents 1/1/1900 12:00:00 A.M.

   0.25 represents 6:00:00 A.M. (0.25 * 24 hours = 6 hours)

   33914.125 represents 11/6/1992 3:00:00 A.M. (0.125 * 24 hours = 3

   hours)

   24794.84375 represents 11/18/67 8:15:00 P.M. (0.84375 * 24 hours =

   20.25 or 20 hours and 15 minutes (.25 * 60 minutes = 15 minutes)

Using Null Values

-----------------

Microsoft Access recognizes when a portion of the data in a date/time

field is missing. For example, if you enter only a time value,

Microsoft Access does not display the false (0) date value of

12/30/1899. Calculations that include a null date/time field return a

null value.

Formatting and Storing Date/Time Values

---------------------------------------

Date/time fields can show the date, the time, or both, depending on

how you format and display the date/time field. Microsoft Access

always stores both the date and the time.

For more information on formatting, search for "Format" then "Format

Property" using the Microsoft Access Help menu.

Comparing Dates Using Functions

-------------------------------

Microsoft Access also uses double-precision, floating-point numbers to

calculate functions that contain date or time arguments. This method

can occasionally yield unexpected results.

For example, if you test the following expression in the Immediate

window of a module, the result is 0 (false), even if today's date

is 1/31/92:

   ?Now()=DateValue("1/31/92")

This function returns -1 (true) only when the current date and time

are 1/31/92 12:00:00 A.M. This occurs because the Now() function

returns the double-precision number of the current date and time. This

number may not be equal to the integer number of the date only, which

is returned by the DateValue() function.

To avoid this problem, use either of the following statements to compare

today's date with another date:

   ?Date()=DateValue("1/31/92")

   ?Int(Now())=DateValue("1/31/92")

The Int() function strips the fractional portion of the double-precision

number from the Now() function, returning only the number representing

the date.

Computing and Displaying Elapsed Time

-------------------------------------

Below are two sample functions, HoursTest() and ElapsedTest(). They

return the amount of elapsed time between two given date/time values,

using different display formats. Both functions require you to specify

time1 and time2 as parameters.

The first example, HoursTest(), displays the elapsed time in hours,

minutes, and seconds:

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when recreating

this code in Access Basic.

   Function HoursTest()

   ' This function displays the total hours elapsed in this format:

   ' 48:57:04

      Time1 = CVDate("1/3/92 4:05:06")

      Time2 = CVDate("2/2/92 5:02:10")

      HoursTest = Format(Int(Abs(Time1 - Time2) * 24), "###:") + _

         Format(Abs(Time1 - Time2), "nn:ss")

   End Function

The HoursTest() function uses the CVDate() function to convert the

string expression to a date value. The HoursTest() function then takes

the absolute value of the difference between the two date/time values

and multiplies this new value by 24:

   Abs(Time1 - Time2) * 24

HoursTest() uses the Int() function to return only the integer portion

of the date/time value. The resulting integer is the total number of

hours elapsed:

   Int(Abs(Time1 - Time2) * 24)

The first Format() function returns the elapsed hours. The second

Format() function takes the absolute value of the difference between

the two time values and uses the "nn:ss" argument to capture only the

minutes and seconds. HoursTest() concatenates the results of two

Format() functions, as follows:

   Format(Int(Abs(Time1 - Time2) * 24), "###:") + _

          Format(Abs(Time1 - Time2), "nn:ss")

The second example, ElapsedTest(), adds the number of elapsed days to

the resulting value:

   Function ElapsedTest()

   ' This function displays the elapsed time as the total number of

   ' days, hours, minutes, and seconds. For example: 4 Days 01:04:05 Hours.

      Time1 = CVDate("1/31/92 4:01:05")

      Time2 = CVDate("2/4/92 5:05:10")

      ElapsedTime = Abs(Time1 - Time2)

      ElapsedDays = Int(ElapsedTime)

      ElapsedPartialDay = (ElapsedTime - ElapsedDays)

      ElapsedTest = ElapsedDays & " Days " & Format(ElapsedPartialDay,_

         "HH:NN:SS") & " Hours"

   End Function

The ElapsedTest() function uses a process similar to that used by

HoursTest(), but displays its result in a different format.

Microsoft Excel Dates vs. Microsoft Access Dates

------------------------------------------------

Microsoft Excel also uses double-precision numbers to store date/time

values, but Microsoft Excel values are limited to the range 1/1/1900

through 12/31/2078. The Microsoft Excel date and time system begins

with the double-precision number 1.0, which represents 1/1/1900

00:00:00 (12:00:00 A.M.).

Originally, Microsoft Access supported the same date range as

Microsoft Excel (1900-2078). But when Microsoft extended the date

range in Microsoft Access to 100-9999, the 1900 leap year anomaly was

corrected. This means that for dates between 1/1/1900 and 2/29/1900,

the internal integer portion of the date values for Microsoft Access

and Microsoft Excel differ by one.

Additional reference words: 1.00 1.10 2.00 date/time fractional

KBCategory:

KBSubcategory: TblDatyp


INF: Using Find Method to Find a Quotation Mark or Apostrophe

Article ID: Q104823

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates how to use the Find method to search for text

strings containing quotation marks (") or apostrophes ('). Searching for

text strings containing these characters requires special syntax because

the quotation mark and the apostrophe are used as delimiters in Access

Basic.

MORE INFORMATION

================

Notes

-----

 - This article assumes that you are familiar with Access Basic and with

   creating Microsoft Access applications using the programming tools

   provided with Microsoft Access. For more information on Access Basic,

   please refer to the "Introduction to Programming" manual in Microsoft

   Access version 1.x, or the "Building Applications" manual in version

   2.0.

 - In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

How to Find an Apostrophe

-------------------------

The following examples use the Customers table in the sample database

NWIND.MDB. Several of the company names in the Customers table contain

apostrophes. If you are recreating these examples in Microsoft Access

version 2.0, replace the company name "Babu Ji's Exports" in the examples

with the company name "B's Beverages."

To find a specific company, you would normally use the following syntax:

   Function FindaPost1 ()

      Dim MyDB As Database, MyDynaset As Dynaset

      Set MyDB = CurrentDB()

      Set MyDynaset = MyDB.CreateDynaset("Customers")

      'Find this company.

      MyDynaset.FindFirst "[company name]='Around the Horn'"

      If Not MyDynaset.nomatch Then

         MsgBox MyDynaset.[company name]

      Else

         MsgBox "No Match"

      End If

      MyDynaset.Close

   End Function

However, the following syntax will generate a syntax error because of the

apostrophe in the company name:

   Function FindaPost2 ()

      Dim MyDB As Database, MyDynaset As Dynaset

      Set MyDB = CurrentDB()

      Set MyDynaset = MyDB.CreateDynaset("Customers")

      'The following line will generate an error.

      MyDynaset.FindFirst "[company name]='Babu Ji's Exports'"

      If Not MyDynaset.nomatch Then

         MsgBox MyDynaset.[company name]

      Else

         MsgBox "No Match"

      End If

      MyDynaset.Close

   End Function

To search for a company name that includes an apostrophe, replace the

single quotation marks around the company name with two sets of double

quotation marks, as in the following example:

   Function FindaPost3 ()

      Dim MyDB As Database, MyDynaset As Dynaset

      Set MyDB = CurrentDB()

      Set MyDynaset = MyDB.CreateDynaset("Customers")

      'Find this company (with an apostrophe in the name).

      MyDynaset.FindFirst "[company name]=""Babu Ji's Exports"""

      If Not MyDynaset.nomatch Then

         MsgBox MyDynaset.[company name]

      Else

         MsgBox "No Match"

      End If

      MyDynaset.Close

   End Function

How to Find a Quotation Mark

----------------------------

The following example uses the Employees table in the sample database

NWIND.MDB. The Notes field for some employees contains quotation marks.

If you use the following syntax to find a string containing quotation

marks, a compile error will be generated:

   Function FindQuote1 ()

      Dim MyDB As Database, MyDynaset As Dynaset

      Set MyDB = CurrentDB()

      Set MyDynaset = MyDB.CreateDynaset("Employees")

      'the following line generates a compile error.

      MyDynaset.FindFirst "[notes] like '*"The art of the cold_

              call."*'"

      If Not MyDynaset.nomatch Then

          MsgBox MyDynaset.[Last Name]

      Else

          MsgBox "No Match"

      End If

      MyDynaset.Close

   End Function

To search for an item containing quotation marks, concatenate Chr(34) with

the quotation marks, as in the following example:

   Function FindQuote2 ()

      Dim MyDB As Database, MyDynaset As Dynaset

      Set MyDB = CurrentDB()

      Set MyDynaset = MyDB.CreateDynaset("Employees")

      'find this note that contains a quote.

      MyDynaset.FindFirst "[notes] like '*" & Chr(34) & "The art of_

              the cold call." & Chr(34) & "*'"

      If Not MyDynaset.nomatch Then

          MsgBox MyDynaset.[Last Name]

      Else

          MsgBox "No Match"

      End If

      MyDynaset.Close

   End Function

REFERENCES

==========

For more information about the Find method, search for "find method" using

the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmObj


INF: Using Microsoft Access 2.0 Databases with Visual Basic

Article ID: Q112104

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Visual Basic version 3.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes how to use Microsoft Access version 2.0 databases

in Visual Basic version 3.0.

MORE INFORMATION

================

Microsoft Visual Basic version 3.0 includes dynamic-link libraries (DLLs)

that you can use to communicate with the Microsoft Access Jet database

engine version 1.1 (Jet 1.1) that is used by Microsoft Access version 1.1.

Jet 1.1 is also included with Visual Basic version 3.0 and can be freely

distributed with applications created with it; there is no need to purchase

Microsoft Access to obtain Jet 1.1.

You can use the DLLs in Visual Basic 3.0 to create Jet 1.1 applications.

However, these DLLs will not communicate with the Microsoft Access Jet

database engine version 2.0 (Jet 2.0) that is used in Microsoft Access

version 2.0. Visual Basic version 3.0 includes Jet 1.1 only; it does not

include Jet 2.0. Jet 2.0 consists of the MSAJT200.DLL file, plus the

various ISAM DLLs (PDX200.DLL, XBS200.DLL, and so on).

So that you can use Microsoft Access version 2.0 databases in Visual Basic

version 3.0, a "compatibility layer," or series of files, was created to

replace these DLLs. For example, the compatibility layer directly replaces

the VBDB300.DLL file with a new version with the same name. When you use

the compatibility layer in conjunction with Jet 2.0, you can use Microsoft

Access version 2.0-created databases.

Note that it is not necessary to use the compatibility layer and Jet 2.0

combination to create database applications with Visual Basic 3.0; you can

continue to use the DLLs included with Visual Basic 3.0 as before with no

problem, as well as Jet 1.1 databases. Also, you can continue to use your

current Jet 1.1 applications, even if you convert to Microsoft Access

version 2.0, since it can still read Jet 1.1 databases. Just do not convert

your Jet 1.1 databases to Jet 2.0 if you do not want to use the

compatibility layer.

The compatibility layer is required only if you want to create applications

that use Jet 2.0 and the new features it contains, such as:

 - Data-definition queries

 - Engine-level validation

 - Programmatic access to security

 - DAO (data access objects)

 - Cascading deletes

 - Temporary queries

The compatibility layer and Jet 2.0 will be available in the Microsoft

Access Developer's Toolkit (ADT) version 2.0. The compatibility layer only

(without the Jet files) will be available in the Microsoft Office

Developer's Kit (ODK).

Additional reference words: 2.00 mapping vb interoperability

KBCategory:

KBSubcategory: IntpOthr


INF: Using Microsoft Access Macro to Quit Windows

Article ID: Q89596

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

It is possible to quit Microsoft Windows from within a Microsoft

Access application by using the Windows application programming interface

(API) function ExitWindows(). To do this, you must create a module

that declares the ExitWindows() function and then can call the

Microsoft Access function in a macro using the RunCode action.

MORE INFORMATION

================

The call to the Windows dynamic-link library (DLL) behaves in the same

way as does the Exit command from the File menu in Program Manager.

Each application must agree to be closed; for example, if you choose

Cancel when you are prompted to save a file, your exit request is also

canceled.

To create a Microsoft Access function to quit Windows, use the

following steps:

1. From the File menu, choose New and then Module.

2. In the Declarations section, type the following statements:

   NOTE: In the following sample code, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this code in Access Basic.

      Option Explicit

      Declare Function ExitWindows% Lib "user" (ByVal dwReserved&,_

                                                ByVal wReturnCode%)

3. Create a Microsoft Access function that calls the ExitWindows()

   function, as follows:

      Function ExitNow ()

         Dim RetVal as Integer

         RetVal = ExitWindows(0, 0)

      End Function

4. Save the module.

5. From the File menu, choose New and then Macro. Add the following

   action and its properties:

      Action       Function Name

      --------------------------

      RunCode      ExitNow()

6. Save the macro.

You can now add the macro to a form and use it as you would any other

Microsoft Access macro.

Microsoft does not recommend exiting from Microsoft Access using

Windows API calls, though exiting can be safely accomplished. In some

cases, temporary files can be left in the Windows Temp directory;

however, you can safely delete the Temp files. To automatically remove

temp files each time the computer is started, add the folloing line to

the AUTOEXEC.BAT file:

   del c:\windows\temp\~*.tmp

NOTE: This line should be placed before the line that begins

"Windows...." This line assumes that c:\windows\temp is the location

of the Windows Temp directory specified by the SET TEMP statement in

the AUTOEXEC.BAT file.

REFERENCES

==========

"Programming Windows: The Microsoft Guide to Writing Applications for

Windows 3," by Charles Petzold, Microsoft Press, 1990

"Programmer's Reference Library: Microsoft Windows 3.1 Guide to

Programming Reference," Volumes 1-6, Microsoft Press, 1992

Additional reference words: 1.00 1.10 2.00 SDK

KBCategory:

KBSubcategory: PgmApi


INF: Using Microsoft Word to Edit and Spell Check Memo Field

Article ID: Q96544

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You can use a word processor to edit memo fields stored in Microsoft

Access tables. Then you can check the spelling and grammar in your data.

This article describes how to use Microsoft Word for Windows to edit memo

fields.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access.

MORE INFORMATION

================

Note the following information before trying the example:

 - Microsoft Word for Windows must have the DOS TEXT Import/Export filter

   installed.

 - Only the most basic formatting will be preserved because memo fields

   do not support tabs, margins, fonts, or other fancy formatting.

 - Memo fields are limited to 32,000 characters (about 8-12 pages in

   Microsoft Word for Windows). Excess characters will be truncated.

 - The subdirectory containing WINWORD.EXE should be included in the path

   statement in your AUTOEXEC.BAT file or you can include the path in the

   following line of code in the example that follows:

      X% = Shell("c:\word6\WINWORD.EXE TEMP.TXT", 3)

 - This example is presented in the simplest terms. If you open

   the Microsoft Word document and return to Microsoft Access before

   you save the file, you will receive an "Access denied" error message

   when the Access Basic code tries to open the document that is already

   currently open in Microsoft Word.

The following example uses the Employees table in the NWIND.MDB database.

1. Create the following function in a new module.

   '******************************************************

   'Declarations section of the module

   '******************************************************

   Option Explicit

   '=====================================================

   'The following function EditMemo() calls Microsoft

   'Word for Windows

   '=====================================================

   Function EditMemo (MyEditBox As Control)

   Dim X%, LineInFile$, NewLine$, FileNum%, CarriageReturn_LineFeed$

   CarriageReturn_LineFeed$ = Chr$(13) & Chr$(10)

   FileNum% = FreeFile

   Open "TEMP.TXT" For Output As #FileNum%

   'save the text to temporary file for Microsoft Word for Windows

   If Not IsNull(MyEditBox) Then

      Print #FileNum%, MyEditBox

   Else

      MsgBox "There is no text to edit. Abort."

      Exit Function

   End If

   Close #FileNum%

   X% = Shell("WINWORD.EXE TEMP.TXT", 3)

   MsgBox "Press Any Key to Return" ' required to pause the function

   'Assume completion of the edits in Microsoft Word, now read the text

   'and place it back into the edit control.

   FileNum% = FreeFile

   Open "TEMP.TXT" For Input As #FileNum%

   NewLine$ = ""

   Do While Not EOF(FileNum)

      Line Input #FileNum%, LineInFile$

      If NewLine$ <> "" Then

         NewLine$ = NewLine$ & CarriageReturn_LineFeed$

      End If

      NewLine$ = NewLine$ & LineInFile$

   Loop

   MyEditBox = NewLine$

   Close #FileNum%

   End Function

2. Create a new blank form and base it on the Employees table.

3. Place two text box controls (Last Name and Notes) on the form and

   assign the following properties:

      Object: Text box

      ------------------------

      ControlName: Last Name

      ControlSource: Last Name

      Object: Text box

      ------------------------------

      ControlName: Notes

      ControlSource: Notes

      OnDblClick: =EditMemo([Notes])

4. Save the form and switch to Form view.

5. Double-click the memo field to launch Microsoft Word for Windows.

   You will be presented with the Convert File dialog box. Select

   Text Only and then choose the OK button.

6. Perform the operations you want.

7. Exit from Microsoft Word for Windows and save the document.

8. Microsoft Access loads the changes back into the memo field.

For a more elegant solution, one that replaces the MsgBox routine,

query on the following words here in the Microsoft Knowledge Base:

   b_waccess and waitshell

Additional reference words: 1.00 1.10 2.00 spell check errmsg

KBCategory:

KBSubcategory: PgmOthr


INF: Using SetSysModalWindow API Call in Access Basic

Article ID: Q88171

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

In Microsoft Access Basic, you can make an application modal so that

users cannot switch to other Windows-based programs while the

Microsoft Access application is active. This functionality is achieved

with the following Windows application program interface (API)

functions:

   SetSysModalWindow

    -and-

   FindWindow

This article discusses the use of the SetSysModalWindow API function

and provides an example of its use in Microsoft Access Basic.

MORE INFORMATION

================

Microsoft Windows is designed so that the user can switch between

applications without terminating one program to run another. There may

be times, however, when a Microsoft Access application needs to

restrict the user from switching to another application. Examples of

this are a security system or time-critical application that needs to

run uninterrupted.

SetSysModalWindow Usage Notes

-----------------------------

Consider all of the following usage notes before making a window

system-modal.

1. If an application passes the handle of the window as an argument

   to the SetSysModalWindow, the user is limited to that window. This

   prevents the user from moving to other applications or bringing up

   the Task List (either with the mouse or by pressing CTRL+ESC) .

2. If an application uses the SetSysModalWindow function in

   conjunction with the GetSystemMenu function, the Control (system)

   menu is disabled and the user is prevented from quitting Windows

   by pressing ALT+F4.

3. A window that is system-modal cannot be minimized, maximized, moved,

   or sized. Microsoft Access help is created with a separate Windows

   Help file; therefore, help windows created with the Windows Help

   Compiler are not available to the user.

4. When an application uses the SetSysModalWindow API function, the

   system-modal window must be closed before other applications or

   windows can be accessed. Therefore, when using this function, be

   sure that the application has a means to exit Microsoft Access.

5. Any child window that is created by a system-modal window becomes

   a system-modal window. For example, if Microsoft Access is system-

   modal and a form is opened, that form becomes system-modal until

   it is closed.

How to Use the SetSysModalWindow Function

-----------------------------------------

To use the SetSysModalWindow API function within Microsoft Access

Basic, create the sample code below.

NOTE: In this sample code, an underscore (_) is used as a line

continuation character. Remove the underscore when re-creating this

code in Access Basic.

1. Within the Declarations Section, enter the following:

      Option Explicit

      Declare Function SetSysModalWindow% Lib "User" (_

                        ByVal hwnd%)

      Declare Function FindWindow% Lib "User" (_

                      ByVal lpszClassName As Any,_

                      ByVal lpszWindow As Any)

2. Create a procedure by entering the following:

      Function System_Modal_Test ()

        Const lpClassName = "OMain"

        ' Declares the class name constant used in

        ' the FindWindow API function.

        Dim AccessHandle

        Dim Success As Integer

        ' FindWindow returns the Handle for Microsoft Access.

        AccessHandle = FindWindow(lpClassName, 0&) 'Note this is a zero

        ' The Handle for Microsoft Access is sent then Microsoft Access

        ' becomes modal.

        Success = SetSysModalWindow(AccessHandle)

      End Function

3. From the File menu, choose Save and save the module as "Modal

   Access" (without the quotation marks). Choose the OK button.

4. From the Run menu, choose Compile All.

5. From the View menu, choose Immediate Window. In the Immediate

   window, type the following, then press ENTER:

      ?System_Modal_Test()

After running the program, test the modal functionality by trying to

select other windows or resize or move the system-modal window.

REFERENCES

==========

For more information on the Modal property in Microsoft Access, search for

"Modal" then "Modal Property" using the Microsoft Access Help menu.

For more information on using the FindWindow API function, query on the

following words here in the Microsoft Knowledge Base:

   Access and FindWindow

For more information on API functions, refer to:

 - "Microsoft Windows Software Development Kit," Microsoft Press, 1992

 - "Programming Windows: The Microsoft Guide to Writing Applications

   for Windows 3," Charles Petzold, Microsoft Press, 1990

 - "Programmer's Reference Library: Microsoft Windows 3.1 Guide to

   Programming Reference," Volumes 1-6, Microsoft Press, 1992

For more information on Windows API calls, query on the following words

here in the Microsoft Knowledge Base:

   handle and API and DLL and kernel and user and GDI

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: PgmApi


INF: Using SHARE.EXE and VSHARE.386 with Microsoft Access 2.0

Article ID: Q112125

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 2.0 includes a version of VSHARE.386 that is

compatible with Microsoft Windows 3.1, Windows for Workgroups 3.1, and

Windows for Workgroups 3.11.

If you are using applications that support object linking and embedding

(OLE) 2.0, you must run either SHARE.EXE or VSHARE.386. VSHARE.386

eliminates the need for SHARE.EXE when you run Windows 3.1 or Windows for

Workgroups in 386 enhanced mode. If you run Windows 3.1 in standard mode,

you still need to run SHARE.EXE.

MORE INFORMATION

================

Microsoft Access Setup will automatically install VSHARE.386 by copying

VSHARE.386 into the WINDOWS\SYSTEM directory and adding this line to the

[386Enh] section of the SYSTEM.INI file:

   device=vshare.386

Setup will not automatically remove SHARE.EXE from the AUTOEXEC.BAT file,

since it may still be required by MS-DOS applications running outside of

Windows.

If SHARE.EXE is not required for any applications running in MS-DOS out-

side of Windows, it can be removed from the AUTOEXEC.BAT file to free up

approximate 5K of conventional memory. Leaving SHARE.EXE in the

AUTOEXEC.BAT file will not cause any harm.

If Windows is run in standard mode then SHARE.EXE must be in the

AUTOEXEC.BAT file. Add the following line to the AUTOEXEC.BAT file to

install SHARE.EXE:

   <path>\SHARE.EXE /L:500 /F:5100

In the example above, substitute the drive and directory where the

SHARE.EXE file is located for <path>. For example, if the SHARE.EXE file is

located in the DOS directory on drive C, add the following line to your

AUTOEXEC.BAT file:

   C:\DOS\SHARE.EXE /L:500 /F:5100

After adding SHARE.EXE to the AUTOEXEC.BAT file, restart the computer.

Additional reference words: 2.00 WinIss

KBCategory:

KBSubcategory: EvnOs


INF: Using SQL Server ODBC Driver with Sybase Servers

Article ID: Q101071

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The SQL Server ODBC driver was designed to work with both Microsoft

SQL Server and Sybase SQL Server computers. The ODBC organization at

Microsoft has completed some limited interoperability testing with

Sybase version 4.2 on the SPARC platform, using the Microsoft TCP/IP

network protocol and the Sybase Net-Library for this stack, and has

not uncovered any significant problems. Below are two issues to consider

if you use the SQL Server ODBC driver with Sybase servers.

MORE INFORMATION

================

Issue 1

-------

The ODBC driver requires the catalog procedures that ship with

Sybase SQL Server 4.2a. Until the Sybase 4.9.1 release, these catalog

procedures did not ship with Sybase servers. For the ODBC driver to

work with Sybase servers, the INSTCAT.SQL script must be run against

the Sybase server to install the catalog procedures.

Sybase changed the system catalogs in its version 4.8 release,

requiring a modified script. This script is called INSTCAT.48 and is

available through Microsoft Product Support Services and on

CompuServe. This script is required with Microsoft Access version 1.0

and Microsoft Visual Basic version 2.0 applications.

With Microsoft Access 1.1 and Visual Basic 3.0, the INSTCAT.SQL file

applies to all versions of Microsoft SQL Server, as well as to all

versions of Sybase SQL Server.

Issue 2

-------

The SQL Server ODBC driver that ships with Microsoft Access 1.0 and

Visual Basic 2.0 comes with the Sybase Net-Library. To connect to

Sybase, you needed to use Microsoft SQL Bridge or install Net-Library

on each client computer.

Both Microsoft Access and Visual Basic 2.0 use the network in a way

that is not typical of Windows-based applications (for instance, these

applications use multiple, simultaneous connections and asynchronous

calls). It is probable that there are network configurations in which

Net-Library will fail with these products.

Microsoft and Sybase are now discussing how best to perform

interoperability testing with the various network configurations

supported by Sybase (FTP Software, Wollongong, Novell, TCP/IP, DECnet,

and so forth).

The following products are manufactured by vendors independent of

Microsoft: DECnet is manufactured by Digital Equipment Corporation;

FTP Software is manufactured by FTP Software, Inc.; Novell networking

products are manufactured by Novell, Inc.; SPARC is manufactured by

Sun Microsystems, Incorporated; Net-Library and Sybase SQL Server are

manufactured by Sybase, Inc. We make no warranty, implied or

otherwise, regarding these products' performance or reliability.

The CompuServe file name containing the INSTCAT.SQL and the INSTCAT.48

is either SQL100.EXE or SQL110.EXE and is located in the ODBC

Connectivity library in the MSACCESS forum.

REFERENCES

==========

For further information about running Microsoft Access with Sybase SQL

Server, search for the following word here in the Microsoft Knowledge Base:

   q96468

Additional reference words: 1.00 1.10 2.00 SQL Server Oracle Net-Library

KBCategory:

KBSubcategory: ObcOthr


INF: Using the AllowZeroLength and Required Properties

Article ID: Q113493

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

The AllowZeroLength property determines whether a zero-length string ("")

is a valid entry. The Required property determines whether a null value is

a valid value. Although these two properties work together, the

AllowZeroLength property works independently of the Required property.

MORE INFORMATION

================

The AllowZeroLength property determines whether a zero-length string ("")

is a valid entry, and is available only for text and memo fields.

Microsoft Access version 1.x does not allow zero-length strings in a text

or memo field. In Microsoft Access 1.x, if a user deletes data in an

existing field, or does not enter data in a field, the value saved for the

field is a null. Microsoft Access version 2.0 supports both null and zero-

length strings in text and memo fields. To be compatible with Microsoft

Access 1.x applications, the default for the AllowZeroLength property is

No.

The Required property determines whether a null value is a valid value.

Although the AllowZeroLength and Required properties work together, the

AllowZeroLength property works independently of the Required property. If

AllowZeroLength is set to Yes, a zero-length string is a valid value for

the field regardless of the Required property setting. To enter a zero-

length string in a field, type two double quotation marks ("").

You can use the AllowZeroLength and Required property settings to

differentiate between information that does not exist and information that

may exist. For example, you might have employees in your database who do

not have a home phone. If AllowZeroLength is set to Yes, Required is set to

No, and DefaultValue is left blank for the Home Phone field, you can enter

two double quotation marks to indicate that an employee does not have a

home phone. If you leave the field blank (do not type text or delete the

existing text), it indicates that the employee may have a home phone, but

you do not know what it is.

The following table shows the results you can expect when you combine the

AllowZeroLength and Required property settings:

AllowZeroLength    Required      User's action        Value displayed

---------------------------------------------------------------------

      No              No         Presses ENTER            <Null>

                                 Presses SPACEBAR         <Null>

                                 Types ""              (not allowed)

      Yes             No         Presses ENTER            <Null>

                                 Presses SPACEBAR         <Null>

                                 Types ""                   ""

      No              Yes        Presses ENTER         (not allowed)

                                 Presses SPACEBAR      (not allowed)

                                 Types ""              (not allowed)

      Yes             Yes        Presses ENTER         (not allowed)

                                 Presses SPACEBAR           ""

                                 Types ""                   ""

REFERENCES

==========

For more information about the AllowZeroLength property, search for

"AllowZeroLength" then "AllowZeroLength Property" using the Microsoft

Access Help menu.

For more information about the Required property, search for "Required"

then "Required Property" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 2.0, Chapter 8, "Changing and

Customizing Tables"

Additional reference words: 2.00

KBCategory:

KBSubcategory: TblFldp


INF: Using the DDE Item SQLText to Request the Text of a Query

Article ID: Q102519

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Microsoft Access version 1.1 introduces the new DDE item, SQLText,

which can be used to retrieve the SQL statement representing the table

or query topic on which the DDE link has been established.

The SQLText item allows the DDE client to request that the SQLText be

either returned as a whole or divided into substrings. The length of

the substring is specified by the client. The SQLText is returned as

an array of substrings.

This article describes the use of this DDE item to request the text of

a query and place it in a Microsoft Excel worksheet.

MORE INFORMATION

================

The syntax for the SQLText item name is as follows:

   SQLText;<number>

<number> is the maximum number of characters for each substring. If a

value for <number> is not provided, the entire text is sent as one string.

The last substring of the array may be shorter than the previous

substrings if there are not enough characters.

Creating the Sample Macro

-------------------------

NOTE: The following example assumes that you have a working knowledge

of Microsoft Excel macros. For information on using macros, please

refer to the Microsoft Excel documentation.

The following sample macro should be pasted or entered in a Microsoft

Excel macro sheet, starting with cell A1. (Some formulas are dependent

on starting at that location in the macro sheet.) Also, formulas

designated in opening and closing braces ({}) must be entered as array

formulas, using the CTRL+SHIFT+ENTER key combination. For example, use the

three steps below to yield the following array formula:

   {=FORMULA.ARRAY(TRANSPOSE(SQL))}

1. Go to the cell that contains the formula.

2. Remove the braces ({}).

3. Press CTRL+SHIFT+ENTER.

To verify that the formula is entered as an array, the braces will

reappear around the formula in the Microsoft Excel formula bar. For

more information on using array formulas, please refer to the

Microsoft Excel documentation.

   SQLText

   StringLength=50

   chan=INITIATE("MSACCESS","NWIND.MDB;Query Sales for 1991")

   {=FORMULA.ARRAY(REQUEST(chan,"SqlText;255"),$B$1:$U$1)}

   =IF(LEN($B$1)<255)

   =  SET.NAME("SQLLen",LEN($B$1))

   =ELSE()

   {=  SET.NAME("SQLLen",SUM(IF(ISNA($B$1:$U$1),0,LEN($B$1:$U$1))))}

   =END.IF()

   =SET.NAME("SQLPieces",INT(SQLLen/StringLength)+1)

   =SET.NAME("SQL",REQUEST(chan,"SqlText;"&StringLength))

   =TERMINATE(chan)

   =NEW(1)

   =SELECT("r1c1:r"&SQLPieces&"c1")

   {=FORMULA.ARRAY(TRANSPOSE(SQL))}

   =COPY()

   =PASTE.SPECIAL(3)

   =CANCEL.COPY()

   =FORMULA.REPLACE(CHAR(13)&CHAR(10)," ",2,2,FALSE)

   =COLUMN.WIDTH(,,,3)

   =RETURN()

How the Sample Macro Works

--------------------------

The length of the result string is set to 50, a channel is initiated to the

Microsoft Access query, the SQL statement is requested in 255-character

chunks, and the total length of the query is calculated.

Using SQLLen, the number of rows needed to display the query is

calculated. The SQLText is requested in chunks of 50, based on the

variable StringLength, and then the DDE channel is terminated.

Finally, a new worksheet is opened and the appropriate number of cells

are selected. The Formula.Array() function places the SQLText in the

currently selected cells. The result originally appears as a formula,

but the Copy and Paste.Special() commands change it to text. The

carriage returns and line feeds are changed to spaces and the

ColumnWidth property is set to Best Fit.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpDde


INF: Using the Generic Print Driver with Forms/Reports

Article ID: Q92815

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

One way to get Microsoft Access output from forms or reports into a

text file is to use the Windows Generic print driver and print to a

file. However, using the Generic print driver (TTY.DRV) can be a

little tricky. Listed below are some hints on how to set up your forms

and reports for the Generic print driver.

MORE INFORMATION

================

The Windows Generic print driver simulates a line-oriented printer

with a fixed pitch font, like a TTY device or a line printer. Because

of this, it can only print text, and it can only position the text on

a grid that is 10 characters per inch in the horizontal direction and

6 lines per inch in the vertical direction. (By contrast, most Windows

print drivers can position text on any pixel position.)

This means that any form or report using the Generic print driver to

create a text file should be layed out so that everything lines up

with this character grid.

Here are some considerations for the form/report layout:

- Ensure that each section of your report has a height that is

  an integral multiple of 1/6".

- Lay out the text items in your report such that each falls on 1/6"

  boundaries.

- Since the default hardware font for most printers is a Courier

  10cpi font, you should set the font for all of your text items to be

  Courier 10.

- Do not use Bold fonts, as they will appear three times in your output.

  (The Generic driver simulates bold text by overstriking.)

Here are some problems that frequently occur when using the Generic

print driver to do text output:

- Blank lines appear in the output--text items or sections are slightly

  farther apart than 1/6".

- Overlapped lines appear in the output--text items or sections are

  slightly closer together than 1/6"

- Text appears three times in the output--text is formatted as

  Bold.

Additional reference words: 1.00 1.10 2.00 outputto

KBCategory:

KBSubcategory: EvnOdr


INF: Using the INSTCAT.SQL Script with an ODBC Application

Article ID: Q104601

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The INSTCAT.SQL script should be run on SQL Server for products that

use the SQL Server driver. Because different versions of the

INSTCAT.SQL script ship with different versions of the products and of

the SQL Server driver, this article discusses compatibility issues.

MORE INFORMATION

================

The INSTCAT.SQL script, when run on SQL Server, installs several

stored procedures that are later used by the ODBC SQL Server driver to

query the system catalog. Products such as Microsoft Visual Basic and

Microsoft Access, which use the SQL Server driver for ODBC access to

SQL Server, cannot be fully functional unless this script is run on

the server.

The INSTCAT.SQL script may have been run on SQL Server during the

installation of SQL Server itself. As a rule of thumb, we recommend

that the INSTCAT.SQL script that ships with Microsoft Access or Visual

Basic be used instead. (Note that this is an uncompressed file on the

driver disk.) To verify which version of the INSTCAT.SQL script is

running on the server, the following command can be issued from any

client utility (ISQL, SAF, and so forth):

   sp_server_info 500

This command returns a version string, such as 01.02.3015, in the

attribute_value column.

The table below lists the sizes, dates, and versions of the two

INSTCAT.SQL scripts that are shipping with Microsoft Access version

1.1, version 2.0 and Visual Basic version 3.0:

NOTE: These INSTCAT.SQL scripts must also be run on Sybase SQL Server

machines across all platforms and versions when using Microsoft Access

1.1 and greater or Visual Basic 3.0.

   Product                 Size         Version

   -------                 ----         -------

   Visual Basic 3.0        93834        01.01.2806

   Microsoft Access 1.1    93834        01.01.2807

   Microsoft Access 2.0   100363        01.02.3015

However, the above versions of the INSTCAT.SQL script are incompatible

with Microsoft Access version 1.0. As documented in the README.TXT

included with the Visual Basic 3.0 and Microsoft Access 1.1 products,

if you are also using Microsoft Access 1.0 as a client for SQL Server,

you should use the INSTCAT.SQL script that was included with Microsoft

Access 1.0.

NOTE: Visual Basic 3.0 and Microsoft Access 1.1 will work correctly

with the INSTCAT.SQL script from Microsoft Access 1.0, except that

Visual Basic 3.0 will be unable to delete indexes from tables.

Sybase SQL Server is manufactured by Sybase, Inc., a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

Additional reference words: 1.10 2.00 ADK

KBCategory:

KBSubcategory: ObcOthr


INF: Using the Scroll Bar Control to Move Through Records

Article ID: Q114552

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SUMMARY

=======

Included in the Microsoft Access Developer's Toolkit (ADT) are three custom

OLE controls, similar to those available in Microsoft Visual Basic. Among

them is the scroll bar control, which you can use to move through records

in a form. You must have the ADT installed to use this control.

MORE INFORMATION

================

This article assumes that you have the ADT installed, and that you are

familiar with Access Basic and with creating Microsoft Access applications

using the programming tools provided with Microsoft Access. For more

information on Access Basic, please refer to the "Introduction to

Programming" manual in Microsoft Access version 1.x, or the "Building

Applications" manual in version 2.0.

The following example demonstrates how to use the scroll bar control:

1. Open the sample database NWIND.MDB.

2. Open the Customers form in Design view. From the Edit menu, choose

   Insert Object. In the dialog box, select the Insert Control option

   button. A list of controls will be displayed. If the scroll bar control

   is not listed, choose Add Control, and then select the file MSASB20.OCX

   from your ADT directory. Select Scroll Bar Control and then choose OK.

3. Note the scroll bar in the top left corner of the form. Click the right

   mouse button on the scroll bar, and then choose Scroll Bar Control

   Object, then Properties. Change the orientation from horizontal to

   vertical, and then choose OK. Size the scroll bar appropriately.

4. Click the right mouse button on the scroll bar, and then choose

   Properties. Change the Name property to "Scrollbar1" (without quotation

   marks).

5. From the View menu, choose Code. Add this code to the general

   Declarations:

      Option Explicit

      Dim rec_count As Integer

      Dim rs As Recordset

6. In the Object combo box, select Form. In the Procedure combo box, select

   Load. Add the following code to the Form Load procedure:

      Sub Form_Load ()

         ' Find out how many records are in the form.

          Set rs = Me.recordsetclone

          rec_count = rs.recordcount

          ' Initialize the scroll bar properties:

          Me!scrollbar1.object.Max = rec_count

          Me!scrollbar1.object.Min = 0

          Me!scrollbar1.object.SmallChange = 1

          Me!scrollbar1.object.LargeChange = 5

      End Sub

7. Click the right mouse button on the scroll bar, and then choose Build

   Event. Add the following code to the scroll bar's Change event:

      Sub scrollbar1_Change ()

         Dim x As Integer

         ' Moves to the first record in the form's dynaset, then moves

         ' .. forward x records, x being the value of the scroll bar.

         rs.MoveFirst

         x = Me!scrollbar1.object.value

         rs.Move x

         ' Check to see if at the beginning or end of the

         ' .. recordset, and if so, take appropriate action.

         If rs.eof Then

            rs.MoveLast

         End If

         If rs.bof Then

            rs.MoveFirst

         End If

         ' Coordinate the form bookmark and the dynaset's bookmark.

         Me.bookmark = rs.bookmark

      End Sub

8. Add this code to the form's Current event:

      Sub Form_Current ()

         ' Reinitialize the rec_count variable in case records are added.

         rec_count = rs.recordcount

         Me!scrollbar1.object.Max = rec_count

      End Sub

When you use the scroll bar, the appropriate record will be displayed.

However, if you move through the form using other methods, the scroll bar

will not reflect your movements.

REFERENCES

==========

Microsoft Access "Building Applications," Chapter 11

For more information about the scroll bar control, search for "scroll bar

control" then "Scroll Bar Control" using the Scroll Bar Control Help system

in the Microsoft ADT program group.

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsEvnt


INF: Using the Windows 3.1 API to Connect to Network Resources

Article ID: Q90862

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

The Microsoft Windows version 3.1 application programming interface

(API) can be used to connect to and disconnect from network drives and

printers in an Access Basic module.

MORE INFORMATION

================

To use the API functions, follow the steps below. You will probably

want to use variables for the parameters.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

1. Declare the functions required to add and remove network

   connections. Type the lines in a module in the Global Declarations

   section:

   '------------------------------------------------------------------

   Option Explicit

   Declare Function WNetAddConnection% Lib "User" (ByVal lpszNetPath$,_

                                                ByVal lpszPassword$,_

                                                ByVal lpszLocalName$)

   Declare Function WNetCancelConnection% Lib "User" (ByVal lpszName$,_

                                                ByVal fForce%)

   Const WN_SUCCESS=0           ' The function was successful.

   Const WN_NET_ERROR=2         ' An error occurred on the network.

   Const WN_BAD_PASSWORD=6      ' The password was invalid.

   Dim Results%, Force%

   '------------------------------------------------------------------

2. Create a function that makes the connection:

      Function AddConnection ()

         ' lpszLocalName$ can be in the form D: or E: and LPT1 or LPT2.

         Results% = WNetAddConnection("\\server\share", "password", "y:")

      End Function

   Some of the possible return values for Results% are WN_SUCCESS,

   WN_NET_ERROR, and WN_BAD_PASSWORD.

   For more information on how to obtain an unused drive resource

   programmatically, search the Knowledge Base for the following

   keywords:

      network and getdrivetype

3. Create a function that cancels the connection. The parameter

   fForce% specifies whether any open files or open print jobs on the

   device should be closed before the connection is canceled. If this

   parameter is FALSE and there are open files or jobs, the connection

   will not canceled.

      Function CancelConnection ()

         Force%=1

         ' NOTE: If Force%=0 and files were open,

         '       the connection will not be 'canceled.

         Results% = WNetCancelConnection("y:", 1)

      End Function

   Two of the most common return values for Results% are WN_SUCCESS

   and WN_NET_ERROR.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 2,

"Writing a New Function," pages 8-14

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: PgmApi


INF: Using Undocumented CreateForm(), CreateReport() Functions

Article ID: Q93096

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses the Microsoft Access undocumented functions

CreateForm() and CreateReport(). If you intend to write your own

FormWizard or ReportWizard, you can use these functions to create and

customize a blank form or report to which you can add controls.

This article assumes that you are familiar with Access Basic and

designing forms and reports.

MORE INFORMATION

================

CreateForm()/CreateReport() is roughly equivalent to choosing "New...

Form/New... Report" from the File menu at the top of the screen. When

the function is executed, a new empty form/report appears in an

iconized state.

Both functions return an object value that you can use for further

manipulation, and neither function requires parameters.

To use these functions, first define a form or report object

variable, then assign the variable to the function name. An example of

how to do this is:

   Dim MyForm As Form

   Set MyForm = CreateForm()

After opening the form/report in design mode after executing the

commands above, you can bind the form to a table or query by modifying

the form's/report's RecordSource property:

   MyForm.RecordSource = "Categories"

With the form/report in design mode, you can access and change any of the

other design-time properties of the form/report. You can also access and

change properties of each of the form's/report's sections via the Section

property. The Section property is actually an array with each array value

being a reference to a form's/report's section. For forms, the Section

property array is broken down as:

   Section(0) - Detail Section

   Section(1) - Form Header

   Section(2) - Form Footer

   Section(3) - Page Header

   Section(4) - Page Footer

For reports, the section property array is broken down as:

   Section(0) - Detail Section

   Section(1) - Report Header

   Section(2) - Report Footer

   Section(3) - Page Header

   Section(4) - Page Footer

   Section(5) - Group Level 1 Header

   Section(6) - Group Level 1 Footer

   Section(7) - Group Level 2 Header

      ...etc.

With this information, you can customize the design of a form/report

section programmatically. The following example creates a new report,

hides the page footer by setting its Visible property to false, sets

the Height property of the detail section, and enables its

KeepTogether property:

   Dim MyReport As Report

   Set MyReport = CreateReport()

   MyReport.Section(4).Visible = False

   MyReport.Section(0).Height = 1760

   MyReport.Section(0).KeepTogether = True

REFERENCES

==========

For more information on Microsoft Access libraries, query on the

following words here in the Microsoft Knowledge Base:

    libraries and debugging and creating

For more information on other ReportWizard and FormWizard functions,

query on the following words here in the Microsoft Knowledge Base:

   CreateControl and CreateReportControl and CreateForm and

   CreateReport and "Section Property" and DeleteControl and

   DeleteReportControl and CreateGroupLevel

For more information on the CreateForm(), CreateReport(), CreateControl(),

and CreateReportControl() functions, search for each function name and then

view its topic using the Microsoft Access version 2.0 Help menu.

Additional reference words: 1.00 1.10 2.00 wizards

KBCategory:

KBSubcategory: MdlLib


INF: Using Variables in the Criteria Row of the QBE Grid

Article ID: Q114511

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

You cannot use a variable in the criteria row of the Query by Example (QBE)

grid, because Microsoft Access assumes the variable name is a literal text

string. However, you can use a function name in the QBE grid, and have the

function return the value of the variable.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

The following example demonstrates how to create a form based on a query

that uses the value of a global variable as a criterion:

 1. Open the sample database NWIND.MDB.

 2. Create a new query based on the Employees table. Drag the First

    Name and Last Name fields from the field list to the QBE grid.

 3. In the criteria cell of the Last Name column, type the following

    function name:

       Return_Variable()

 4. Save the query as Variable Criteria Query and then close it.

 5. Create a new module with the following in the Declarations section:

       Option Explicit

       Global MyVar

 6. Enter the following functions in the module:

       Function Return_Variable()

          Return_Variable = MyVar

       End Function

       Function Set_MyVar(Name_from_Button)

          MyVar = Name_from_Button

          DoCmd Requery

       End Function

 7. Save the module as Variable Criteria Module and then close it.

 8. Create a new, blank form based on the Variable Criteria Query query.

 9. Place text box controls for the First Name and Last Name fields

    on the form.

10. Create the following two command buttons on the form:

       Object: command button

       ------------------------------

       Name: Fuller Button

       Caption: Fuller

       On Click: =Set_MyVar("Fuller")

       Object: command button

       -------------------------------

       Name: Peacock Button

       Caption: Peacock

       On Click: =Set_MyVar("Peacock")

    NOTE: In Microsoft Access version 1.x, the Name property is called

    the ControlName property, and the OnClick property is called the

    OnPush property.

11. Set the form's DefaultView property to Single Form and then switch

    the form to Form view.

12. Choose the Fuller button on the form. Note that the record for Andrew

    Fuller appears.

13. Choose the Peacock button on the form. Note that the record for

    Margaret Peacock appears.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.1, Chapter 1,

"Writing a New Function," pages 7-19

Microsoft Access "Building Applications," version 2.0, Chapter 3,

"Introducing Access Basic," pages 66-73

Additional reference words: 1.00 1.10 2.00 parameter

KBCategory:

KBSubcategory: QryParm


INF: Using Version 1.1 Databases in Version 2.0

Article ID: Q112122

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes several issues involved in using Microsoft Access

version 1.x databases in Microsoft Access version 2.0.

MORE INFORMATION

================

The following issues should be kept in mind when you are using version 1.x

databases in Microsoft Access version 2.0:

A. When you open an unconverted Microsoft Access 1.x database in Microsoft

   Access 2.0, you will receive the message:

      Database <database name> was created by a previous version of

      Microsoft Access. You won't be able to save changes made to object

      definitions in this database.

   You cannot make any design changes to database objects created in

   version 1.x until you convert the database to version 2.0. Note that

   database objects may behave differently in version 2.0 because of new

   and changed features.

   You can open and use unconverted databases in version 2.0. However, if

   you want to make design changes to them, use Microsoft Access version

   1.x.

B. You cannot change permissions in version 1.x databases using Microsoft

   Access version 2.0. However, if you use a version 1.x SYSTEM.MDA file

   with Microsoft Access 2.0, the existing security scheme will operate

   properly.

   You can use Microsoft Access version 1.x to make security changes to the

   version 1.x database, but make sure to use the version 1.x SYSTEM.MDA

   file.

C. You can update fields on the one side of a one-to-many join.

D. A combo or list box displays data as it is formatted in the control's

   underlying table or query. However, if the row source is a SQL SELECT

   statement, no formatting is applied.

   If you want the data in a combo or list box to be formatted, apply a

   format expression to the field in the query.

E. If you attempt to open an object in a version 1.x database whose name

   contains a backquote character (`) in version 2.0, you will receive

   the error message:

      Couldn't find object <objectname>

   While the backquote character (`) is permitted in object names in

   version 1.x, it violates standard naming conventions in version 2.0. In

   addition to the backquote (`), you cannot use a period (.), an

   exclamation point (!), or brackets ([]) in object names in version 2.0.

   Use Microsoft Access 1.x to rename objects in the version 1.x database

   to remove these characters.

F. The CTRL+F4 key combination closes only MDI windows (such as the

   Database window) in version 2.0. Use ALT+F4 to close pop-up windows. In

   Microsoft Access 1.x, CTRL+F4 closes both pop-up windows and MDI

   windows. This behavior is changed in version 2.0 to be consistent with

   Microsoft Windows behavior.

   This means that you should open your version 1.x databases in Microsoft

   Access version 1.x and change all occurrences of {^F4} to {%F4} in all

   SendKeys actions in macros and Access Basic code.

G. SendKeys actions to change menus, dialog boxes and property sheets do

   not necessarily produce the same results in version 2.0 as they do in

   version 1.x, since the File, Edit, Layout, and Format menus are changed

   in version 2.0. The Paste Special, Options and Security dialog boxes are

   changed as well. Several changes and additions to object property sheets

   also affect how SendKeys actions set properties.

   The following items describe how to accommodate these changes:

    - Open your version 1.x databases in Microsoft Access version 1.x and

      replace all SendKeys actions in macros and code that reference

      changed menus with DoMenuItem actions.

    - Set and change security using data access objects (DAO) instead of

      SendKeys. This requires that you first convert the database to

      version 2.0 database format.

    - Set properties at run time instead of using code that opens objects

      in Design view, changes properties, then opens the same objects in

      Form view. This requires that you first convert the database to

      version 2.0 database format.

    - Use the GetOption and SetOptions methods instead of SendKeys to

      change options. This requires that you first convert the database to

      version 2.0 database format.

   Since changes like these can occur with each new version of

   Microsoft Access, it is best to avoid using the SendKeys action

   whenever possible.

H. Tables are the only objects that you can export to a Microsoft Access

   1.x database from a Microsoft Access 2.0 database. You cannot export any

   other object from a version 2.0 database to a version 1.x database.

   Objects in a version 1.x database opened in version 2.0 can be exported

   to a version 2.0 database. However, this process converts those objects

   to version 2.0 objects.

   You can attach a version 1.x table using version 2.0. You cannot attach

   a version 2.0 table using version 1.x.

I. In version 1.x, validation rules for bound controls override validation

   rules for bound fields in the underlying table. In version 2.0, the

   validation rules for the field and bound control are combined.

   For example, in version 1.x, if the field validation rule requires the

   value of a numeric field to be greater than 100, and the validation rule

   for a bound control on a form requires the value to be less than 75, an

   entry of 50 in the bound control is allowed.

   The same entry would not be allowed in version 2.0, since the field and

   bound control validation rules are combined, and there is no number that

   is both less than 75 and greater than 100.

   It is recommended that you review all of your form and field validation

   rules and change them where conflicts occur.

REFERENCES

==========

For more information about converting version 1.x databases to version 2.0

format, search for "Convert Database" then "Convert Database Command" using

the Microsoft Access Help menu.

For more information about DAO, search for "DAO" then "Objects and

Collections Reference" using the Microsoft Access Help menu.

Additional reference words: 2.00 Compatibility Converting

KBCategory:

KBSubcategory: IntpOthr


INF: Using WIN.INI & ODBC.INI When Attaching SQL Server Table

Article ID: Q96110

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article discusses how the ODBC Driver manager and the SQL Server

driver use the WIN.INI and ODBC.INI files during connection time.

MORE INFORMATION

================

For the purposes of this article, the following is assumed:

 - You set up a data source for the SQL Server driver called mysqlsvr.

 - The data source is located on a server called Unixmc.

 - You are connecting to a Sybase SQL Server table on Unix whose

   address is 11.1.4.40,3180.

 - The net-library you are using is wdbftptc.dll.

Given these assumption, if the setup was done correctly, the ODBC.INI

file will have the following entry in the [ODBC Data Sources] section:

   mysqlsvr=SQL Server

There will be a section called [mysqlsvr] in the ODBC.INI and it will

have entries of the following form:

   DRIVER=c:\windows\system\sqlsrvr.dll

   Description=SQL\Server on server Unixmc

   OemToAnsi=No

   Network=wdbftptc

   Address=11.1.4.40,3180

The DRIVER entry points to the location of the SQL Server driver. It

is located on the System subdirectory of the Windows directory.

The Description entry describes what kind of a data source this is.

This is something that you can change when setting up the data source

by using ODBC Administrator.

The OemToAnsi entry indicates whether conversion needs to be done from

the OEM code page to the ANSI code page. Note that this is not the

same as the translation DLL.

The Network entry indicates the name of the net-library.

The Address entry indicates the network address.

The WIN.INI file will have the following entry in its [SQLSERVER] section:

   mysqlsrvr=wdbftptc,11.1.4.40,3180

When you run a SQLConnect or SQLDriverConnect command and choose to

connect to the mysqlsvr data source, the Driver manager looks in the

ODBC.INI file to find the name and location of the SQL Server driver.

It looks for the DRIVER entry described above and loads it into

memory.

Next, the SQL Server driver looks in the WIN.INI file's [SQLSERVER]

section for mysqlsvr entry where it picks up the name of the

net-library. Then it loads the net-library name (wdbftptc in this

case) into the memory. Next, it looks at the entry again to get the

address of the server which it passes on to the net-library. If there

is no address following the name of the net-library, it passes the

name of the data source to the net-library, as the network address.

Db-library users should note that unlike W3DBLIB.DLL, the SQL Server

driver does not look at the dsquery entry unless dsquery is a data

source in the ODBC.DLL file.

If you are using Microsoft Access, this sequence of operations take

place when you attach a SQL Server table. If you are using Microsoft

Visual Basic version 2.0, it takes place in response to the

OpenDataBase call.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


INF: Validation Rule to Accept Only Alphabetic Characters

Article ID: Q114554

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article demonstrates a sample user-defined Access Basic function

called IsAlpha() that you can use to validate a string to make sure that

every character in the string is a letter in the English alphabet.

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

MORE INFORMATION

================

The IsAlpha() function accepts a string argument and checks each character

in the string to make sure it is a character in the English alphabet. The

function does this by checking the ASCII value of each character in the

string to see if it falls in the range from 65 to 90 (for uppercase

characters), or in the range from 97 to 122 (for lowercase characters), of

the ANSI character set. The function returns True if all the characters in

the string fall within one of these two ranges, or False if one or more

characters in the string does not fall within one of these two ranges. You

can use this function as a validation rule for a field in a table in

Microsoft Access version 1.x, or as a validation rule for a control on a

form in Microsoft Access versions 1.x and 2.0.

The following example shows how to use the function as a validation rule

for a control on a form.

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

1. Open the sample database NWIND.MDB.

2. Create a new module and enter the following code:

      '**********************************

      'Declarations section of the module

      '**********************************

      Option Compare Database

      Option Explicit

      '===============================================================

      ' The following function is named IsAlpha(). It accepts a string

      ' argument and returns either True (-1) or False (0).

      '===============================================================

      Function IsAlpha (MyString As String) As Integer

         Dim MyStringLength As Integer

         Dim LoopVar As Integer

         Dim y

         LoopVar = 1

         If IsNull(MyString) Then

            IsAlpha = False

            Exit Function

         End If

         MyStringLength = Len(MyString)

         For LoopVar = 1 To MyStringLength

            y = Mid$(MyString, LoopVar, 1)

            If Asc(y) >= 65 And Asc(y) <= 90 Then

               IsAlpha = True

            ElseIf Asc(y) >= 96 And Asc(y) <= 122 Then

               IsAlpha = True

            Else

               IsAlpha = False

               Exit Function

            End If

         Next LoopVar

      End Function

3. Open the Categories form in Design view.

4. Set the Category Name field's ValidationRule property to:

      IsAlpha([Category Name]) = True

5. Save the Categories form, and then view the form in Form view.

6. From the Records menu, choose Data Entry.

7. Type "ABCD" (without quotation marks) in the Category Name field.

   Note that the validation rule allows you to create this entry and

   exit the field.

8. In another new record, type "AB,D" (without quotation marks) in the

   Category Name field. Note that the validation rule will not accept

   the entry.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 3,

"Access Basic Essentials," pages 24-26

Microsoft Access "Language Reference," version 1.0, "Asc Function," pages

40-41, and "Mid$ Function," pages 302-303

Microsoft Access "User's Guide," version 2.0, Chapter 8, "Entering a

Validation Expression," pages 147-148

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlValid


INF: Validation Rule to Require Uppercase in a Field

Article ID: Q100469

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

Microsoft Access does not have a setting to force entries in a field

or control to be in uppercase letters. However, a validation rule can

be used to ensure that only uppercase letters are used.

The following sample validation rule requires that entries in a field

or control called Last Name be entered in uppercase letters:

   StrComp(UCase([Last Name]),[Last Name],0) = 0

REFERENCES

==========

Microsoft Access "User's Guide," Appendix C

Microsoft Access "Language Reference," page 456

Additional reference words: 1.00 1.10 2.00 capital letter upper case all

KBCategory:

KBSubcategory: GnlValid


INF: Word for Windows Print Merge Using Microsoft Access Data

Article ID: Q103629

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Word for Windows, versions 1.1, 1.1a, 2.0, 2.0a, 2.0b,

   and 2.0c

---------------------------------------------------------------------

SUMMARY

=======

There is no Microsoft Word for Windows file converter capable of reading

Microsoft Access database files. In order to use data from a Microsoft

Access database in a Microsoft Word for Windows print merge, the data must

first be exported from Microsoft Access in a format that Microsoft Word for

Windows recognizes.

In Microsoft Access version 1.0, you can export the data in dBASE IV

format. In Microsoft Access versions 1.1 and 2.0, you can export the data

in Word For Windows Merge format. We do not recommend that you export

Microsoft Access data to Word for Windows using the Text (Delimited format.

MORE INFORMATION

================

Exporting Data from Microsoft Access for Use in a Print Merge

-------------------------------------------------------------

1. Open the Microsoft Access database table that contains the data you want

   to use in a Microsoft Word for Windows print merge.

2. From the File menu, choose Export. In Microsoft Access version 1.1

   or 2.0, select Word For Windows Merge in the Data Destination box. In

   Microsoft Access version 1.0 select dBASE IV as the data destination.

   Choose OK.

3. From the Table list, select the table to be exported, and choose OK.

   NOTE: Microsoft Access only shows you a list of available tables to

   export. If you want to export a subset of a table, you can create a

   query to result in the subset you want, and export the results to a

   print merge data file. For information on how to export the results of a

   query to a file, query on the following words here in the Microsoft

   Knowledge Base:

      access and export and query and transfer and results

4. Enter a unique filename in the File Name box. Select the appropriate

   destination directory in the Directory box and then choose OK.

Notes

-----

 - Microsoft Access 1.1 will default the export filename to the same name

   as your table, with a .TXT extension, and will place the file in the

   Microsoft Access directory. Microsoft Access 1.0 will default the export

   filename to the same name as your table, with a .DBF extension. In

   either case, you may want to change the directory to your Microsoft Word

   for Windows directory and give the file a .DOC extension to make it

   easier to find in Word for Windows.

 - In Microsoft Access versions 1.1 and 2.0, you can select custom formats

   in the Export Options dialog box. These options determine how dates,

   times, and numbers are formatted in the data file. Although you can

   select custom formats, you do not need to make any changes in this

   dialog box.

 - In Microsoft Access 2.0, you can export the data with the Output To

   command from the File menu. You can output the table to Rich Text

   format, which Word for Windows can read.

   This format will maintain the table structure, if the table does not

   exceed Microsoft Word for Windows internal limits. This method does not

   correct the field names, which can cause problems with a Microsoft Word

   for Windows print merge. Problems with Microsoft Access field names in

   a Word for Windows print merge are discussed later in this article.

Using the Exported Data in Microsoft Word for Windows

-----------------------------------------------------

1. Open or create the main document in Microsoft Word for Windows.

2. From the File menu, choose Print Merge.

3. Choose Attach Data File.

4. From the file list, select the exported file, and then choose OK.

   NOTE: You may have to type "*.TXT" or "*.DBF" (without the quotation

   marks) in the File Name box to see text or dBASE files in the filename

   list.

5. Use the Insert Merge Fields tool on the print merge toolbar to insert

   fields in your main document. Consult the Microsoft Word for Windows

   documentation for information on how to use the merge features.

Problems Exporting Data Using the Text (Delimited) Format

---------------------------------------------------------

One method of exporting data to Microsoft Word for Windows is to use the

Text (Delimited) format. However, exporting the data in this format may

require some changes to the exported data file before it can be used for a

print merge.

The problem is that a number of restrictions are placed on field names used

in a Microsoft Word for Windows print merge, including the following:

 - Field names cannot contain spaces.

 - Field names cannot begin with a number.

 - Field names cannot be longer than 20 characters in length.

 - Field names cannot contain special characters.

Microsoft Access field names do not have these restrictions. Consequently,

you can export data from Microsoft Access that contains field names

incompatible with Microsoft Word for Windows. If you use the Text

(Delimited) format for exporting data, you may have to change the field

names in the exported data file so that they meet the restrictions listed

above.

If you use the dBASE IV or Word For Windows Merge formats, Microsoft

Access will perform field name conversions to ensure that the data files

will work correctly with Microsoft Word for Windows.

Microsoft Access Field Name Conversion

--------------------------------------

As discussed previously, Microsoft Word for Windows places a number of

restrictions on the field names used in a print merge. Since Microsoft

Access is not limited by these restrictions, it must perform field name

conversions when exporting data to a print merge data file.

Microsoft Access performs field name conversions using the following

rules:

 - Any spaces or illegal characters are converted to underscores.

 - If the first character in a field name is a number or an underscore,

   Microsoft Access adds the prefix "m_". For example, 1Field becomes

   m_1Field, and _Field2 becomes m__Field2.

 - Microsoft Access truncates field names that are longer than 20

   characters.

 - If a conversion results in a duplicate field name, Microsoft Access adds

   a number to the end of each duplicate name (replacing the final

   character, if the field name contains twenty characters). For example,

   the field names Order#, Order$, and Order% become Order_, Order_1, and

   Order_2.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


INF: Writing Functions Called from Events or Expressions

Article ID: Q97514

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

Functions can be used in a variety of places in Microsoft Access. How

you write your functions depends on where the functions are going to

be called from.

This article assumes that you are familiar with Access Basic and with

creating applications for Microsoft Access using the programming tools

provided with Microsoft Access.

MORE INFORMATION

================

There are two main styles for writing Access Basic functions:

 - Functions can be called from event properties, such as the

   AfterUpdate property for a control on a form. Typically, you would

   call the function with a parameter. The function then acts on or

   modifies the parameter.

 - Functions can be used in expressions, such as calculated controls.

   The difference is in how the result is returned when the function

   exits.

NOTE: This article does not address event procedures in Microsoft Access

version 2.0, since these are Sub procedures and not functions.

The examples below use the Proper() function to illustrate the

differences between the two function styles. Proper() converts the

first letter of a word to uppercase and the other letters to

lowercase.

Calling a Function from an Event Property

-----------------------------------------

The Proper() function can be written so it can be called from an

event, such as the AfterUpdate property of a control on a form. In

this example we will call it ProperAU() as a reminder that it should

be called from the AfterUpdate property.

Enter the following function in a module:

   Function ProperAU(Field As Control)

      Field=UCase(Left(Field,1)) & LCase(Mid(Field,2))

   End Function

NOTE: The result of the calculation updates the field that was

passed as a parameter.

Example

-------

1. Open the Customers form in Design view.

2. View the Property sheet by choosing Properties from the View menu.

3. Add the following statement to the AfterUpdate property of the

   First Name field:

      Object: Text Box

      ----------------

      ControlName: First Name

      AfterUpdate: =ProperAU([First Name])

Now, whenever the employees name is typed into the Employee form,

it will be converted to the correct format when the user presses

TAB or ENTER.

Calling a Function from an Expression

-------------------------------------

The Proper() function can be written so it can be called from an

expression, or calculated control. In this example we will call it

ProperCC() as a reminder that it should be used in calculations.

Enter the following function in a module:

   Function ProperCC(Field)

      ProperCC=UCase(Left(Field,1)) & LCase(Mid(Field,2))

   End Function

NOTE: The result of the calculation is assigned to the function.

This way, it can be used in an expression or calculated control.

Example

-------

1. Open the Customers form in Design view.

2. Add the following calculated control to the form:

      Object: Text Box

      ----------------

      ControlName: Proper Last Name

      ControlSource: =ProperCC([Last Name])

   Now when you type in the Last Name field, you will see the correct

   capitalization in the Proper Last Name field.

   NOTE: You will not be able to type in the Proper Last Name field.

   ProperCC() does not change underlying data like ProperAU() does.

   For this reason, ProperCC() is useful in reports and expressions

   and can be used more places than ProperAU().

   You can use ProperCC in the same manner as any of the built-in

   functions listed in the "Language Reference," such as UCase, LCase,

   and so on.

Determining the Type of Function You Need

-----------------------------------------

   Where used                                   Function style

   -----------------------------------------------------------

   AfterUpdate, BeforeUpdate, and so on         Event

   RunCode macro action                         Event

   Calculated controls on forms and reports     Expression

   Calculated fields in a query                 Expression

   SetValue macro action expression             Expression

   Default values in a table or form            Expression

   Called from another function or sub          Expression

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


INF: Xtrieve Data Dictionary (.DDF) File Information

Article ID: Q109449

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SUMMARY

=======

This article describes Xtrieve data dictionary (.DDF) files.

MORE INFORMATION

================

Each Xtrieve data dictionary consists of three files: FILE.DDF,

FIELD.DDF, and INDEX.DDF.

The first three records in the FILE.DDF file contain information about the

.DDF files for the data dictionary. The first record contains the name and

path to itself (FILE.DDF), the second record contains the name and path to

FIELD.DDF, and the third record contains the name and path to INDEX.DDF.

The remaining records contain the path and filename of each Btrieve file

available for use by Microsoft Access as a table.

Microsoft Access reads the FILE.DDF file to locate the FIELD.DDF and

INDEX.DDF files. If you move these files, make sure to update the FILE.DDF

file to reflect their current location. Or, if you change the names of

these files, make sure to update the FILE.DDF file to reflect the new

names.

To modify the FILE.DDF file you must use Xtrieve, or any hex editor. If you

use a hex editor to modify the file, make sure not to change the record

or field lengths in the file.

Xtrieve and Btrieve are manufactured by Novell, Inc., a vendor independent

of Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 Attaching

KBCategory:

KBSubcategory: IsmBtrv


PRA: "#" Character in Input Mask Causes Unexpected Behavior

Article ID: Q116385

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you enter data in a text field that uses the "#" character as part of

an input mask, spaces that you enter with the LEFT ARROW and RIGHT ARROW

keys may not be converted properly when the record is saved.

RESOLUTION

==========

There are two workarounds for this behavior:

 - Use the spacebar, instead of the LEFT ARROW and RIGHT ARROW keys, to

   move in the text field.

 - Change the InputMask property to save the field as it is displayed.

   To do this, add ";0" (without quotation marks) to the end of the

   input mask in Design view. For example, given the input mask

      ###" Next Number"###" End"

   you can cause Microsoft Access to save the field as it is displayed

   by changing the input mask to:

      ###" Next Number"###" End";0

   Note that if you use this method, Microsoft Access stores the literal

   display characters in the table when you enter data.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open any database.

2. Create a new table called TryMe.

3. Add a text field called Test Input Mask to the table. Set the field's

   input mask to the following:

      ###" Next Number"###" End"

4. Save the table and then view it in Datasheet view.

5. Type "1" (without quotation marks) in the first entry position in the

   field, use the RIGHT ARROW key to move the next entry position, then

   type "1" (without quotation marks) in the second entry position.

6. Press TAB to exit the field. Note that the data is saved as

      11 Next Number  End

   instead of

      1 Next Number 1 End

If you use the SPACEBAR instead of the RIGHT ARROW key in the example

above, the data will be saved correctly. Note that using the mouse to move

from the first entry position to the second entry position will also cause

the problem to occur. This problem occurs with both tables and forms.

REFERENCES

==========

For more information about the InputMask property, search for "InputMask"

then "InputMask Property" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: GnlInpt


PRA: "Internal Database Error -1310" Executing Large Query

Article ID: Q109346

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run a large query (about 25K or more in size), you receive the

error message

   Internal database error -1310 has occurred

even if the SQL statement is correct.

CAUSE

=====

This error is caused by an out of memory condition in an internal

memory segment.

RESOLUTION

==========

Break up large queries that generate this error into several smaller

queries.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem, and will post new

information here in the Microsoft Knowledge Base as it becomes available.

Additional reference words: 1.00 1.10 2.00 Queries OOM

KBCategory:

KBSubcategory: QryParm


PRA: "Invalid Method in Expression in Query Expression" Error

Article ID: Q115571

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to convert a Microsoft Access version 1.x database to version

2.0, you receive the following error message:

   Invalid method in expression in query expression 'Tablename.Fieldname'

CAUSE

=====

If your Microsoft Access version 1.x database contains a table named

Select, or if a table in the database contains a field named Select, and

there is a query based on this table or field, the conversion process will

stop and you will see the error message stated above. This behavior occurs

because the conversion process confuses the table or field name Select with

the SELECT SQL keyword when it is converting the queries in the database.

RESOLUTION

==========

In order to work around this problem, open the database in Microsoft Access

version 1.x and change the name of any table or field named Select to some

other name. Avoid using Microsoft Access SQL keywords as table or field

names. Then, start Microsoft Access version 2.0 and begin the conversion

process again.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. In Microsoft Access version 1.x, create a table named Select.

2. Create a query based on the Select table.

3. Save the table and query, and then quit Microsoft Access.

4. Start Microsoft Access version 2.0 and try to convert the database

   from version 1.x to 2.0 by choosing Convert Database from the File

   menu.

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: GnlOthr


PRA: "Unexpected Error from External Database Driver [7]"

Article ID: Q116383

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are working with an attached Btrieve table, you receive the error

message:

   Unexpected error from external database driver [7]

Or, a query based on an attached Btrieve table does not return any records

in Microsoft Access version 2.0. This same query does return records

correctly in Microsoft Access version 1.x.

CAUSE

=====

The problems stated above are caused by an error in the BTRV200.DLL Btrieve

ISAM driver that is installed by Microsoft Access 2.0.

RESOLUTION

==========

An updated Btrieve ISAM driver is available in the Microsoft Software

Library (MSL). This driver is for use by registered owners of Microsoft

Access version 2.0 and Microsoft Visual Basic version 3.0 for Windows -

Professional Edition only. By downloading this driver, you are indicating

that you are a registered owner of one of these products.

You can download BTR200.EXE, a self-extracting file, from the MSL on the

following services:

 - CompuServe

      GO MSL

      Search for BTR200.EXE

      Display results and download

 - Microsoft Download Service (MSDL)

      Dial (206) 936-6735 to connect to MSDL

      Download BTR200.EXE

 - Internet (anonymous FTP)

      ftp ftp.microsoft.com

      Change to the \softlib\mslfiles directory

      Get BTR200.EXE

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

You can differentiate between the original and updated drivers by checking

the file sizes. The original BTRV200.DLL file has a file size of 110,592

bytes. The updated file has a file size of 110,624 bytes. For a network

installation of Microsoft Access, install the updated file in the

ACCESS\SYSTEM directory. For a stand-alone installation of Microsoft

Access, install the updated file in the WINDOWS\SYSTEM directory.

NOTE: Do not install the updated file before installing Microsoft Access.

You should install Microsoft Access first, then install the updated driver.

How to Install the Updated Driver

---------------------------------

Stand-Alone Installation:

1. Make a backup copy of the original BTRV200.DLL file by renaming it, or

   by copying it to another location. The BTRV200.DLL file is in the

   WINDOWS\SYSTEM directory.

2. Copy the updated BTRV200.DLL file to the WINDOWS\SYSTEM directory.

Network Installation:

1. The network administrator should make a backup copy of the original

   BTRV200.DLL file by renaming it, or by copying it to another location.

   The BTRV200.DLL file is in the ACCESS\SYSTEM directory on the network

   server.

2. The network administrator should copy the updated BTRV200.DLL file to

   the ACCESS\SYSTEM directory on the network server.

3. The network administrator should make a backup copy of the SETUP.INF

   file by renaming it, or by copying it to another location. The SETUP.INF

   file is located in the ACCESS installation directory on the network

   server.

4. The network administrator should open the SETUP.INF file in any text

   editor (such as Windows Notepad), and change the line that reads

     "DLL"= 1,SYSTEM\BTRV200.DLL,,,,,,1033,,,,,,,SHARED,110592,,,,2.0.0.13,

   to read:

     "DLL"= 1,SYSTEM\BTRV200.DLL,,,,,,1033,,,,,,,SHARED,110592,,,,2.0.0.15,

5. After making this change, the network administrator should save and then

   close the SETUP.INF file.

   This modification changes the internal version from 2.0.0.13 to

   2.0.0.15. Changing the internal version number in the SETUP.INF file

   will cause future workstation installations of Microsoft Access to

   install the updated Btrieve driver on workstations that have a copy of

   the original Btrieve driver.

6. The network administrator should make the updated BTRV200.DLL file

   available to those who have installed Microsoft Access to their local

   workstation hard disks. These users should copy the updated file to

   their WINDOWS\SYSTEM directories.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IsmBtrv


PRA: 1.x Table/Query Datasheet Properties Not Converted to 2.0

Article ID: Q117538

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The row heights and fonts of tables and queries open in Datasheet view that

were converted from Microsoft Access version 1.x format to version 2.0

format are reset to their default values. The row heights and fonts are not

set to what they were in Microsoft Access version 1.x.

CAUSE

=====

When you convert a database from Microsoft Access version 1.x to version

2.0 format, the following property settings for tables and queries are

reset to their default values:

 - Description

 - FrozenColumns

 - RowHeight

 - DatasheetFontHeight

 - DatasheetFontItalic

 - DatasheetFontName

 - DatasheetFontUnderline

 - DatasheetFontWeight

RESOLUTION

==========

There are two ways to work around this problem:

 - After converting the database, manually set each of the affected

   properties back to the correct setting by using the commands on the

   Format menu.

 - Write a custom function to automatically set the datasheet properties

   for each table. The following example demonstrates how to set the row

   height of the Customers table in the sample database NWIND.MDB to

   display two lines of data. The property setting will take effect the

   next time you open the Customers table in Datasheet view. This example

   uses the SetTableProperty procedure, which is in the NWIND database's

   global module:

      Dim MyDB As Database, MyTableDef As TableDef

      Set MyDB = DBEngine.Workspaces(0).Databases(0)

      Set MyTableDef = MyDB![Customers]

      SetTableProperty MyTableDef, "RowHeight", DB_LONG, 450 (450 twips)

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access version 1.x and open the sample database

   NWIND.MDB. Open the Customers table in Datasheet view.

2. From the Layout menu, choose Row Height. Change the value from 10.5 to

   20.

3. Save the changes and quit Microsoft Access.

4. Start Microsoft Access version 2.0.

5. From the File menu, choose Convert. Convert the Microsoft Access version

   1.x sample database NWIND.MDB to version 2.0 format. Name the converted

   database NWIND20.MDB

6. Open the NWIND20 database and then open the Customers table in Datasheet

   view.

7. Check the row height setting that you set in step 2. Note that the value

   has been reset to the default value of 10.5.

Additional reference words: 2.00

KBCategory:

KBSubcategory: TblOthr


PRA: ADT Application Setup Fails with Error -1809

Article ID: Q115880

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when you install a custom

application created with the Microsoft Access Developer's Toolkit (ADT):

   Setup couldn't create a SYSTEM.MDA file. After Setup is completed,

   reboot your computer, then run the Workgroup Administrator before

   you run this application. (-1809)

CAUSE

=====

This problem occurs if no form of file sharing (SHARE.EXE, VSHARE.386, or

network locking) is running when the Workgroup Administrator (WRKGADM.EXE)

tries to create a SYSTEM.MDA file. In order for the Workgroup Administrator

to be able to create the SYSTEM.MDA file, some form of file sharing must be

running.

RESOLUTION

==========

There are two workarounds for this problem:

 - Ship a SYSTEM.MDA file with your custom application. To do this, add the

   SYSTEM.MDA file in the Files To Include box in the ADT Setup Wizard.

   This way, the Workgroup Administrator does not need to create a

   SYSTEM.MDA file. Note that the file must be named SYSTEM.MDA in order

   for this workaround to work. No other name (such as MYSYS.MDA) will

   work.

 - Test to see if some form of file sharing is running before starting the

   custom Setup program. You can test to see if file sharing is running in

   a number of ways. To test for file sharing in Microsoft Windows, you can

   start the MS-DOS prompt and then type "share" (without quotation marks).

   If file sharing is running, you will receive a message stating "SHARE

   already installed." You can also test for file sharing with a small

   Microsoft Visual Basic or Microsoft Visual C application (these

   applications are not discussed in this article).

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft Access

Developer's Toolkit version 2.0. We are researching this problem and will

post new information here in the Microsoft Knowledge Base as it becomes

available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create application disks using the ADT Setup Wizard. Do not include

   a SYSTEM.MDA file with your application.

2. Install your application on a computer that is not running some form

   of file sharing (either loading SHARE.EXE in the AUTOEXEC.BAT file or

   loading VSHARE.386 in the [386Enh] section of the SYSTEM.INI file).

You will receive the error message stated above near the end of the Setup

process.

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: StpFail


PRA: Calendar Control Font and Color Properties Unavailable

Article ID: Q115125

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The arrow to the right of the Calendar Control Properties drop-down list

box is unavailable. You cannot access the Font and Color properties for the

Calendar control.

CAUSE

=====

The file OC1016.DLL did not get registered properly in the REG.DAT file

when you installed the Microsoft Access Developer's Toolkit.

RESOLUTION

==========

NOTE: This resolution assumes that the Microsoft Access Developer's Toolkit

is installed in the C:\ACCESS\ADT directory, and that Microsoft Windows is

installed in the C:\WINDOWS directory. If you are using different

directories, modify the line in step 2 appropriately.

1. In Windows Program Manager, choose Run from the File menu.

2. In the Command Line box, type the following line, and then choose OK:

      C:\ACCESS\ADT\MSAREG C:\WINDOWS\SYSTEM\OC1016.DLL

The registration process will take from 1 to 5 seconds to complete. You

will not receive any notification that the process has been completed.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. In any database, create a blank, new form.

2. From the Edit menu, choose Insert Object.

3. Select the Insert Control option button.

4. In the Control Type box, select Calendar Control, and then choose OK.

5. From the Edit menu, choose Calendar Control Object, then choose

   Properties. Note that the arrow to the right of the Calendar Control

   Properties drop-down list box is dimmed.

Additional reference words: 2.00 gray grayed custom ocx

KBCategory:

KBSubcategory: GnlApp


PRA: Cannot Connect to SQL Server w/ NetWare, Workgroups

Article ID: Q90151

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Windows for Workgroups version 3.11

---------------------------------------------------------------------

SYMPTOMS

========

You are unable to communicate with SQL Server in Microsoft Access when you

are running Microsoft Access under Microsoft Windows for Workgroups on a

Novell NetWare network.

CAUSE

=====

The Windows for Workgroups IPX/SPX driver (MSIPX.COM) does not work

correctly with Novell's named pipe requester (DOSNP.EXE) to connect to or

communicate with SQL through named pipes.

RESOLUTION

==========

Use the NetWare Integration Kit (NIK), which provides native SPX/IPX

connectivity to SQL Server. This connectivity eliminates the need for

DOSNP.EXE. The NIK enables Microsoft Access and Windows for Workgroups to

communicate correctly with SQL Server on a Novell network.

You can obtain the NIK by purchasing SQL Server for OS/2 version 4.2B or

the upgrade kit from the usual retail channels.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Windows for

Workgroups version 3.11. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Novell's implementation of IPX is a file called IPX.COM. Microsoft's

equivalent NDIS-compliant implementation of IPX is a file called MSIPX.COM,

which is used by Microsoft Windows for Workgroups. MSIPX.COM is

functionally equivalent to Novell's IPX.COM, but has the additional

capability of using NDIS-compliant network adapter drivers.

When you install the NetWare Named Pipe Requester, a terminate-and-stay-

resident program (TSR) called DOSNP.EXE installs into memory. This TSR

works with IPX.COM to provide named-pipe functionality (which is the

communication protocol used by SQL Server) to applications. However,

DOSNP.EXE does not work correctly with MSIPX.COM at this time. Since

Windows for Workgroups uses MSIPX.COM, the NetWare Named Pipe Requester

does not work with Windows for Workgroups. Therefore, Microsoft Access is

not able to properly communicate with SQL Server.

Additional reference words: 1.00 1.10 2.00 importing exporting attaching

KBCategory:

KBSubcategory: ObcOthr


PRA: Cannot Convert Database with Same Name and Path

Article ID: Q118368

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you choose to convert a Microsoft Access version 1.x database to

version 2.0 using the Convert command from the File menu, you can specify a

destination database with the same path and filename as the source

database. However, if you do so, the following error message will be

displayed:

   Can't convert a database if the source and destination databases have

   the same name and path.

CAUSE

=====

Microsoft Access version 2.0 cannot convert a database if the source and

destination databases have the same name and path.

RESOLUTION

==========

Specify either a different name or a different path for the source and

destination databases. If you want to use the same name, you must use a

different path.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access version 2.0.

2. From the File menu, choose Convert Database.

3. In the Database To Convert From dialog box, specify a valid Microsoft

   Access version 1.x database, and then choose OK.

4. In the Database To Convert Into dialog box, specify the same database

   name and path, and then choose OK.

5. When you are prompted whether you want to replace the source database,

   choose Yes. The error message listed above will be displayed.

REFERENCES

==========

For more information about converting databases, search for "converting

databases to version 2.0" then "Convert Database Command" using the

Microsoft Access Help menu.

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: CnvErrs


PRA: Cannot Export Paradox/dBase Tables

Article ID: Q99944

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Access, you cannot export a Paradox or dBASE table over the

top of an existing corrupted Paradox or dBASE database file. If you try to

do so, you receive the following error message:

   <path\filename> This file already exists.

   Replace existing file?.

If you choose the Yes button, you receive the following error message:

   Table '<tablename>' already exists.

This error occurs with both dBASE and Paradox formats. Other database

exports correctly allow you to overwrite existing database files.

CAUSE

=====

Microsoft Access tries to open the file to verify its contents instead

of simply overwriting it.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce the Problem

------------------------------

1. Copy your CONFIG.SYS file to CONFIG.DB. (This will simulate a

   corrupted Paradox database.)

2. In Microsoft Access, choose Export from the File menu, select

   Paradox 3.X and any table.

3. Specify CONFIG.DB as the output file and choose OK.

4. Choose Yes to the "Replace existing file?" message.

You receive the error message "Table 'CONFIG#DB already exists."

Additional reference words: 1.00 1.10 2.00 Import/Export

KBCategory:

KBSubcategory: IntpOthr


PRA: Changes to Linked Object Do Not Update Source Properties

Article ID: Q115188

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you change the source of a linked object on a form using the Links

dialog box, the SourceObject and SourceItem properties for that object will

not be updated, although the object itself will be updated correctly.

CAUSE

=====

The SourceObject and SourceItem properties are used only to create new

objects or update existing objects. They are not meant to reflect an

object's current description.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. In any database, create a new form.

 2. Place a bound object frame on the form.

 3. From the Edit menu, choose Insert Object.

 4. Select the Create From File option button. Choose the Browse button.

 5. In the File Name box, select any .BMP file from your Windows directory,

    and then choose OK.

 6. In the Insert Object box, select the Link check box, and then choose

    OK.

 7. From the Edit menu, choose Links.

 8. In the Links box, select the link, and then choose the Change Source

    button.

 9. In the File Name box, select a different .BMP file, and then choose

    OK.

10. Choose Close. Note that the linked object in the form is updated.

11. View the object's properties. Note that the SourceItem property

    is blank.

Note that if you copy the item in Windows Paintbrush, and then paste it

into the form with the Paste Special command, selecting the Paste Link

option button, the properties will be filled in correctly.

REFERENCES

==========

For more information about links, search for "linked object" then "Links

Command (Edit Menu)" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IntpOle


PRA: Changes to Print Setup Not Saved with Form or Report

Article ID: Q114514

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

After changing your form or report to print in a different paper

orientation (such as landscape), it does not print in the orientation you

chose. After checking the Print Setup dialog box, you find that none of the

changes you made were saved.

CAUSE

=====

Changes made in the Print Setup dialog box are not saved under the

following conditions:

 - The report contains functions that change one or more run-time settings

   and you choose Print Setup from the File menu while previewing the

   report.

 - When you open a form into Form view, Datasheet view, or Print Preview,

   switch to Form Design view, then choose Print Setup from the File menu.

RESOLUTION

==========

For reports, make changes in the Print Setup dialog box from the Database

window, rather than while previewing the report.

For forms, make changes in the Print Setup dialog box while the form is

open in Design view, rather than while previewing the form.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. Microsoft is researching this problem and will post new information

here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open any form in Datasheet view.

2. Preview the form.

3. From the File menu, choose Print Setup. Change the orientation from

   Portrait to Landscape.

4. Switch the form back to Design view, and then save and close the form.

5. Open the form in Design view and choose Print Setup from the File menu.

   Note that the orientation is still set to Portrait.

REFERENCES

==========

For more information about changing form or report print settings, search

for "Print Setup" then "Print Setup Command (File Menu)" using the

Microsoft Access Help menu.

Additional reference words: 2.00 Papersize Margins Saving

KBCategory:

KBSubcategory: PtrOthr


PRA: Code Called from OnFormat Creates Endless Formatting

Article ID: Q113929

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A report that calls code from its OnFormat property may never finish

formatting and may become stuck in an internal page formatting loop. This

problem may be more common in databases that have been converted from

Microsoft Access version 1.x to version 2.0.

RESOLUTION

==========

Press CTRL+BREAK to break the internal processing loop.

With the addition of two-pass formatting for reports in Microsoft Access

version 2.0, events previously called from the OnFormat property may need

to be called from the OnPrint property instead. Or, use the KeepTogether

property in the report's Sorting And Grouping dialog box to keep groups of

records together.

Note that the sample code in the "Steps to Reproduce Problem" section later

in this article is similar to the sample code in article Q100920, "How to

Avoid Abandoned Group Headers in Reports."

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem, and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. Open the sample database NWIND.MDB.

 2. Create a new, blank report based on the Catalog query.

 3. From the View menu, choose Sorting And Grouping.

 4. In the first Field/Expression row, select Category Name. Set the

    GroupHeader property to Yes.

 5. In the next Field/Expression row, select Product Name.

 6. Close the Sorting And Grouping dialog box.

 7. Drag the Product Name field from the field list to the detail section

    of the report. Set the height of the detail section to 0.25 inches.

 8. Drag the Category Name field from the field list to the Category Name

    header section. Set the height of the header section to 0.5 inches.

 9. Set the Category Name header section's OnFormat property to the

    following event procedure:

       Sub GroupHeader3_Format (Cancel As Integer, FormatCount As Integer)

         If Me.Top > 4.75 * 1440 Then

           Me.MoveLayout = True

           Me.NextRecord = False

           Me.PrintSection = False

         End If

       End Sub

    NOTE: To create this event procedure, click in the OnFormat property

    field, then choose the Build button. In the Choose Builder dialog

    box, select Code Builder. Enter the code in the module, and then

    close the module.

10. Preview the report.

11. Press CTRL+BREAK to break out of the endless formatting loop.

Additional reference words: 2.00

KBCategory:

KBSubcategory: RptProp


PRA: Converted Database Shows Incorrect Macro Definitions

Article ID: Q116060

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you convert a Microsoft Access version 1.x database to version 2.0,

macros that contain the DoMenuItem action will not show the correct action

arguments when you print the macro definitions using the Print Definition

command from the File menu.

RESOLUTION

==========

Open each affected macro in Design view and then choose Save As from the

File menu. Choose OK without changing the macro name. Print the macro

definition again.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. In Microsoft Access version 1.x, create a database called TEST_MAC.MDB.

   Create a new macro with the following action, and then save the macro as

   Replace:

      DoMenuItem

         Menu Bar: Form

         Menu Name: Edit

         Command: Replace

2. Quit Microsoft Access 1.x and start Microsoft Access version 2.0. From

   the File menu, choose Convert Database. Convert the database that you

   created in Step 1 to version 2.0 format. Name the converted database

   TEST_MA2.MDB.

3. Open TEST_MA2.MDB. In the Database window, select the Replace macro.

   Then, choose Print Definition from the File menu. Note that the report

   shows the Find command instead of the Replace command.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Appendix C,

"Conversion Issues and New Features for Access Basic"

Additional reference words: 2.00

KBCategory:

KBSubcategory: McrOthr


PRA: Datasheet Header and Footer Print at Constant Locations

Article ID: Q113353

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The default top and bottom margin for table and query Datasheet views is 1

inch. Decreasing these margins will not move the location of the title and

date header, or of the page number footer. Instead, the header and footer

will be overwritten by the column data when you print or preview the data.

CAUSE

=====

By default, the title and date header is placed at a constant of 0.5 inches

from the top of the page. The page number footer is placed at 0.5 inches

from the bottom of the page.

RESOLUTION

==========

Create a form or report, instead of using a table or query's Datasheet

view, if you want to decrease the default top and bottom margins.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem, and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Open the Customers table in Datasheet view.

3. Preview the table.

4. From the File menu, choose Print Setup. Change the top and bottom

   margins to 0.25 inches, and then choose OK.

Additional reference words: 2.00 title, page header, page footer

KBCategory:

KBSubcategory: PtrOthr


PRA: Device Independent Bitmap in Paste Special Dialog Twice

Article ID: Q114550

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The Paste Special dialog box displays the following two choices for Device

Independent Bitmap (DIB)

   Picture (Device Independent Bitmap)

   Device Independent Bitmap

when you choose Paste Special from the Edit menu after copying a picture to

the Clipboard. These two choices are actually the same.

CAUSE

=====

When you copy a Picture object to the Clipboard, Microsoft Access places

Picture (Device Independent Bitmap) on the Clipboard, and then OLE code

also places a Picture object on the Clipboard. Note that using the Paste

Special command in other applications such as Microsoft Excel or Microsoft

Word for Windows may give similar results, or additional combinations of

the object.

RESOLUTION

==========

Choosing either of the two choices will result in the same action. No extra

memory is used to store extra objects--all the items in the list point to

the same object.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. Microsoft is researching this problem and will post new information

here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open a new form in Design view.

2. From the Edit menu, choose Insert Object.

3. Select the Create From File option button.

4. Choose the Browse button.

5. Select any .BMP file from the Windows directory, and then choose

   OK.

6. Choose OK.

7. From the Edit menu, choose Paintbrush Picture Object, then choose

   Change To Picture.

8. From the Edit menu, choose Copy.

9. From the Edit menu, choose Paste Special. Note the first two choices

   in the As box.

REFERENCES

==========

For more information about the Object command, search for "Paintbrush

Picture Object" then "Object Command (Edit Menu)" using the Microsoft

Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IntpOle


PRA: Empty Recordset Report Hangs with Group KeepTogether

Article ID: Q114549

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access stops while you are previewing a report, and may mark

the database as corrupt. Running Repair Database on the database will

eliminate the error message that says that the database is corrupt.

CAUSE

=====

Microsoft Access can stop unexpectedly while you are previewing a report if

the report is based on an empty recordset and the group KeepTogether

property is set to With First Detail or to Whole Group.

This is a known problem with "retreating" in Microsoft Access version 2.0

reports. Retreating refers to returning to a earlier report section in

order to determine where certain controls and sections are on a report, and

whether they will fit in a given space. Examples of when retreating is used

include:

 - Where group levels (except for page headers and footers) are used, and

   the KeepTogether property is set to either Whole Group or With First

   Detail.

 - In subreports or subforms where the CanGrow or CanShrink property is

   set to Yes.

In these situations, the Format event occurs as Microsoft Access determines

how the sections will fit on the printed page. If a section cannot be

printed on the current page, Microsoft Access retreats so that the section

can be printed on the following page.

RESOLUTION

==========

To avoid this problem, test the report's underlying recordset to see if

data is returned. If no data is returned, use the CancelEvent action to

stop the report from processing. Two methods for avoiding the problem are

described below.

Method 1

--------

Use this method when the report is based directly on a table or on a query

that is not parameterized.

Call the following Sub procedure from the report's OnOpen property:

   Sub Report Open (cancel As Integer)

       If IsNull(DLookup("<AnyFieldInQuery>","<QueryName>")) Then

         DoCmd CancelEvent

   End Sub

Method 2

--------

Use this method if the report is based on a parameterized query. The query

must be open, with the parameter values filled in, before the number of

records in the recordset can be referenced.

Use the following sample code to cancel the report if the recordset is

empty. This sample code references two date parameters. The key is to have

the parameters filled in with values.

   Sub Report_Open (Cancel As Integer)

      Dim MyDb As Database, MyQuery As QueryDef, DataRecs As Recordset

      Set MyDb = DBEngine.Workspaces(0).Databases(0)

      Set MyQuery = MyDb.QueryDefs("QueryName")

      MyQuery("Beginning Date:") = #1/1/96# ' or Forms!FormName![Control]

      MyQuery("Ending Date:") = #1/3/96#    ' or Forms!FormName![Control]

      Set DataRecs = MyQuery.OpenRecordset()

      If DataRecs.EOF Then DoCmd CancelEvent

      DataRecs.Close

      MyQuery.Close

   End Sub

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

WARNING: Following these steps will cause Microsoft Access to stop. Make

sure to save any open work before following these steps.

 1. Open the sample database NWIND.MDB.

 2. In the Database window, select the Orders table, and then choose the

    AutoReport button on the toolbar.

 3. View the new report in Design view.

 4. Choose the Sorting And Grouping button on the toolbar.

 5. Set the following group properties:

       Customer ID

          GroupHeader: Yes

          KeepTogether: With First Detail

       Order ID

          GroupHeader: Yes

          KeepTogether: With First Detail

       Order Date

          Ascending sort only

 6. Set the height for the Customer ID header section and the Order ID

    header section to zero.

 7. Save the report as A Test Report.

 8. Create a new macro with the OpenReport action and the following

    arguments:

        Report Name: A Test Report

        View: Print Preview

        Where: [Order Id] = 222

 9. Save the macro as A Test Macro and then run it. The report will begin

    formatting, but will never finish. Microsoft Access will stop.

10. Close Microsoft Access and restart Microsoft Windows.

11. Start Microsoft Access and open the NWIND database. If you receive the

    prompt

       NWIND.MDB is corrupted or is not a database file. Attempt to

       repair?

    choose Yes.

12. To avoid the problem in this example, add the following code to the

    report's OnOpen property:

    Sub Report Open (cancel As Integer)

       If IsNull(DLookup("[Order Id]","Orders", "[Order Id] = 222")) Then

       DoCmd CancelEvent

    End Sub

REFERENCES

==========

For more information about the Retreat event, search for "Retreat" then

"Retreat Event" using the Microsoft Access Help menu.

Additional reference words: 2.00 hang

KBCategory:

KBSubcategory: RptSort


PRA: ERR: Undefined Function Referencing Column Property

Article ID: Q101673

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to run macro actions that contain a "Where" clause

(ApplyFilter, OpenForm, OpenReport, and FindRecord), and queries that

reference the Column property of a combo box on a form, the following

error message is displayed:

   Undefined Function "[Forms]![Formname]![Controlname].column" in

   Expression.

CAUSE

=====

Microsoft Access interprets any text followed by opening and closing

parentheses as a user-defined function.

RESOLUTION

==========

Create an unbound text box on the form that references the Column

property of the combo box. Reference this text box in your query.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

NOTE: This problem occurs only when you are attempting to reference a

column other than the bound column of the combo box. If you want to

reference the bound column of the combo box, just use the control name

of the combo box.

Steps to Reproduce Problem

--------------------------

1. Using the sample database NWIND.MDB, create a new form based on the

   Orders table.

2. Add a combo box control with the following properties:

      Form: PromptForm

         Record Source: Orders

      Combo Box Control: TheCombo

         ControlSource: OrderID

         RowSource: Orders

         ColumnCount: 4

         BoundColumn: 1

3. Create the following query based on the Employees table:

      Query: ReferenceCombo

      ---------------------

      Type: Select Query

      Field: Employee ID

         Table: Employees

         Criteria: =[Forms]![PromptForm]![TheCombo].column(2)

      Field: Last Name

         Table: Employees

      Field: First Name

         Table: Employees

4. Open the form PromptForm in Form view and select an Order ID record

   from the combo box.

5. Open the query ReferenceCombo in Datasheet view. You will receive

   the following error message:

      Undefined Function "[Forms]![PromptForm]![TheCombo].column" in

      Expression.

To work around this problem, use the following four steps:

1. Open the form PromptForm in Design view.

2. Add the following unbound text box control:

      Text Box Control: TheTextbox

         ControlSource: =TheCombo.column(2)

         Visible: No

3. Open the Query in Design view.

4. Change the criteria for the field [Employee ID] to the following:

      [Forms]![PromptForm]![TheTextbox]

The query will now correctly reference the text box control, which

references the Column property of the combo box.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryParm


PRA: Error "Setup Cannot Create SYSTEM.MDA File (-1809)"

Article ID: Q115066

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are running Microsoft Access Setup, after the last disk has

loaded, Setup has updated your system, and the Program Manager icons have

been created, you get the error message:

   Setup couldn't create a SYSTEM.MDA file. After Setup is completed,

   reboot your computer, then run the Workgroup Administrator before

   you run this application. (-1809)

CAUSE

=====

This error occurs when a file-sharing utility has not been loaded prior to

running Setup.

Setup uses a program called the Workgroup Administrator (WRKGADM.EXE) to

create the SYSTEM.MDA file. The Workgroup Administrator requires a file-

sharing utility such as SHARE.EXE or VSHARE.386 (the virtual device driver

file-sharing utility used in Windows 386 enhanced mode) to work correctly.

RESOLUTION

==========

To solve this problem, follow these steps:

1. After Setup completes, quit Microsoft Windows.

2. If you run Windows version 3.1 in standard mode, make sure that

   SHARE.EXE is loaded in your AUTOEXEC.BAT or CONFIG.SYS file, or load

   it at the MS-DOS command prompt.

3. If you run Windows version 3.1 or Windows for Workgroups version 3.1x

   in 386 enhanced mode, make sure that VSHARE.386 is loaded in the

   [386Enh] section of your SYSTEM.INI file.

4. Start Microsoft Windows.

5. Start the Workgroup Administrator by double-clicking the MS Access

   Workgroup Administrator icon, and then create a new SYSTEM.MDA file.

6. Start Microsoft Access.

Microsoft Access must have a valid SYSTEM.MDA file to work correctly. If

you try to start Microsoft Access before you create the SYSTEM.MDA file,

you will receive the error message:

   Couldn't find file 'C:\ACCESS\system.mda'.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

Additional reference words: 2.00 setup installing admin

KBCategory:

KBSubcategory: StpOthr


PRA: Error Adding Zero-Length String to SQL NOT NULL Column

Article ID: Q117614

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attach a SQL Server table that was created with a NOT NULL

restriction on a column, then try to enter a zero-length string in the

table, you receive the error message:

   [Microsoft][ODBC SQL Server Driver][SQL Server] The column <column

   name> in table <table name> may not be null. (#233)

CAUSE

=====

Microsoft Access supports zero-length strings, but SQL Server does not. The

SQL ODBC driver does not convert the zero-length string to a value that can

be used by SQL Server, so SQL Server interprets the zero-length string as a

null value and returns the error message.

RESOLUTION

==========

Either remove the NOT NULL restriction on the SQL Server column, or send

some character other than a zero-length string to the SQL Server column.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a table on SQL Server with a column with a NOT NULL restriction.

2. Start Microsoft Access and open any database.

3. Attach the SQL Server table you created in step 1.

4. Enter a zero-length string in the table. You will receive the error

   message stated above.

REFERENCES

==========

For more information about zero-length strings, search for "zero-length

strings" then "Working with Nulls and Zero-Length Strings" using the

Microsoft Access Help menu.

Additional reference words: 2.00 inserting attaching errmsg

KBCategory:

KBSubcategory: ObcSqlms


PRA: Error Deleting Value from Attached SQL Server Table

Article ID: Q117616

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attach an SQL Server table that has a column with a NOT NULL

restriction to Microsoft Access, add a value to the restricted column in

the attached table, then delete the value and attempt to commit the record,

you receive the error message:

   [Microsoft][ODBC SQL Server Driver][SQL Server] The column <column

   name> in table <table name> may not be null. (#233)

CAUSE

=====

When the value is deleted, Microsoft Access first attempts to write a null

to the restricted column in the attached table. This results in an internal

error from SQL Server, so Microsoft Access then attempts to write a zero-

length string. Since SQL Server does not recognize zero-length strings, it

treats the string as a null, resulting in the error message.

RESOLUTION

==========

Do not enter zero-length strings in SQL columns with the NOT NULL

restriction.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a table on SQL Server with a column with the NOT NULL

   restriction.

2. Start Microsoft Access and open any database.

3. Attach the table that you created in step 1.

4. Enter a value in the column with the NOT NULL restriction.

5. Move to the next column.

6. Move back to the previous column, select the value, then delete it.

7. Commit the record by moving to another record. You will receive the

   error message stated above.

REFERENCES

==========

For more information about using zero-length strings, search for "zero-

length strings" then "Working with Nulls and Zero-Length Strings" using the

Microsoft Access Help menu.

For additional information about zero-length strings and SQL Server,

please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q117614

   TITLE     : Error Adding Zero-Length String to SQL NOT NULL Column

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: ObcSqlms


PRA: Error In SQL Pass-Through Action Query Not Detected

Article ID: Q115897

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When an error occurs while you are performing a SQL pass-through action

query on a remote SQL server, the error is not reported to Microsoft

Access.

CAUSE

=====

Microsoft Access does not detect errors that occur while performing data-

definition queries.

RESOLUTION

==========

Avoid using data-definition queries with remote SQL servers. Instead,

perform these functions (DROP TABLE, CREATE TABLE, and so on) from the

Admin utility included with SQL Server.

If you use DB_FAILONERROR as an option for action queries, errors will be

detected.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

Steps to Reproduce Problem

--------------------------

This example attempts to delete a nonexistent table from a SQL Server

database. Use your own database information in the "Set db = DBEngine(0)"

line in this example.

1. Start Microsoft Access and open any database.

2. Create a new module.

3. Enter the following function in the module.

   NOTE: In the following sample code, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this code in Access Basic.

      Function test ()

         On Error GoTo Handler

         Dim db As Database, qd As QueryDef

         Set db = DBEngine(0).OpenDatabase("", False, False, _

         "ODBC;DSN=dabusql;UID=sa;PWD=;DATABASE=mult;")

         Set qd = db.CreateQueryDef("")

         qd.SQL = "DROP TABLE tsint2222"  ' Nonexistent table

         qd.Execute                       ' Error expected here

         MsgBox "DONE", 0

         Exit Function

      Handler:

         MsgBox Error$

         Exit Function

      End Function

4. From the View menu, choose Immediate Window.

5. Type the following in the Immediate window, and then press ENTER:

      ? Test()

Note that you do not receive any error message.

Additional reference words: 2.00 dao programming queries

KBCategory:

KBSubcategory: ObcSqlms


PRA: Error Previewing Subreports that Call Filter Macro

Article ID: Q103131

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to print a form or report containing a subreport/subform

that calls a macro that in turn executes an ApplyFilter action, then you

call that macro from the OnOpen property of the subreport/subform, the

following error message is displayed:

   Action isn't valid because the form or report isn't bound to a

   table or query.

Even if you do not receive this error message, note that the ApplyFilter

action has not been executed. Currently, this functionality is not

available.

CAUSE

=====

When printing, Microsoft Access erroneously attempts to apply the

filter that is run from the macro to the outermost (main) report/form,

rather than to the subreport/subform.

The error occurs because the main report/form does not contain a

RecordSource to perform the ApplyFilter action against.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1 and 2.0. Microsoft is researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new macro that executes an ApplyFilter action. Enter

   criteria such as the following for the Where condition:

      [Last Name]="Fuller"

3. Create a new, blank, unbound report.

4. Drag the Employee Sales Subreport from the Database window to

   create a subreport on the new report.

5. Double-click the subreport to edit it. For the OnOpen property of

   the subreport, select the macro you created in step 2 from the

   combo box.

6. Preview the report. The following error message appears:

      Action isn't valid because the form or report isn't bound

      to a table or query.

7. Change the RecordSource property of the main report to point to the

   Employees table.

8. Preview the report. Note that the error message no longer appears,

   however, neither the subreport nor the main report have been filtered.

Additional reference words: 1.00 1.10 2.00 Subreports Reports Subforms

KBCategory:

KBSubcategory:  RptSub


PRA: Error When Import dBASE, FoxPro, or Paradox Table

Article ID: Q95327

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you import a dBASE, FoxPro, or Paradox table in Microsoft Access

version 1.x, or a Paradox table in Microsoft Access version 2.0, without

including the file extension, you receive the following error message:

   Couldn't find object '<filename>'

RESOLUTION

==========

Rename the file so that it has an extension. It does not have to have

the correct extension, such as .DBF for a dBASE table, but it must have

some sort of extension.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0

for dBase and FoxPro, but does still occur for Paradox. We are researching

this problem and will post new information here in the Microsoft Knowledge

Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Rename a dBASE, Paradox, or FoxPro file so that it has no

   extension. For example, rename CUSTOMER.DBF to CUSTOMER.

2. Open a Microsoft Access 1.x database.

3. From the File menu, choose Import.

4. In the Import dialog box, select the appropriate data source. For

   example, select dBASE III or IV to import a dBASE file.

5. Under List Files of Type, select All Files (*.*).

6. Locate and select the import file created in step 1 without an

   extension.

7. Choose the Import button.

You will see the following error message:

   Couldn't find object '<filename>'.

Additional reference words: 1.00 1.10 2.00 ErrMsg

KBCategory:

KBSubcategory: ObcOthr


PRA: Extra White Space Between Last Section and Report Footer

Article ID: Q116061

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Extra white space is printed on your report after the last detail record or

section of the report, before the report footer section prints. The extra

white space is as tall as the detail section height. Note that this problem

occurs only with reports that have a report footer section.

This problem can occur with reports created in Microsoft Access version

2.0, and with reports created in Microsoft Access version 1.x that you are

using in version 2.0.

RESOLUTION

==========

Change the report to have a vertical layout by following these steps:

1. Open the report in Design view. From the File menu, choose Print Setup.

   Choose the More button.

2. In the Items Across box, enter "2" (without quotation marks).

3. In the Item Layout area, select the Vertical option button.

4. In the Items Across box, enter "1" (without quotation marks).

5. Choose OK.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Open the Alphabetical List Of Products report in Design view.

3. Increase the height of the report footer section to 1 inch.

4. Set the report footer section's BackColor property to 16711680 (blue).

5. Set the Product Name footer section's BackColor property to 255 (red).

   (NOTE: Changing the sections' colors helps to illustrate the problem.)

6. Preview the report. Note the extra white space between the Product Name

   footer (red) and the report footer (blue).

7. Close the report without saving the changes.

Additional reference words: 2.00 line spacing whitespace canshrink blank

KBCategory:

KBSubcategory: RptLayou


PRA: Find Does Not Locate Existing Item in dBASE Database

Article ID: Q116144

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you search for a string in an attached dBASE database, the string is

not found, even though the string does exist in the dBASE database.

CAUSE

=====

This problem only occurs if you search for the string in the attached

database using the wrong case and without selecting the Match Case check

box first.

RESOLUTION

==========

In the Find dialog box, select and then clear the Match Case check box

before choosing either of the Find buttons.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open any database.

2. From the File menu, choose Attach. In the Data Source box, select dBASE

   IV, then choose OK. In the File Name box, select the dBASE IV database

   file NEWCUST.DBF, then choose Attach. (The NEWCUST.DBF file is usually

   located in the SAMPAPPS subdirectory.) In the Select Index Files dialog

   box, choose Close. Choose OK when you get a message stating

   "Successfully attached 'NEWCUST'. Choose Close.

3. Open the NEWCUST table in Datasheet view.

4. Select the CITY column.

5. From the Edit menu, choose Find.

6. In the Find What box, type "portland" (without quotation marks) and then

   choose Find First. Note that no string is found.

7. Select the Match Case check box and then choose Find First. Note that no

   string is found.

8. Clear the Match Case check box and choose Find First. Note that the

   first "Portland" text string is found.

dBASE IV is manufactured by Borland International, Inc., a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

Additional reference words: 2.00 lowercase

KBCategory:

KBSubcategory: IsmOthr


PRA: GP Fault with MS Packager Object in Bound OLE Field

Article ID: Q101322

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A general protection (GP) fault may occur when you attempt to insert

or update Microsoft Packager objects in a bound OLE field in Microsoft

Access.

CAUSE

=====

During the cleanup process when you quit Microsoft Packager, the

program inappropriately frees memory blocks that it does not own. This

memory block, which is still being used by OLE, is made available to

other applications.

If another application begins using this memory block, OLE and the

other application may write information to the same memory location,

overwriting each other's information. This conflict may eventually

result in a GP fault.

RESOLUTION

==========

A corrected version of Microsoft Packager has been created to work

around this problem. This patch, PACKPT.EXE, is a self-extracting

zipped file and is available both in the Microsoft Access section of

the Microsoft Download Service (MSDL) and in the OLE/DDE section of

the Microsoft Access forum on CompuServe.

You can reach the MSDL by calling (206) 936-6735. You can reach the

Microsoft Access forum on CompuServe by typing "go msaccess" from any

CompuServe exclamation point (!) prompt.

NOTE: To install PACKPT.EXE, copy this file to a new directory and

run PACKPT.EXE at the DOS command prompt. The files README.TXT and

PACKAGER.EXE are extracted automatically. PACKAGER.EXE should be

copied to your Windows directory.

WARNING: MICROSOFT PROVIDES THIS PATCH "AS IS" WITHOUT WARRANTY OF ANY

KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE

IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR

PURPOSE. The user assumes the entire risk as to the accuracy and use

of this information.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Packager. We

are researching this problem and will post new information here in the

Microsoft Knowledge Base as it becomes available.

Additional reference words: 1.00 1.10 2.00 patch Packager GPF

KBCategory:

KBSubcategory: IntpOle


PRA: GPF Closing Data Outline Control Properties Box

Article ID: Q117610

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you add a data outline control to a form or report, then edit the

control's properties, the Properties dialog box is normally modal, meaning

that you cannot select anything outside the dialog box.

If, however, you click the property sheet for the form or report containing

the data outline control, the property sheet gets the focus, and the

modality of the data outline control's Properties dialog box is lost. You

can then select anything in the database.

When the modality of the control's Properties dialog box is broken as

outlined above, your mouse pointer may disappear, and you may receive a

general protection (GP) fault.

CAUSE

=====

The GP fault and disappearing mouse pointer problem occurs only if you

close a form while "orphan" windows are still open. These orphan windows

are data outline control windows such as the Properties dialog box, or the

Edit Control window.

This problem occurs because there is no way for a non-in-place active OLE

server application (such as the data outline control) to instruct its

container (in this case, Microsoft Access) to disable modeless dialog boxes

when opening a modal dialog box on the container's behalf.

RESOLUTION

==========

Avoid closing the form or report's Properties dialog box while you are

editing the data outline control.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

WARNING: Following these steps will cause a GP fault. You should save and

close any open work on your computer before following these steps.

 1. Start Microsoft Access and open any database.

 2. Create a new, blank form.

 3. Open the form's property sheet.

 4. Place an unbound OLE control on the form.

 5. In the Insert Object dialog box, select the Insert Control option

    button.

 6. In the Control Type box, select Data Outline Control, then choose OK.

 7. Click the right mouse button in the data outline control, choose Data

    Outline Control Object, then choose Properties.

 8. Click anywhere outside the Properties dialog box (except in the form's

    property sheet). Note that since the Properties dialog box is modal,

    you cannot select anything outside it.

 9. Click the form's property sheet to select it, then select Event

    Properties in the property sheet.

10. Select the OnEnter property, then choose the Build button at the right

    side of the property field. Select Code Builder, then choose OK. The

    form module will open behind the Properties dialog box.

11. From the File menu, choose Exit. If you are prompted to save your

    changes, choose No. A GP fault will result.

REFERENCES

==========

For more information about OLE custom controls, search for "OLE custom

controls" then "Insert Object Command (Edit Menu)" using the Microsoft

Access Help menu.

Additional reference words: 2.00 gpf errmsg

KBCategory:

KBSubcategory: WzOthr


PRA: GPF Using GetChunk Method as Argument for Put Statement

Article ID: Q117611

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you use the GetChunk method in the third parameter of a Put statement,

you get a general protection (GP) fault.

CAUSE

=====

The third parameter of the Put statement requires a variable name. You

cannot directly use a method (such as the GetChunk method) as a statement

argument.

RESOLUTION

==========

Create an intermediate variable, assign the value returned from the

GetChunk method to this variable, then use the variable as the third

parameter of the Put statement. This technique is demonstrated in the

"Workaround" section later in this article.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

WARNING: Following these steps will cause a GP fault. Save and then close

any open work on your computer before following these steps.

1. Start Microsoft Access and open any database.

2. Create a new module and enter the following function:

      Function Test ()

         Dim d As Database, rs As Recordset

         Set d = dbengine(0)(0)

         Set rs = d.OpenRecordset("employees", DB_OPEN_TABLE)

         Open rs![Last Name] & ".txt" For Binary As #1

         Put #1, , rs![Notes].GetChunk(0, 1000)

         Close #1

         rs.Close

         d.Close

      End Function

3. From the View menu, choose Immediate window.

4. Type the following line in the Immediate window, then press ENTER:

      Test()

   A GP fault will result.

Workaround

----------

The following sample function is a modified version of the Test() function

above. This version of the Test() function will generate a text file with a

portion of the Notes memo field from the first record of the Employees

table. The name of the text file is determined by the first eight

characters of the Last Name field. Note that in this version, the Put

statement uses the variable X for the third parameter, which is set equal

to the GetChunk method.

   Function test ()

         Dim d As Database, rs As Recordset

         Dim x As String

         Set d = dbengine(0)(0)

         Set rs = d.OpenRecordset("employees", DB_OPEN_TABLE)

         Open rs![Last Name] & ".txt" For Binary As #1

         x = rs![Notes].GetChunk(0, 1000)

         Put #1, , x

         Close #1

         rs.Close

         d.Close

   End Function

REFERENCES

==========

For more information about the Put statement, search for "Put" then "Put

Statement" using the Microsoft Access Help menu.

Additional reference words: 2.00 gpf errmsg

KBCategory:

KBSubcategory: IntpOle


PRA: GPF Using List Box Fill Function with Requery Method

Article ID: Q117615

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you fill a list box using an Access Basic function, and the function

returns a static variable upon receiving the close code (8), and you then

use the Requery method to requery the list box, you receive a general

protection (GP) fault.

CAUSE

=====

The temporary string created by the list box fill function is not freed,

and conflicts with another variable used internally by Microsoft Access.

RESOLUTION

==========

Use one of the following techniques to work around this problem:

 - Use a Requery action instead of the Requery method for requerying the

   list box.

 - Do not return a static string when your function exits through the close

   code (8). That is, dimension the variable to make it dynamic, rather

   than declaring it static.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

WARNING: Following these steps will result in a GP fault. Save and then

close any open work on your computer before following these steps.

NOTE: In the following example, an underscore (_) at the end of a line is

used as a line-continuation character. Remove the underscore from the end

of the line when re-creating this example.

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new, blank form.

3. Click the Code button on the toolbar, or choose Code from the View

   menu, and then enter the following code in the form module:

      Option Compare Database   'Use database order for string _

                                 comparisons.

      Dim iTotTables As Integer

      Dim My_CurrDB As Database

      Dim TableList2() As String

      Dim iTotFlds As Integer

      Dim FieldList() As wlib_FldInfo

      Function FillTables (fld As Control, handle As Long, lRow As _

      Long, lCol As Long, iMsg As Integer) As Variant

         Static returnval As Variant

         ' If you change the above line to the following the error

         ' will not occur:

         ' Dim returnval As Variant

         Select Case iMsg

            Case LB_INITIALIZE

               returnval = -1&

            Case LB_OPEN

               returnval = Timer

            Case LB_GETROWCOUNT

               returnval = iTotTables

            Case LB_GETCOLUMNCOUNT

               returnval = 1

            Case LB_GETCOLUMNWIDTH

               returnval = -1&

            Case LB_GETVALUE

               returnval = TableList2(lRow + 1)

            Case LB_GETFORMAT

            Case LB_CLOSE

            Case LB_END

          End Select

          FillTables = returnval

       End Function

4. Add the following command button and list box to the form:

      Command button:

         Name: Button0

         Caption: Requery Table List

      List box:

         Name: Field1

         RowSourceType: FillTables

5. Set the command button's OnClick property to the following event

   procedure:

      Sub Button0_Click ()

         Set My_CurrDB = DBEngine.Workspaces(0).Databases(0)

         iTotTables = wlib_GetObjList(My_CurrDB, A_TABLE, TableList2(),_

          False, &HFFFFFFFF)

         Me!Field1.Requery

      End Sub

6. View the form in Form view.

7. Click the Requery Table List button 8 or more times. You will receive

   the error message:

      General Protection Fault in MSABC200.DLL at 000B:07E1

REFERENCES

==========

For more information about using Access Basic code to fill a list box,

search for "filling list boxes/combo boxes" then "Filling a List Box or

Combo Box Using an Access Basic Function" using the Microsoft Access Help

menu.

Additional reference words: 2.00 programming gpf errmsg

KBCategory:

KBSubcategory: PgmOthr


PRA: Graph 5.0 Legend Moves Each Time Graph Is Refreshed

Article ID: Q117613

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Graph version 5.0

---------------------------------------------------------------------

SYMPTOMS

========

Each time a Microsoft Graph 5.0 object is refreshed, the legend moves

to a new location.

RESOLUTION

==========

Although you cannot prevent the legend from moving when the graph is

refreshed, you can use OLE Automation to reset the legend's position. See

the "Workaround" section later in this article for an example of this

technique.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Graph version

5.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

A graph in a Microsoft Access form or report is refreshed when any of the

following occurs:

 - If the graph is linked to the data in the form or report, the graph is

   refreshed each time a new record is displayed.

 - When you press F9.

 - When the form containing the graph is refreshed by Access Basic code or

   the Refresh macro action.

Steps to Reproduce Problem

--------------------------

 1. Open the sample database NWIND.MDB.

 2. Open the form Sales By Product in Design view.

 3. Double-click the graph object to open it in Microsoft Graph 5.0.

 4. From the Insert menu, choose Legend.

 5. With the legend selected, choose Selected Legend from the Format menu.

    Click the Placement tab, then choose the Bottom option button. Choose

    OK.

 6. Quit Graph to return to Microsoft Access.

 7. View the form in Form view.

 8. Click a record selector button at the bottom of the form to move to

    another record. Note that the legend moves up the graph when the graph

    is refreshed. As you move through the records, the legend moves further

    up the graph.

Workaround

----------

This example continues the example started in the "Steps to Reproduce

Problem" section of this article. After completing the steps in that

section, follow these steps to use OLE Automation to reset the legend to

the bottom of the graph each time the graph is refreshed:

 9. View the form in Design view.

10. Select the graph object and display the property sheet. Select the

    OnUpdated property and then click the Build button to the right of the

    property. Select Code Builder and then choose OK.

11. Enter the following line in the module:

       Me!Embedded13.Object.Legend.Top = 171

    NOTE: The value 171 was obtained by opening the Sales By Product form

    in Design view, opening the form module, and then entering the

    following line in the Immediate window:

       ?Forms![Sales By Product]!Embedded13.Object.Legend.Top

12. From the Run menu, choose Compile Loaded Modules, then close the

    module.

13. Save and then close the form.

14. Open the form in Form view and move through the records. Note that the

    legend remains at the bottom of the graph.

To use this workaround in a report, specify the code in step 11 in the

OnFormat property setting of the report section that contains the graph.

REFERENCES

==========

For more information about using OLE Automation, see Chapter 13 of the

Microsoft Access version 2.0 "Building Applications" manual.

The properties, methods, and objects supported by Microsoft Graph version

5.0 are documented in a Help file called VBA_GRP.HLP. This file is

available in the ADT/ADK section of the MSACCESS forum on CompuServe.

Additional reference words: 2.00 Chart Example

KBCategory:

KBSubcategory: IntpGrph


PRA: Help Topic "Converting Code" Sample Code Incorrect

Article ID: Q114732

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The sample code for running a pass-through query in the Microsoft Access

version 2.0 Help system topic "Examples of Converting Code to Version 2.0"

is not correct. If you run this code, you will receive one of the following

error messages:

   Object variable not set or Name not found in this collection

    -or-

   Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE',

   'SELECT', or 'UPDATE'

RESOLUTION

==========

The incorrect sample code is as follows:

   ' Given open Database object MyDB.

   Dim Q As QueryDef

   Set Q = MyDB.CreateQueryDef("MYODBCQuery")

   Q.SQL = "Exec My_Stored_Procedure"

   Q.Connect = "ODBC; DSN=MyServer; UID=sa; PWD=hithere; DATABASE=pubs"

   Q.ReturnsRows = True

   Dim R As Recordset

   Set R = Q.OpenRecordset()

To correct the code, make the following two changes:

1. Change the line that reads

      Q.ReturnsRows = True

   to be:

      Q.ReturnsRecords = True

   The correct name for the property is ReturnsRecords.

2. Move the line that reads

      Q.SQL = "Exec My_Stored_Procedure"

   so that it is directly beneath the line that reads:

      Q.Connect = "ODBC; DSN=MyServer;..."

   The syntax "Exec My_Stored_Procedure" is only valid in a pass-through

   query. Setting the connect property changes the new query from a select

   query to a pass-through query.

The corrected code should be as follows:

   ' Given open Database object MyDB.

   Dim Q As QueryDef

   Set Q = MyDB.CreateQueryDef("MYODBCQuery")

   Q.Connect = "ODBC; DSN=MyServer; UID=sa; PWD=hithere; DATABASE=pubs"

   Q.SQL = "Exec My_Stored_Procedure"

   Q.ReturnsRecords = True

   Dim R As Recordset

   Set R = Q.OpenRecordset()

REFERENCES

==========

For more examples of converting code to version 2.0, search for "converting

code" then "Examples of Converting Code to Version 2.0" using the Microsoft

Access Help menu.

Additional reference words: 2.00 docerr documentation

KBCategory:

KBSubcategory: DcmOthr


PRA: Installing MS Access with NT Creates New Program Group

Article ID: Q117169

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Windows NT version 3.1

---------------------------------------------------------------------

SYMPTOMS

========

When you install Microsoft Access version 2.0 on a computer running

Microsoft Windows NT version 3.1, and you choose to install the Microsoft

Access icons in an existing common group such as Applications (Common),

Microsoft Access Setup creates a new group called Applications

(Common)(Common) and places the Microsoft Access icons in this group,

instead of in the group you chose.

CAUSE

=====

This behavior is caused by a problem in Microsoft Windows NT version 3.1.

RESOLUTION

==========

After Microsoft Access Setup finishes, move the Microsoft Access icons to

the correct group and delete the new group.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Windows NT

version 3.1. We are researching this problem and will post new information

here in the Microsoft Knowledge Base as it becomes available.

Additional reference words: 2.00 installing

KBCategory:

KBSubcategory: StpOthr


PRA: Mailing Label Wizard Creates One-Page Report

Article ID: Q115124

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A mailing label report created with the Mailing Label Wizard contains only

one page, no matter how many records are in the underlying table or query.

This problem occurs if your default printer is a laser printer, and you

are using any of the following Avery mailing labels:

   4145, 4162, 4163, 4249, 4250, 4251, 4253, 4254, or 5615

If your default printer is a dot-matrix printer, most mailing label reports

using one-up continuous labels will contain only one page.

CAUSE

=====

This problem occurs if you use the Row Spacing setting in the Print Setup

dialog box to reserve the space between each record or label.

This problem also occurs with reports converted from Microsoft Access

version 1.x, if the Row Spacing setting is used.

RESOLUTION

==========

Change the Row Spacing setting in the Print Setup dialog box to 0. In the

mailing label report's Design view, increase the detail section's Height

property to the Row Spacing value plus the height of the detail section.

This reserves the same amount of room for each label as using the Row

Spacing setting does. If you are using a dot-matrix printer, you may need

to adjust the user-defined page size in the Control Panel's Printers

utility.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Create a new report based on the Customers table. Choose the Report

   Wizards button.

3. Select the Mailing Label Wizard, then choose OK.

4. In the Available Fields box, select Contact Name, then choose the

   ">" button. Choose Next.

5. Repeat step 4.

6. In the "What label size do you want?" box, select any of the

   following labels:

      4145, 4162, 4163, 4249, 4250, 4251, 4253, or 4254

7. Under Label Type, select the Continuous option button, and then choose

   Next.

8. Choose Next, and then choose Finish.

Note that the mailing label report that is created contains only one page.

REFERENCES

==========

For more information about creating mailing label reports, search for

"creating mailing labels" then select a topic using the Microsoft Access

Help menu.

Additional reference words: 2.00 mailing label

KBCategory:

KBSubcategory: RptLbl


PRA: Menu Bar Does Not Change When Closing Modal Pop-Up Form

Article ID: Q117541

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you open a modal pop-up form by choosing a command button on another

form, the Microsoft Access menu bar changes to show only two menus, File

and Help. When you close the modal pop-up form, the menu bar does not

change back to the standard Microsoft Access menu bar.

RESOLUTION

==========

There are two ways to work around this problem:

 - In the macro that opens the modal pop-up form, reverse the order of your

   macro actions. Instead of opening the modal pop-up form and then closing

   the form that starts the macro, first close the form from which the

   modal pop-up form is opened, and then open the modal pop-up form.

 - After you close both forms, select an object in the Database window to

   restore the menu bar.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a new form with one command button. Save the form as Form1 and

   then close it.

2. Create another new form with a label set to "Look at the menu bar now."

   Set the form's Model and PopUp properties to Yes. Save the form as Form2

   and then close it.

3. Open Form1 in Design view. Set the command button's OnClick property (or

   OnPush property, in version 1.x) to a macro called MacroX.

4. Create a new macro with the following settings:

      Macro Name   Actions

      ---------------------

      MacroX       OpenForm

                   Close

      MacroX Actions

      ---------------------

      OpenForm

         Form Name: Form2

      Close

         Object Type: Form

         Object Name: Form1

   Save the macro as MacroX and then close it.

5. View Form1 in Form view and then click the command button. Note that

   when Form2 opens, the Microsoft Access menu bar changes to show only two

   menus, File and Help.

6. Close Form2. Note that the standard Microsoft Access menu bar does not

   return.

REFERENCES

==========

For more information about dialog boxes, search for "PopUp" then "Creating

Pop-Up Forms and Dialog Boxes" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 menubar popup

KBCategory:

KBSubcategory: FmsEvnt


PRA: MS Access Setup Under MS Windows NT 3.1 Requires a Mouse

Article ID: Q116141

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are running the Microsoft Access Setup program under Microsoft

Windows NT version 3.1, you must have a mouse to choose the Typical,

Custom/Complete, Laptop, or Workstation Setup buttons. The assigned hot

keys for these buttons will not work.

RESOLUTION

==========

Use a mouse or other pointing device to choose the Setup option you want.

Note that a mouse or other pointing device is one of the requirements

listed on the Microsoft Access package.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Install Microsoft Windows NT version 3.1.

2. Install Microsoft Access version 2.0.

3. In Setup's Main dialog box, try to use one of the hot keys (T, C, L, or

   W) to choose a Setup option.

Additional reference words: 2.00

KBCategory:

KBSubcategory: StpOptio


PRA: No Serial Number In the About Microsoft Access Dialog Box

Article ID: Q114319

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

There is no serial number listed in the About Microsoft Access dialog box.

CAUSE

=====

A limited number of Microsoft Access 2.0 disks were inadvertently

manufactured without a serial number listed in the About Microsoft Access

dialog box.

RESOLUTION

==========

The serial number (also known as the Product ID number, or PID) is

contained in the product, but is not visible in the dialog box. The serial

number is only used internally by Microsoft Access, and it is not necessary

that you see or know it.

If, however, you want to find the serial number of your copy of Microsoft

Access version 2.0, follow these steps:

1. Rename the SETUP.STF file in the \SETUP subdirectory of your

   Microsoft Access program directory to SETUP.BAK.

2. Run the Setup program from your original Microsoft Access disk

   number 1.

3. Choose OK until you reach the screen that displays the Product ID

   number at the top. Write this number down, and then choose OK.

4. Choose the Exit Setup button to cancel the Setup program.

5. Rename the SETUP.BAK file back to SETUP.STF.

STATUS

======

Microsoft has confirmed this to be a problem with a limited number of

Microsoft Access version 2.0 installation disks. This problem has been

corrected.

Additional reference words: 2.00 Setup

KBCategory:

KBSubcategory: StpOthr


PRA: Null Boolean Values Default to False

Article ID: Q99945

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Null values appearing in a boolean field always default to false in

tables, forms, and reports.

CAUSE

=====

Null values are not supported in boolean fields. When a null value is

inadvertently placed in a boolean field (by a query, for example), the

null value is ignored. By default, "false" incorrectly appears in the

field.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. Open the sample database NWIND.MDB and create a new table called

    Table1. (No primary key required.)

 2. In Design view, create a field in Table1 named Test with the data

    type Text.

 3. Create another table and name it Table2. In Design view, create

    two fields:

       Name    DataType

       ----------------

       Test    Text

       Bool    Yes/No

 4. Enter the following data in Table1:

       Test

       ----

        A

        B

        C

 5. Enter the following data into Table2:

       Test     Bool

       -------------

       A        Yes

       B        No

 6. Create a make-table query using Table1 and Table2. Give the new

    table a name, such as "Bogus."

 7. Create a join between Table1 and Table2 by dragging the

    Test field from Table1 and dropping it onto Table2.

 8. Edit the join properties by double-clicking the join line or by

    selecting Join Properties from the View menu. Select relationship #2.

    This includes all records from Table1 and only those records from

    Table2 where the joined fields are equal.

 9. Drag the Test field from Table1 and the Bool field from Table2

    onto the query grid.

10. Execute the make-table query by selecting Run from the Query menu

    or by clicking the Run button on the toolbar.

A dialog box states "3 row(s) will be copied into new table."

Open the table Bogus and note its contents:

   Test    Bool

   ------------

   A       -1

   B        0

   C        0

Note that a value of zero (0) has incorrectly been placed for the

value of Bool for Test value C (0 = No, -1 = Yes). Change the Bool

field's format in Design view to view the values as True/False,

Yes/No, and so forth.

REFERENCES

==========

For more information on Boolean values, search for "Boolean" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 tables

KBCategory:

KBSubcategory: TblDsign


PRA: ODBCTimeout Ignores MSACC20.INI ODBC Setting

Article ID: Q113883

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The ODBCTimeout property in new queries defaults to 60 seconds, regardless

of the value set in the [ODBC] section of your MSACC20.INI file.

In databases converted from Microsoft Access version 1.x, the ODBCTimeout

property defaults to 0, regardless of the value set in the [ODBC] section

of your MSACC20.INI file.

RESOLUTION

==========

You can use the sample subprocedure listed below to set the ODBCTimeout

property for all the queries in your database. Note that the ODBCTimeout

property is ignored in queries that do not use attached tables.

Sample Subprocedure

-------------------

   Sub ChangeAllQueryTimeOuts (timeinterval As Integer)

      Dim db As Database, qd As QueryDef, i As Integer

      Set db = dbengine.workspaces(0).databases(0) 'Use current database.

      BeginTrans            'Start a transaction.

                            'Loop through Querydefs and change the

                            'ODBC timeout.

         For i = 0 To db.querydefs.count - 1

            Set qd = db.querydefs(i)

            qd.odbctimeout.value = timeinterval 'Set ODBC timeout.

         Next i

      CommitTrans           'Finished: commit the transaction.

      db.querydefs.Refresh  'Update the Querydefs collection.

   End Sub

How to Run the Subprocedure

---------------------------

To run the ChangeAllQueryTimeOuts subprocedure, type the following

in the module's Immediate window, and then press ENTER:

   ChangeAllQueryTimeOuts <time value>

Substitute a value, in seconds, for <time value> in the sample line above.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

The QueryTimeout setting in the [ODBC] section of the MSACC20.INI file

applies only to queries that do not have a setting for the ODBCTimeout

property. If a query's ODBCTimeout property is blank, then the QueryTimeout

setting is used.

An ODBCTimeout value of 0 means that there is no timeout. If the ODBC

server does not respond, the query will never timeout and return control.

In Microsoft Access version 1.x, The QueryTimeout and ODBCTimeout values

are set by the QueryTimeout setting in the [ODBC] section of the

MSACCESS.INI file. This value applies to all the ODBC queries run in the

current Microsoft Access session.

In Microsoft Access version 2.0, these values can differ. Each query can

have its own ODBCTimeout setting.

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open any query in Design view.

3. Set the query's ODBCTimeout property to null (that is, delete any

   existing value for the property).

4. Save and then close the query.

5. Reopen the query in Design view. Note that the ODBCTimeout property

   is set to 0.

REFERENCES

==========

For more information about the ODBCTimeout and QueryTimeout settings,

search for "ODBCTimeout" and "QueryTimeout" using the Microsoft Access Help

menu.

Additional reference words: 2.00 ODBC Attaching

KBCategory:

KBSubcategory: ObcOthr


PRA: ODBCTimeout Set to Zero for New Pass-Through Queries

Article ID: Q117537

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you create a SQL pass-through query using Access Basic, the

ODBCTimeout property setting for the query is set to zero, despite the

timeout setting you specify.

RESOLUTION

==========

When you use Access Basic to create a SQL pass-through query, set the

ODBCTimeout property after you set the Connect property for the query. If

you do not, the ODBCTimeout property will be set to zero.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

The ODBCTimeout property setting specifies the number of seconds Microsoft

Access waits before a timeout error occurs on a query involving an ODBC

database. When this property is set to zero, no timeout occurs.

Steps to Reproduce Problem

--------------------------

NOTE: This example assumes that you have an ODBC data source (such as

Microsoft SQL Server) available.

1. Open the sample database NWIND.MDB.

2. Create a new module and enter the following sample procedure:

      Sub CreateSPTQuery()

         Dim db As Database, q As QueryDef

         Set db = dbengine(0)(0)

         'Create a new QueryDef.

         Set q = db.CreateQueryDef()

         q.Name = "MySPTQuery"

         'Modify the line below to select from an existing ODBC table.

         q.SQL = "Select * From authors;"

         q.ODBCTimeout = 60

         q.Connect = "ODBC;"

         q.ReturnsRecords = True

         'Add the QueryDef to the QueryDefs collection.

         db.QueryDefs.Append q

         db.QueryDefs.Refresh

         'Print the ODBCTimeout setting to the Immediate window.

         Debug.Print db.QueryDefs("MySPTQuery").ODBCTimeout

      End Sub

3. In the Immediate window, test this procedure by typing:

      CreateSPTQuery

Microsoft Access will print a zero (0) to indicate the ODBCTimeout setting

for the query.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, pages 291-294

Additional reference words: 2.00 spt passthrough

KBCategory:

KBSubcategory: QryPass


PRA: OLE Objects Clipped Using Fahrenheit Video Driver

Article ID: Q109344

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

OLE objects inserted into a Microsoft Access form will be clipped on the

bottom and on the right side if you are using an Orchid Fahrenheit video

driver in Microsoft Windows.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

The following Orchid Fahrenheit drivers are known to cause this problem:

 - All 800 x 600 resolution drivers

 - The 1024 x 768 16 colors large font driver

Steps to Reproduce Problem

--------------------------

1. Install any of the above listed video drivers in Microsoft Windows.

2. Start Microsoft Access. Open any database.

3. Open a new form.

4. From the Edit menu, choose Insert Object.

5. Select Microsoft Graph, and then choose OK.

6. Close Microsoft Graph. Choose Yes in the Update Changes box.

Note that the chart is clipped on the bottom and on the right side.

Additional reference words: 1.00 1.10 2.00 Interoperability

KBCategory:

KBSubcategory: IntpOle


PRA: OLE Objects Seem to Be Acceptable Filter Criteria

Article ID: Q105513

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access erroneously allows you to use OLE objects as filter

criteria. If you attempt to do so, a misleading error message is

displayed:

   Record is too large.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. Microsoft is researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Microsoft Access does not currently allow you to use OLE objects as

filter criteria.

Steps to Reproduce Problem

--------------------------

1. Using the sample database NWIND.MDB, create a new form called Form1

   that is bound to the Employees table.

2. Drag the Photo field to the form.

3. From the View menu, choose Form.

4. Leaving Form1 open, open the Employees form.

5. From the Records menu, choose Edit Filter/Sort.

6. Add the following to the filter criteria:

      Photo = Forms!Form1!Photo

7. From the Records menu, choose Apply Filter/Sort.

   The error message "Record is too large" is displayed.

Additional reference words: 1.00 1.10 2.00 forms ole

KBCategory:

KBSubcategory: IntpOle


PRA: OnError Property Does Not Trap Locking Error in Form

Article ID: Q116065

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you have a form's RecordLocks property set to No Locks and a multiuser

record locking error occurs, the form's Error event is not triggered, and

the normal "This record has been changed by another user since you started

editing it..." dialog box appears.

CAUSE

=====

The Error event is triggered when a run-time error is produced in Microsoft

Access. The multiuser record locking error mentioned above is not a

trappable run-time error.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

The Error event is triggered when a run-time error is produced in Microsoft

Access. If you set the form's OnError property to a macro or event

procedure, Microsoft Access will run the macro or event procedure when a

run-time error occurs.

If you set a form's RecordLocks property to No Locks, no error will be

trapped when two users modify the same record at the same time. Instead,

Microsoft Access will display a dialog box to the user who attempted to

save the record last, prompting the user to save the changes, discard the

changes, or copy the changes to the Clipboard.

Steps to Reproduce Problem

--------------------------

 1. Open the sample database NWIND.MDB. Make sure to clear the Exclusive

    check box in the Open Database dialog box.

 2. Open the Employees form in Design view.

 3. Set the form's OnError property to:

       =MsgBox("An error has occurred.")

 4. From the View menu, choose Options.

 5. In the Category box, select Multiuser/ODBC. In the Items box, set

    Default Record Locking to No Locks.

 6. Save and close the Employees form.

 7. Start another instance of Microsoft Access, or start Microsoft Access

    on another computer.

 8. In the second instance of Microsoft Access, or on the other computer,

    open the same NWIND.MDB file. Make sure to clear the Exclusive check

    box in the Open Database dialog box.

 9. In both copies of Microsoft Access, open the Employees form in Form

    view.

10. In both copies of Microsoft Access, edit the Title field of the first

    record.

11. In the second copy of Microsoft Access, move to the next record.

12. In the first copy of Microsoft Access, move to the next record. Note

    that the Error event is not triggered.

REFERENCES

==========

For more information about Error events, search for "error events" then

"Error and Timing Events" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 2.0, pages 107 and 224

Additional reference words: 2.00 optimistic

KBCategory:

KBSubcategory: FmsProp


PRA: Open OLE Objects Not Saved When Record Changes

Article ID: Q103136

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you are editing an OLE object that is opened from an OLE field and

you then move to a different record, there is no indication that the

record was changed. The OLE object in the OLE server is closed and all

changes to the object are lost.

RESOLUTION

==========

Version 1.0 Workaround

----------------------

One way to work around this problem in Microsoft Access version 1.0 is

to call an Access Basic function in the OnExit property of the object.

The function prompts you to verify that the object has been

updated. The following is an example of this function:

1. Place the function called =ProcessOLEObject() in the OnExit

   property of the OLE object.

2. Create the following module:

   Function ProcessOLEObject ()

      Saved = MsgBox("Have you saved your changes for this object?", 36)

      If Saved = 7 Then

         DoCmd CancelEvent

         DoCmd DoMenuItem A_FormBar, A_EditMenu, A_Object, A_ObjectUpdate

      End If

   End Function

Every time you pass through the OLE field, the function will be run

and the dialog box displayed. Unfortunately, there is no way to test

whether or not the object has been edited.

Version 1.1 and 2.0 Workaround

------------------------------

In Microsoft Access versions 1.1 and 2.0, a dialog box appears, indicating

that the object is editable and giving you the option to update the object

before moving on to the next record.

For example, the following message appears after you open one of the

pictures in the Employees table in the sample database NWIND.MDB:

   The object "Paintbrush Picture" is open for editing and may have

   been modified. Update before saving? Yes, No, Cancel or Help

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB in Microsoft Access version 1.0.

2. Open the Employees form.

3. Double-click the image that you want to edit. This action will

   start Paintbrush.

4. Make some change to the image.

5. Press ALT+TAB to return to Microsoft Access without saving the

   image.

6. Move to the next record.

If you press CTRL+ESC to view the task list, you will note that Paintbrush

is no longer available. If you go back to the record you were editing, the

picture will not contain the changes you made.

Additional reference words: 1.00 1.10 2.00 photo

KBCategory:

KBSubcategory: IntpOle


PRA: Options in Form and Report Wizards Are Not Displayed

Article ID: Q103173

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you select the Form Wizard button or the Report Wizard button, an

empty list box is displayed.

CAUSE

=====

The [Form Wizards] and [Report Wizards] sections of the MSACCESS.INI file

(in Microsoft Access version 1.x) or the MSACC20.INI file (in Microsoft

Access version 2.0) either do not exist or are empty.

RESOLUTION

==========

In version 2.0, using Notepad or another text editor, add the following

sections in your MSACC20.INI file. The MSACC20.INI file is located in

your Windows directory.

  [Form Wizards]

  Single-Column=zwform,1

  Tabular=zwform,2

  Graph=zwgraph,,

  Main/Subform=zwmainsub,,

  Autoform=zwautoform,,

  [Report Wizards]

  Single-Column=zwreport,3

  Groups/Totals=zwreport,4

  Mailing Label=zwmailinglabel,,

  Summary=zwreport,12

  Tabular=zwreport,11

  Autoreport=zwautoreport,,

  MSWordMailmerge=PM_Entry,,

  [Libraries]

  wzlib.mda=rw

In version 1.x, using Notepad or another text editor, add the following

sections in your MSACCESS.INI file. The MSACCESS.INI file is located in

your Windows directory.

   [Form Wizards]

   Single-Column=zwInitWizard, 1

   Tabular=zwInitWizard, 2

   Graph=zwInitWizard, 6

   Main/Subform=zwInitWizard, 7

   [Report Wizards]

   Single-Column=zwInitWizard, 3

   Groups/Totals=zwInitWizard, 4

   Mailing Label=zwInitWizard, 5

   [Libraries]

   wizard.mda=ro

Additional reference words: 1.00 1.10 2.00 option wizard blank disappear

ini

KBCategory:

KBSubcategory: FrmrptWzd


PRA: Oracle Driver Errors on Delimited Column Names

Article ID: Q114840

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

This information is extracted from an article in the LANPROD knowledge

base. To find the most current information, see the "References" section

later in this article.

The Oracle ODBC Driver gives an error on any SELECT statement that contains

an outer join (in the ODBC escape-clause syntax) on a delimited column name

that is greater than 17 characters. As a result, when you are using

Microsoft Access or Microsoft Visual Basic to connect to an Oracle server,

you cannot perform outer joins on columns whose names are longer than 17

characters.

RESOLUTION

==========

Rename the joined columns on the server so that each column has less

than 17 characters, then re-attach the tables.

REFERENCES

==========

For more information, please see the following article(s) in the Microsoft

Knowledge Base:

   ARTICLE-ID: Q104958

   TITLE     : BUG: Oracle Driver Errors on Delimited Column Names

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


PRA: Ownership of 1.x Objects Can Be Changed with 2.0 DAO

Article ID: Q117168

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You can use data access objects (DAO) in Microsoft Access version 2.0 to

change the ownership of database objects (such as tables, forms, and

reports) in unprotected Microsoft Access version 1.x databases, even though

you cannot view or change the ownership of these objects using Microsoft

Access version 1.x.

CAUSE

=====

Although there is no command to change object ownership in Microsoft Access

1.x, the underlying Microsoft Jet database engine does support changing

ownership. The method of changing object ownership in Microsoft Access 2.0

works on both version 1.x and version 2.0 databases.

RESOLUTION

==========

To keep ownership of objects in your version 1.x database from being

changed, protect the database with the Microsoft Access version 1.x

Security Wizard.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

REFERENCES

==========

For more information about database ownership, search for "security:

database ownership" then "Viewing and Changing Ownership" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ScrtOwnr


PRA: Paradox Password Protection Bypassed by Multiple Users

Article ID: Q117609

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attach a password-protected Paradox table nonexclusively to a

Microsoft Access version 2.0 database, the table behaves normally, allowing

you to view the table's contents after you supply the correct password.

However, once the password has been supplied by a user, any other user can

then open the attached table and view its contents without supplying a

password.

CAUSE

=====

The entire file is decrypted when a user opens it with the correct

password.

RESOLUTION

==========

Open the attached Paradox table exclusively, so that other users cannot

open it.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

REFERENCES

==========

For more information about attaching Paradox tables, search for "Paradox

files" then "Importing and Attaching Paradox Tables" using the Microsoft

Access Help menu.

Additional reference words: 2.00 attaching security

KBCategory:

KBSubcategory: IsmPdox


PRA: Printer Fonts Cause Text to Shift Down and Right

Article ID: Q103431

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The first page of a report prints fine, but the text is shifted down and

to the right on the other pages. This shift occurs when you use printer

fonts.

CAUSE

=====

The problem is related to the GENDRV.DLL file. Any printer driver that

uses this .DLL file creates the same distortion when using any printer

fonts.

The following printers use the GENDRV.DLL file:

Generic Printer Driver-GENDRV.DLL (GENDRV.EXE) 06/24/93 version (1.68)

----------------------------------------------------------------------

              Canon LBP 8-III             (CANON.EXE)

              Digital DECLaser 1100       (DEC1.EXE)

              Digital DECLaser 2100/Plus  (DEC1.EXE)

              Digital DECLaser 2200/Plus  (DEC1.EXE)

              Digital DECLaser 3200       (DEC1.EXE)

              Digital LA70                (DEC1.EXE)

              Digital LA75                (DEC1.EXE)

              Digital LA75 Plus           (DEC1.EXE)

              Digital LA324               (DEC1.EXE)

              Digital LJ250/252           (DEC1.EXE)

              Digital LN03/Plus           (DEC1.EXE)

              IBM Laser Printer 4029      (IB4029.EXE)

              Olivetti DM 124 C           (OLIVE.EXE)

              Royal CJP 450               (OLIVE.EXE)

              Seiko CH 4104               (SEIKO.EXE)

              Seiko CH 5504               (SEIKO.EXE)

              Seiko CH 5514               (SEIKO.EXE)

NOTE: The IBM4029 is the only printer driver certified by Microsoft

Compatibility Labs (MCL). All other printers using the GENDRV.DLL file

have been neither tested nor certified by MCL.

RESOLUTION

==========

Use TrueType fonts or, for the IBM4029 printer, use the the most

current Microsoft Windows drivers for this printer, which are

available by calling Lexmark at (606) 232-3000. These drivers are also

available from the Lexmark bulletin board at (606) 232-5238.

The printer driver for Windows version 3.0 is called 29W30_PS.EXE; the

printer driver for both Windows 3.0 and 3.1 is called 29W3X_PP.EXE. A

README.DOC file with installation instructions is included with each

driver.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

versions 1.0, 1.1, and 2.0. We are researching this problem and will post

new information here in the Microsoft Knowledge Base as it becomes

available.

Steps to Reproduce Problem

--------------------------

To duplicate this problem using the sample database NWIND.MDB, do the

following:

1. Open the List of Products by Category report in Design view.

2. From the File menu, choose Print Setup. Change the print driver to

   Canon LBP 8-III or to one of the print drivers listed above.

3. Select all controls in the Page Header section.

4. From the Edit menu, choose either Dutch Scalable or any printer

   font.

5. Print two pages of the report.

   On the first page, the page header controls will be within the

   lines; on the second page, the controls will be below and to the

   right of the lines.

The IBM4029 printer driver is manufactured by Lexmark and the other

printer drivers by other vendors independent of Microsoft; we make no

warranty, implied or otherwise, regarding these products' performance

or reliability.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory:  PtrOthr


PRA: Report Section with Subreport Not Included In Output File

Article ID: Q113562

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you use the Output To command to output a report to a file, any

section of a report that includes a subreport is not included in the output

file.

CAUSE

=====

It is by design that when you use the Output To command to output a report

to a file, subreports are not included in the output file. However, the

presence of a subreport in any section of a report prevents the entire

section from being included in the output file.

RESOLUTION

==========

Remove the subreport from the report section and output the report again.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem, and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Preview the report Sales By Year.

3. In the Sales By Year Dialog form, enter "6/1/91" (without quotation

   marks) for the beginning date, and enter "6/30/91" (without quotation

   marks) for the ending date. Choose OK.

4. Note that one page is displayed, with a page header section, group

   header section, detail section, and page footer section.

5. From the File menu, choose Output To.

6. In the Select Format box, select Rich Text Format (*.rtf), and then

   choose OK.

7. Choose OK to accept the default filename (sales_by.rtf) for the

   output file.

8. When you are alerted that the subreport will not be included, choose

   OK.

9. Open the SALES_BY.RTF file in any editor (such as Microsoft Word for

   Windows, or Microsoft Write) that can open a Rich Text format file.

   Note that the entire group header section is missing from the file,

   because the group header section of the Sales By Year report contains

   a subreport.

NOTE: The height of the detail section in the Sales By Year report is set

to 0.1667 inches to add space between detail records. Setting the height of

the detail section to 0.1563 inches will avoid double spacing in the output

file.

Additional reference words: 2.00

KBCategory:

KBSubcategory: RptSub


PRA: Reserved Error -1001 with Linked Crosstab Subreport

Article ID: Q104758

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when you are printing or previewing

a report:

   The crosstab query underlying a subform or subreport must have fixed

   column headings (Microsoft Access version 2.0)

   -or-

   Reserved error (-1001); there is no message for this error (Microsoft

   Access version 1.1)

CAUSE

=====

A main report with a bound subreport that is based on a crosstab query

cannot be previewed or printed unless the crosstab query uses fixed column

headings.

RESOLUTION

==========

Add fixed column headings to the crosstab query's properties:

In Microsoft Access version 2.0, with the crosstab query in Design view,

choose Query Properties from the View menu. In the ColumnHeadings property,

type the column headings for your query.

In Microsoft Access version 1.1, with the crosstab query in Design view,

choose Query Properties from the View menu. In the FixedColumnHeadings

property, type the column headings for your query.

Another workaround is to delete the LinkChildFields and LinkMasterFields

properties of the subreport. You will then be able to run your report, but

the report will show every record in the subreport.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Create a crosstab query based on the Employees table. Save the

   query as Employee Crosstab.

      Query: Employee Crosstab

      ------------------------

      Type: Crosstab Query

      Field: Last Name

         Total: Group By

         Crosstab: Row Heading

      Field: Birth Date

         Total: Group By

         Crosstab: Column Heading

      Field: Reports To

         Total: Sum

         Crosstab: Value

3. Using the Single-Column ReportWizard, create a new report based on

   the Employee Crosstab query. Include all the query fields in your

   report, and sort by the Last Name field. Save the report as

   Employee Crosstab SubReport.

4. Using the Single-Column ReportWizard, create another new report

   based on the Employee Crosstab query. Include only the Last Name

   field in this report, and sort by the Last Name field. Save this

   report as Employee Main Report.

5. Embed the Employee Crosstab SubReport in the detail section of the

   Employee Main Report. You can do this by dragging the subreport

   from the Database window to the detail section of the main report

   (which must be in Design view).

6. In Design view of the main report, view the Properties sheet for

   the Employee Crosstab SubReport. Verify that the LinkChildFields

   and LinkMasterFields properties are set to Last Name.

7. Try to preview or print the Employee main report. You will receive

   the error message stated above.

Additional reference words: 1.10 2.00

KBCategory:

KBSubcategory: RptSub


PRA: RunningSum Text Box in Report Not Accumulating Values

Article ID: Q115877

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When a text box in a report that uses the RunningSum property is based on

another control in the report, it does not accumulate the running sum.

Instead, it reflects only the value of the control it references.

RESOLUTION

==========

Instead of referring to another control in the text box's ControlSource

property, refer to a field from the underlying table or query, or to an

explicit calculation.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

This problem is usually encountered in databases that have been converted

from version 1.x to 2.0.

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new report based on the Products table.

3. Place two new text boxes side by side in the report's detail section.

   Note that the Name property of the left text box is Field0, and the

   right text box is Field2.

4. Set the following properties for the text boxes:

      Name: Field0

        ControlSource: =[Unit Price]

      Name: Field2

        ControlSource: =[Field0]

        RunningSum: Over All

5. Preview the report and scroll to the last page.

Note that the Field2 text box only reflects what is contained in the Field0

text box, even though its RunningSum property is set to Over All. It does

not accumulate the values contained in the two text boxes as it should.

To correct this problem for fields in the underlying record set, set the

Field2 text box's ControlSource property to the following:

   =[Unit Price]

Note that this will not correct the problem for expression fields such as

DLookup and Sum. You can also try placing the expression in the underlying

query or incrementing a global variable using Access Basic.

REFERENCES

==========

For more information about the RunningSum property, search for "RunningSum"

then "RunningSum Property" using the Microsoft Access Help menu.

Additional reference words: 2.00 Reports

KBCategory:

KBSubcategory: RptTotal


PRA: Selecting Options in Find Dialog Box

Article ID: Q94222

UifOthr


PRA: Sent Keys Lost if Microsoft Access Yields Processor

Article ID: Q109958

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you use the SendKeys statement in Access Basic to fill a dialog box and

Microsoft Access yields the computer's processor to another Windows process

before the dialog box appears, the sent characters will be lost.

One situation where this might occur would be filling a report name in the

Print dialog box when you are printing a report to a file.

RESOLUTION

==========

To minimize the chance of losing sent keys, make your queries as short as

possible. When a query takes a long time to run, Windows has more time to

interrupt the task to serve another Windows process. By shortening your

queries, you give Windows less time to interrupt.

If this problem occurs when you are printing to a file, try printing

directly to the file through your printer driver. If your printer driver

supports this, set it to print your report directly to a file instead of

using Microsoft Access to do this.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Using the Windows Control Panel, set up a printer to print to

   the port FILE.

2. Start Microsoft Access and open the sample database NWIND.MDB.

3. Open the "Employee Sales by Country (Parameter)" query and remove the

   parameters from the Shipped Date field in the query grid.

4. Drag the Employee ID field to the query grid and then type "1"

   (without the quotation marks) in its Criteria row.

5. Create the following new macro:

      SendKeys

         Keystrokes: text.txt

         Wait: No

      SendKeys

         Keystrokes: {enter}

         Wait: No

      OpenReport

         Report: Employee Sales By Country

         Mode: Print

6. Set the report Employee Sales by Country to print to the printer

   on port FILE.

7. Save and then run the query. In Microsoft Access version 1.x, the sent

   keys work correctly. In version 2.0, the sent keys are lost.

8. Remove the Employee ID field from the query and run the macro again.

   Note that the sent keys are lost.

Additional reference words: 1.00 1.10 2.00 Programming AB Timeout

KBCategory:

KBSubcategory: PtrOthr


PRA: Setup Cannot Recognize Forward Slash in Path

Article ID: Q103272

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are running the Microsoft Access Setup program, the following

error message may appear if your path statement contains forward

slashes (/):

   Badly formed Setup Script Command

   "CreateIniKeyValue C:/WIN\WINHELP.INI Files CUECARDS.DLL

   C:\ACCESS\, Can't find CUECARDS.DLL O"

CAUSE

=====

The Setup program used by Microsoft Access cannot interpret the forward

slash (/) as used in the path statement. When Microsoft Access calls for

the path variable, the result is C:/WINDOWS. Microsoft Access is unable to

append the addenda necessary for the various .INI file entries.

RESOLUTION

==========

Change forward slashes to back slashes (\) in all paths statements and

path variables in your AUTOEXEC.BAT and CONFIG.SYS files. For example,

change

   PATH C:/WINDOWS;C:/DOS;

to read

   PATH C:\WINDOWS;C:\DOS;

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Type the following at the command prompt:

      PATH C:/WINDOWS;C:/DOS;

2. Start Microsoft Windows.

3. Install Microsoft Access and start the Setup program.

   The error will occur at the end of Setup, when Microsoft Access

   tries to update the .INI files.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: StpOthr


PRA: SQORA.DLL Does Not Allow Lengthy SQL Statements

Article ID: Q104452

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When executing a query against an Oracle table, or updating a record

in an Oracle table, the error message

   Statement was longer then allowable maximum 2000+ chars

is displayed if the table and field names are very long or the query is

very complex.

CAUSE

=====

This is a problem with SQORA.DLL, the Oracle ODBC Driver.

RESOLUTION

==========

Obtain and install the updated driver, or use queries to do updates,

rather than updating records while the Oracle table is in Datasheet

view. The query should yield only the columns to be updated.

For complex queries, reduce the number of tables or joins in the query

and reduce the number of fields used or shown in the query.

These workarounds reduce the length of the SQL statements.

STATUS

======

Microsoft has confirmed this to be a problem in the Oracle ODBC driver

shipped with Microsoft Access versions 1.1 and 2.0 and Visual Basic for

Windows version 3.0 - Professional Edition. An updated driver that corrects

this specific problem is available from Microsoft.

MORE INFORMATION

================

Obtaining the Updated Driver

----------------------------

ORA110.EXE, a self-extracting zipped file, can be downloaded from

Library 11, ODBC Connectivity, in the MSACCESS forum on CompuServe, or

from the Microsoft Download Service (MSDL).

If the user is unable to download the file, Microsoft Product Support

Services (PSS) can provide the data on disk, which also includes an

updated Btrieve driver.

NOTE: This driver is for use only by registered owners of Microsoft

Access versions 1.1 and 2.0 and Visual Basic for Windows version 3.0 -

Professional Edition. By installing these files, you are indicating

that you own one of these products.

Disk Contents

-------------

The following files are found on the disk:

   README.TXT

   BTRV110.DLL

   ORACLE.TXT

   SQORA.DL_

   SQORASTP.DL_

   ODBC.INF

   SETUP.EXE

NOTE: The SETUP.EXE file is called by the ODBC Control Panel facility.

It will not run as a standalone file.

The following two files will actually be updated:

                          Old                     New

                -----------------------------------------------

SQORA.DLL       Version:  1.00.2816     Version:  1.00.3112

                   Size:  143,600 bytes    Size:  144,096 bytes

                   Date:  4/16/93          Date:  7/12/93

SQORASTP.DLL    Version:  1.00.2403     Version:  1.00.3106

                   Size:  9,328 bytes      Size:  9,632 bytes

                   Date:  5/7/93           Date:  7/6/93

The README.TXT file on the disk documents both the changes to the

Btrieve and Oracle drivers and the installation procedures for each.

Oracle and Btrieve drivers are manufactured by Oracle Corporation and

Novell, Inc. respectively and CompuServe by CompuServe, Inc., all

vendors independent of Microsoft; we make no warranty, implied or

otherwise, regarding these products' performance or reliability.

Additional reference words: 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


PRA: TransferDatabase Fails in Code, Not in Immediate Window

Article ID: Q117612

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you use the TransferDatabase action within a transaction in an Access

Basic function, you receive the error message:

   Couldn't update, locked by another user on this system.

However, if you set a breakpoint in the function and single-step through

it, you do not receive the error message.

CAUSE

=====

This error occurs only when you run a TransferDatabase action nested in a

transaction on a table that is already attached to Microsoft Access.

The error occurs because a transaction updates the MySysObjects table,

placing a write lock on the table. The write lock is not released while the

transaction is still active. The DoCmd TransferDatabase statement causes

Microsoft Access to start a new session and try to create a new table.

However, the Microsoft Jet database engine needs to update the MySysObjects

table because it is adding a record, but the MySysObjects table is still

locked.

RESOLUTION

==========

Do not use nested TransferDatabase actions in transactions against attached

tables. Instead, use the following techniques:

- Move the TransferDatabase action above or below the transaction.

- Move the data from the attached table into a local table and perform

  the TransferDatabase action on it instead.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

NOTE: In the following sample code, an underscore (_) at the end of a line

is used as a line-continuation character. Remove the underscore from the

end of the line when re-creating this code in Access Basic.

1. Start Microsoft Access and create a new database.

2. Import the Employees table from the sample database NWIND.MDB into the

   new database.

3. Attach the Order Details table from NWIND.MDB.

4. Create a new module and enter the following function:

      Sub TestIt ()

         Dim ws as Workspace

         Dim db As Database, rs As Recordset

         BeginTrans

            set ws=dbengine.workspaces(0)

            Set db = ws.databases(0)

            Set rs = db.OpenRecordset("Order Details", DB_OPEN_DYNASET)

            rs.FindFirst "[Order Id]=10010"

            rs.Edit

            rs![Order Id] = 10001

            rs.Update

            DoCmd TransferDatabase A_EXPORT, "Microsoft Access",_

             "C:\ACCESS\SAMPAPPS\NWIND.MDB", A_TABLE, "Employees",_

             "Employees2", False

         CommitTrans

      End Sub

5. From the View menu, choose Immediate Window.

6. In the Immediate window, type the following line and then press ENTER:

      TestIt

REFERENCES

==========

For more information about the TransferDatabase action, search for

"TransferDatabase" then "TransferDatabase Action" using the Microsoft

Access Help menu.

Additional reference words: 2.00 programming attaching errmsg

KBCategory:

KBSubcategory: McrProb


PRA: Update or Delete Query Fails Without Generating Error

Article ID: Q117163

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run an update or delete query in Access Basic using the Execute

method, some records are not modified or deleted, and no error message is

generated.

CAUSE

=====

Those records that were not modified or deleted were locked when the action

query was run. A record is locked whenever it is being edited, whether that

editing is done through the user interface, from Access Basic code, or by

an action query.

RESOLUTION

==========

In Microsoft Access version 2.0, use the DB_FAILONERROR option when you use

the Execute method to run an action query from Access Basic code. This

switch issues a rollback and generates an error when locking conflicts

occur, resulting in the canceling of all updates.

In Microsoft Access version 1.x, create a dynaset in Access Basic that

includes all the records that should be modified. Within transactions

(BeginTrans and CommitTrans), modify each record in the dynaset until all

the records are updated. This technique will generate an error that you can

trap if a locking conflict occurs. You can then issue a rollback on the

transaction and try to update the record again until the update succeeds.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.x. The problem was corrected in Microsoft Access version 2.0 by including

the DB_FAILONERROR option with the Execute method.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open any database.

2. Create a new table called Table1. Add a text field called Info to the

   table. View the table in Datasheet view and add the following records:

      Info

      ----

      ddd

      aaa

      ccc

      ddd

      ddd

      eee

3. Create a new query based on Table1. Drag the Info field to the query

   grid. Type "ddd" (without quotation marks) in the Criteria field. Save

   the query as Query1. Run the query and note that three records are

   displayed. Close the query.

4. Create an update query based on Table1. Drag the Info field to the query

   grid. Type "zzz" (without quotation marks) in the Update To row, and

   type "ddd" (without quotation marks) in the Criteria row. Save the query

   as UDQuery.

5. Open a new module and enter the following sample code:

      Option Explicit

      Function RunUDQuery ()

         Dim db As Database, qdef As QueryDef

         'Use only one of the following lines--remove the other line!

         Set db = CurrentDB()   'Use this line in version 1.x

         Set db = DBEngine(0)(0) 'Use this line in version 2.0

         Set qdef = db.OpenQueryDef("UDQuery")

         qdef.Execute

      End Function

6. Create a new form based on Table1. Add a text box based on the Info

   field to the form. Add a command button to the form, and set the

   button's OnClick property to "=RunUDQuery()" (without quotation marks).

   (Note that in Microsoft Access version 1.x, the OnClick property is

   called the OnPush property.) Save the form as Form1.

7. View Form1 in Form view and type "xxx" (without quotation marks) in the

   Info text box. Note that the record selector changes from an arrow to a

   pencil, indicating that the record is being edited, and is locked. Click

   the command button on the form to run the update query. Note that no

   error message is generated.

8. Press ESC to undo your typing in the form. Open Query1 and note that one

   record still matches the "ddd" criteria. This record was not updated by

   the update query because the record was being edited when the update

   query was run.

To correct this problem in Microsoft Access version 2.0, use the following

sample code in place of the code in step 5:

   Option Explicit

   Function RunUDQuery ()

      Dim db As Database, qdef As QueryDef

      Set db = DBEngine(0)(0)

      Set qdef = db.OpenQueryDef("UDQuery")

      On Error GoTo Errorhandler

      qdef.Execute DB_FAILONERROR

      Exit Function

   Errorhandler:

      MsgBox "Update Failed " & Err & " " & Error

      Exit Function

   End Function

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.1, Chapter 8,

page 108

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryMktbl


PRA: Windows Setup Ignores ADK, ADT applications

Article ID: Q101077

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Windows Setup (found in the Main group in Program Manager)

ignores applications created with the Microsoft Access Distribution

Kit (ADK), or the Microsoft Access Developer's Toolkit (ADT), even when

these directories are listed in the system path.

RESOLUTION

==========

To cause Windows Setup to recognize your ADK or ADT application, use the

following steps:

1. Run Windows Setup.

2. From the Options menu, choose Set Up Applications.

3. Select the "Ask you to specify an application" check box.

4. Choose OK, then specify your ADK or ADT application.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft Access

Distribution Kit version 1.1 and the Microsoft Access Developer's Toolkit

version 2.0. We are researching this problem and will post new information

here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Place all files required by your Microsoft Access ADK or ADT application

   in a directory in your system path.

2. Run Windows Setup.

3. From the Options menu, choose Set Up Applications.

4. Search your path.

Note that Windows Setup does not recognize your ADK or ADT application.

Additional reference words: 1.10 2.00 ADK Windows Setup

KBCategory:

KBSubcategory: StpOthr


PRB:  GoToRecord Macro Does Not Work on Subform

Article ID: Q92685

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you create a GoToRecord macro that points to a subform and run that

macro from the main form, you get the following error message.

   Object '<Subform Name>' isn't open

STATUS

======

This behavior is by design.

RESOLUTION

==========

Use a GoToControl macro and specify the subform, then use the

GoToRecord action to specify the specific record within the subform.

The GoToRecord action would look like this:

   GoToRecord

      Object Type:

      Object Name:

      Record     : Next

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB and then create the following

   new macro:

      Macro Name     Condition     Action

      ---------------------------------------

      Macro1                       GoToRecord

      Macro1 Actions

      ----------------------------------

      GoToRecord

         Object Type: Form

         Object Name: Categories Subform

         Record: Next

2. Open the Categories form and from the File menu, choose Run Macro, then

   select Macro1. You will get the following error message:

      Object 'Categories Subform' isn't open

3. Now change Macro1 to the following:

      Macro Name     Condition     Action

      ----------------------------------------

      Macro1                       GoToControl

                                   GoToRecord

      Macro1 Actions

      -----------------------------------

      GoToControl

         Control Name: Categories Subform

      GoToRecord

         Record: Next

Run the macro in the same way as in step 2. The macro will go to

the second record in the Categories Subform.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsEvnt


PRB: "#Error" Message Referencing Subreport Values (2.0)

Article ID: Q114513

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Referencing a subreport control from a main report when the subreport does

not return any records results in a "#Error" error message.

CAUSE

=====

The error message occurs because the subreport does not return any values.

RESOLUTION

==========

Make sure that a subreport referenced in a main report returns values. Or,

use an Access Basic function to retrieve values from the subreport, and to

trap for the error should it occur. See the "Steps to Solve Problem"

section later in this article for an example of this technique.

STATUS

======

This behavior is by design

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. Open the sample database NWIND.MDB.

 2. Create a new, blank query based on the Customers table.

 3. Drag the Customer ID and Company Name fields from the field list to

    the query grid.

 4. In the criteria cell for the Company Name column, enter the following

    expression:

       Like "P*"

 5. Save the query as Sorter.

 6. Create a new report based on the Orders table. This report will be

    the subreport.

 7. Drag the Freight field from the field list to the report's Detail

    section.

 8. In the report's footer section, place a text box with the following

    properties:

       ControlSource: =Sum([Freight])

       Name: Sum Freight

 9. Save the report as SubRpt.

10. Create a new report based on the Sorter query. This report will be

    the main report.

11. From the Format menu, turn off the Page Header/Footer command. From

    the View menu, choose Sorting And Grouping. In the Field/Expression

    box, select Customer ID, and then set the Group Header property to Yes.

12. Drag the Customer ID field from the field list to the main report's

    Customer ID header section.

13. Drag the SubRpt report from the Database window to the detail section

    of the main report. Below the new subreport, place a label control

    with the caption "Total Order Amount Per Customer:" (without quotation

    marks) and a text box containing the following formula:

       =([SubRpt].Report![Sum Freight])

14. Set the subreport's LinkMasterFields and LinkChildFields properties

    to [Customer ID].

15. Save the main report as MainRpt.

16. Preview the main report. Note that in the record for company

    Paris Specialties, the error message "#Error" is displayed for

    the subreport reference ([SubRpt].Report![Sum Freight]).

Steps to Solve Problem

----------------------

1. Create the following new Access Basic function called ErrAvoid():

      Function ErrAvoid (n As Variant)

         On Error GoTo Trap

         ErrAvoid = n

         Exit Function

      Trap:

         ErrAvoid = 0

         Resume Next

      End Function

2. Replace "=([SubRpt].Report![Sum Freight])" in step 13 of the previous

   procedure with the following:

      =ErrAvoid([SubRpt].Report![Sum Freight])

3. Preview the main report. Note that in the record for company

   Paris Specialties, $0.00 is displayed instead of the "#Error"

   message. The ErrAvoid() function traps for errors that are caused

   by the subreport containing no values. When an error is encountered,

   a value of zero is assigned.

Additional reference words: 2.00 pounderror errmsg

KBCategory:

KBSubcategory: RptSub


PRB: "#ERROR" Message When Referencing Subreport Controls

Article ID: Q102521

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Referencing a subreport control from a main report when the subreport

does not return any matching records results in a "#ERROR" message for the

referenced subreport control.

RESOLUTION

==========

Make sure that any subreport fields referenced in main reports have values

associated with them by adding a function to test for this condition. For

more information, see the "Steps to Solve Problem" section below.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new query based on the Customers table. Drag the Company Name

   field from the field list to the query grid. Type the following in the

   Criteria field for the column:

      Like "P*"

   Drag the Customer ID field from the field list to the next column on

   the query grid. Save the query as Sorter. Note that this query will

   limit the recordset to only customer records beginning with the letter

   "P", and includes a customer with no orders.

3. Create a new subreport based on the Orders table; call it SubRpt.

4. Drag the Freight field to the detail section of the subreport. In the

   report footer section, place a text box with the following formula

   as the ControlSource property:

      =Sum([Freight])

   Set the ControlName property of the text box to ToTFreight. The

   subreport will print the detailed freight items with a grand total for

   all freight charges.

5. Create a new report called Main Report based on the Sorter query.

6. From the View menu, choose Sorting And Grouping. In the dialog box,

   select Company Name from the Field/Expression combo box and set the

   Group Header property to Yes.

7. Drag the Company Name field to the new Company Name header

   section.

8. Drag the SubRpt subreport from the Database window to the detail

   section of Main Report. Below the subreport, place a label control

   with the caption "Total Order Amount Per Customer:" and a text box

   control with the ControlSource property set to the following formula:

      =([SubRpt].Report![ToTFreight])

   Set both the LinkMasterFields and the LinkChildFields properties

   for the subreport control to [Customer ID]. Setting these properties

   filters the subreport to display the Freight charges per customer.

9. Preview the report.

Note that Parisian Specialties (in version 1.x), or Paris Specialites (in

version 2.0), which has no orders, displays "#ERROR" for the referenced

subreport control.

Steps to Solve Problem

----------------------

1. Create the following new Access Basic function called ErrAvoid():

      Function ErrAvoid (n As Variant)

         On Error GoTo Trap

            ErrAvoid = n

            Exit Function

         Trap:

            ErrAvoid = 0

            Exit Function

      End Function

2. Replace "=([SubRpt].Report![ToTFreight])" in step 8 of the previous

   procedure with the following:

       =ErrAvoid([SubRpt].Report![ToTFreight])

3. Preview the report.

Parisian Specialties, or Paris Specialites, now shows $0.00 dollars in

sales, instead of "#ERROR." The ErrAvoid() function traps for errors that

are caused by the subreport control containing no values. When an error is

encountered, "Object Has No Value," then a value of zero, is assigned to

the main report control.

Additional reference words: 1.00 1.10 2.00 pounderror pounderr link master

KBCategory:

KBSubcategory: RptSub


PRB: "#NAME?" Error Referring to Combo Box Column in Subform

Article ID: Q103129

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You can refer to a particular column of a combo box in a text box on a form

using the .Column property as follows:

   =Forms![Formname]![ControlName].Column(x).

However, if the combo box is on a subform, the text box returns the

message:

   #Name?

RESOLUTION

==========

To work around this behavior, you can refer to the column of the combo box

that is on the subform through the main form, even though the text box is

actually on the subform.

For a subform with a combo box and a text box, the following syntax returns

the correct result:

   =Forms![MainForm]![Subform].Form![Controlname].Column(x)

NOTE: Columns are numbered starting with 0, not with 1.

Additional reference words: 1.00 1.10 2.00 poundname

KBCategory:

KBSubcategory: FmsCmbo


PRB: "Btrieve-Out of Resources" Error Msg with Attached Table

Article ID: Q101405

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Opening an attached Btrieve table returns the following error message:

   Btrieve-Out of Resources

CAUSE

=====

If you are using compressed Btrieve files, you must be sure that the

compression buffer Btrieve is using is adequate for your data. The

buffer size must be at least as large as the largest record in your

data files.

RESOLUTION

==========

To ensure proper operation, set the compression buffer size option (/u) in

the [btrieve] section of your WIN.INI file (for Btrieve version 5.1x), or

your NOVDB.INI file (for Btrieve version 6.x). The units for this setting

are kilobytes, so if your largest record is 2K, you would add /u:2 to the

Btrieve options line in the .INI file.

MORE INFORMATION

================

Btrieve is manufactured by Novell, Inc., a vendor independent of Microsoft;

we make no warranty, implied or otherwise, regarding this product's

performance or reliability.

REFERENCES

==========

For more information about setting options, see the topic "Setting Btrieve

Options in WIN.INI" in the BTRIEVE.TXT file, included with Microsoft Access

version 1.1. In Microsoft Access version 2.0, refer to the ACREADME.HLP

file.

Additional reference words: 1.00 1.10 2.00 xtrieve attach

KBCategory:

KBSubcategory: IsmBtrv


PRB: "Couldn't Find File WIZARD.MDA" Error Message

Article ID: Q116150

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you start Microsoft Access, you receive the error messages:

   Couldn't find file 'WIZARD.MDA'

    -and-

   Some libraries or modules could not load. Click OK or press ENTER to

   continue.

CAUSE

=====

Your MSACC20.INI file has been deleted from the Windows directory, or it

has been renamed or moved. Also, the Microsoft Access version 1.x

MSACCESS.INI file is still in the Windows directory. If Microsoft Access

version 2.0 cannot find the MSACC20.INI file, it will use the version 1.x

MSACCESS.INI file.

RESOLUTION

==========

1. Delete or rename the MSACCESS.INI file.

2. Locate your MSACC20.INI file and place it in your Windows directory.

   If it has been deleted, reinstall Microsoft Access to rebuild the

   MSACC20.INI file.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

NOTE: These steps assume that the Microsoft Access version 1.x MSACCESS.INI

file exists in your Windows directory.

1. In Windows File Manager, select the MSACC20.INI file in your Windows

   directory and rename it to some other name.

2. Start Microsoft Access version 2.0. The error messages stated above

   will be generated.

3. Quit Microsoft Access.

4. In File Manager, rename the file that you changed in step 1 back to

   MSACC20.INI.

REFERENCES

==========

For more information about the MSACC20.INI file, search for "INI files"

then "Customizing MSACC20.INI Settings" using the Microsoft Access Help

menu.

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: StpErr


PRB: "Couldn't Find Installable ISAM" Error Message

Article ID: Q90111

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Importing, exporting, or attaching a file using an indexed sequential

access method (ISAM) driver returns an error message if Microsoft Access

cannot find the ISAM driver.

CAUSE

=====

ISAM drivers are used by Microsoft Access to update file formats other than

its own. If the path to the ISAM driver in your MSACCESS.INI (Microsoft

Access version 1.x) or MSACC20.INI (version 2.0) file is invalid, or the

ISAM driver does not exist, you will receive the following error message:

   Couldn't find installable ISAM.

This error can also be caused by entering an invalid database name for a

SQL database when you are using the TransferDatabase action in a macro.

When you use an invalid connect string, Microsoft Access looks for an

installable ISAM for the SQL database. If an installable ISAM cannot be

located, the error message stated above will occur.

RESOLUTION

==========

Edit the .INI file to specify the correct path in the [Installable ISAMs]

section, or reinstall Microsoft Access using the Custom option.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open any database.

2. Create a new macro.

3. Select TransferDatabase as the action. Set the following arguments:

      Transfer Type: Import, Export, or Attach

      Database Type: <SQL Database>

      Database Name: pubs

      Object Type: Table

      Source: db.authors

      Destination: Test

      Structure Only: No

4. Save and run the macro.

You get the error message "Couldn't find installable ISAM."

The invalid database name argument for a SQL database causes the error.

To enter a valid database name, you must include the entire ODBC connection

string for the attached SQL table.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 4, "Importing,

Exporting, and Attaching," pages 60-69

Microsoft Access "User's Guide," version 2.0, Chapter 9, "Importing,

Exporting, and Attaching," pages 159-174

For more information about the TransferDatabase action, search for

"TransferDatabase" then "TransferDatabase Action" using the Microsoft

Access Help menu.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: "Couldn't Find Object <Tablename>" Error with Btrieve

Article ID: Q93685

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you import or attach Btrieve files, you receive the following error

message:

   Couldn't find object <tablename>

CAUSE

=====

1. Microsoft Access requires all three Xtrieve data dictionary files

   (FILE.DDF, INDEX.DDF, and FIELDS.DDF) in order to import or attach

   Btrieve files. The path statements in FILE.DDF may not be correct

   for the current environment.

   -or-

2. The descriptive Btrieve table name begins with a SQL keyword that

   causes Microsoft Access to return the above error message.

RESOLUTION

==========

1. Inspect the path statements in FILE.DDF. Either move the Btrieve

   data files to the locations specified in FILE.DDF, or use Btrieve

   or a third-party tool to modify the FILE.DDF file so that the path

   statements to the data files are correct.

2. Check the descriptive Btrieve table name to see if it begins with

   any of the following SQL keywords: Select, Insert, In, Update,

   Alter, Transform, Delete, Create, Drop, Procedures, or Parameters.

MORE INFORMATION

================

Cause 1

-------

Microsoft Access requires all three Xtrieve data dictionary files

(FILE.DDF, INDEX.DDF, and FIELDS.DDF) to be able to import or attach

Btrieve files.

FILE.DDF contains the MS-DOS filename of each data table in the

dictionary. These filenames can be in any of the following valid

MS-DOS formats:

 - File Only (for example, MYDATA.DAT)

 - Relative Path (for example, ..\DEV\TEST\MYDATA.DAT)

 - Fully qualified (for example, C:\TOOLS\DEV\TEST\MYDATA.DAT)

 - Universal Naming Convention (UNC) (for example,

   (\\MYSERVER\USERS\JOE\TOOLS\DEV\TEST\MYDATA.DAT)

When you are importing or attaching a Btrieve file, Microsoft Access

retrieves the MS-DOS filename from FILE.DDF and attempts to open the file.

If the file does not exist in the location specified, you will see this

error message:

   Couldn't find object

In the case of the File Only and Relative Path formats, the ability to

open the file depends on the accuracy of the current directory. For

example, in the File Only format, MYDATA.DAT must exist in the current

directory. In the Relative Path format, MYDATA.DAT must exist in the

..\DEV\TEST directory, which in turn must exist relative to the

current directory.

Exactly which directory is the current directory is complicated by the

fact that Windows-based applications all share the same environment

and the same current directory. For example, if you change the current

directory in Microsoft Excel by choosing Open from the File menu and

changing directories to open a file, you also change the current

directory for Microsoft Access.

Therefore, to fix the problem, you need to find out what path

statements are included in FILE.DDF. You can do this by opening

FILE.DDF in Microsoft Write, the word processor provided with Windows.

When Microsoft Write asks if you want to convert this file to

Microsoft Write format, choose No Conversion.

WARNING: Do not save the file after you finish viewing it with

Microsoft Write. If you do, you will corrupt FILE.DDF beyond repair.

After opening FILE.DDF in Microsoft Write, you will see several

characters that look like a box. Scroll to the end of the file. There

you will see the MS-DOS file names of the Btrieve data files. The

extension is usually .DAT, but it does not have to be. Once you have

noted the names and paths, close FILE.DDF taking care NOT to save the

changes.

Now that you have the file names, here are two things you can do

to fix the problem:

1. Move the files into the correct location(s). This is the easiest

   method and the one Microsoft recommends.

2. Use Btrieve or a third-party tool to modify the FILE.DDF file so

   that the paths are correct. This method is much more complicated.

   Microsoft recommends you do not attempt them unless you are a

   Btrieve expert.

Cause 2

-------

When you first attach a Btrieve table, Microsoft Access displays the

descriptive table name, which is different than the DOS filename for the

Btrieve table. For example, "IN Product File" is the descriptive name while

INPRODUC.DAT is the DOS filename.

Microsoft Access reads in the descriptive name during the initial

attachment and checks the name to see if it is a SQL keyword. If it

is, Microsoft Access will return the above error message.

Therefore, to fix the problem, you will need to modify the descriptive

name to change it to another name that does not conflict with any of

the SQL keywords listed above. Using the above example, change the

descriptive name from "IN Product File" to "IN_Product File."

You will need to use Btrieve or a third-party tool to modify the

FILE.DDF file to change the descriptive name. This method is

complicated and Microsoft recommends you do not attempt this unless

you are a Btrieve expert.

Additional reference words: 1.00 1.10 2.00 novell ddf 3rdparty errmsg

KBCategory:

KBSubcategory: IsmBtrv


PRB: "Couldn't Lock File; SHARE.EXE Hasn't Been Loaded" Error

Article ID: Q116387

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to open a Microsoft Access database, you receive the following

error message even though you are running SHARE.EXE or VSHARE.386:

   Couldn't lock file; SHARE.EXE hasn't been loaded.

CAUSE

=====

This error can occur if Microsoft Access cannot perform record locking on

the database's corresponding .LDB file. If, for example, the .LDB file is

set to read-only, either on your local hard disk or on a network server,

this problem will occur.

With an administrative network setup (setup /a), the .LDB files under

the \WORKDIR directory are not created until the first user opens

Microsoft Access. This error can also occur if the first user does not

have Create rights.

RESOLUTION

==========

Set the .LDB file to read-write, not read-only.

MORE INFORMATION

================

Microsoft Access may automatically create a locking information (.LDB) file

for a database. This file will have the same name as the database itself,

but will have an .LDB extension, and will be created in the same directory

as the database.

Even if an .LDB file on a network server is set to read-write, network

security may cause Microsoft Access to behave as if the file were read-

only.

Follow these steps to check whether an .LDB file is read-write or read-

only:

1. Start File Manager.

2. Locate and then select the .LDB file.

3. From the File menu, choose Properties. If the Read Only check box is

   selected, clear the check box to set the file to read-write.

REFERENCES

==========

For more information about .LDB files, search for "LDB files" then "Locking

Information Files (Common Questions)" using the Microsoft Access Help menu.

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: EvnOthr


PRB: "Couldn't Open File" Error Message Using Paradox Table

Article ID: Q91711

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

----------------------------------------------------------------------

SYMPTOMS

========

You cannot open an attached Paradox table from within Microsoft Access, or

you experience an "Unexpected Condition" error message in Paradox when you

attempt to view a table.

Paradox and Microsoft Access should be able to simultaneously access the

same Paradox tables if there is only one PARADOX.NET file in use by both

programs.

CAUSE

=====

Microsoft Access

----------------

If you receive the error message "Couldn't open file 'filename'" when you

try to open an attached Paradox table while you are in Microsoft Access,

you may have two PARADOX.NET files. In this case, Microsoft Access may be

using one PARADOX.NET file while Paradox is using the other.

There are other conditions that can cause this error message as well. For

more information, search for "Error Messages Reference" using the Microsoft

Access Help menu.

Paradox

-------

If you receive an error message similar to

   Unexpected condition: File open (I104) - c:\pdoxdata\yourfile.db

   (Code 5) -- Leaving Paradox

when you attempt to open a table while you are in Paradox, the cause is the

same as above: there are two PARADOX.NET files, with Microsoft Access using

one and Paradox using the other.

RESOLUTION

==========

When you attach a Paradox version 3.0 or 3.5 table (<filename>.DB)

in Microsoft Access, file locking information is maintained by

PARADOX.NET, the Paradox network control file. Paradox requires this

file in network environments, but it is also used in stand-alone

configurations.

Microsoft Access creates a PARADOX.NET file in the Microsoft Access

program directory the first time you try to access Paradox data. An entry

is made in the MSACCESS.INI file in the [Paradox ISAM] section pointing

to the location of the file. The MSACCESS.INI file should be in your

Windows directory. The entry will be similar to:

   [Paradox ISAM]

   ParadoxNetPath=C:\ACCESS\

Paradox also installs a PARADOX.NET file during normal installation.

By default it will be located in the Paradox program directory. The

location of this file is determined by the network administrator

during a network installation.

To redirect Microsoft Access to the location of the PARADOX.NET file

that Paradox installed, edit the MSACCESS.INI file in any text editor,

such as Notepad, and change the path. Do not include the name of the

file.

To change the Paradox configuration to point to the Microsoft Access

PARADOX.NET file, run the NUPDATE.EXE utility. Refer to the Paradox

"Network Administrator's Guide" for more information on this topic.

Additional reference words: 1.00 1.10 2.00 ISAM PDOX

KBCategory:

KBSubcategory: IsmPdox


PRB: "Couldn't Update; Currently Locked by User" Error Message

Article ID: Q94080

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The following message appears either when two users simultaneously try to

update a similar object in a shared database, or on a single-user system if

the system runs out of locks:

   Couldn't update; currently locked by user '<user name>' on machine

   '<machine name>'

CAUSE

=====

On a multiuser system, a conflict exists with the SYSTEM.MDA file.

By design, Microsoft Access cannot simultaneously update the

MsysObjects table in the SYSTEM.MDA file for multiple users.

On a single-user system, there are not enough locks specified in the

AUTOEXEC.BAT file.

RESOLUTION

==========

Multiuser System

----------------

On a multiuser system, try saving the object again. If no one is

updating a similar object at the same time, the Save command should

work. This error can occur in Access Basic code also, so you will need

to handle error trapping for this.

Single-User System

------------------

1. Exit Windows.

2. Delete all the .LDB files from the Microsoft Access directory.

3. Delete all the .TMP files from the Windows directory and from the

   WINDOWS\TEMP directory.

4. Edit the AUTOEXEC.BAT file. Look for a line similar to:

      C:\DOS\SHARE.EXE

   Add "/L:500" (without quotation marks) to the end of the line, so it

   reads:

      C:\DOS\SHARE.EXE /L:500

   Note that this line will not be present if you run VSHARE.EXE, OS/2,

   or you are running on a network.

5. After saving the AUTOEXEC.BAT file, restart your computer.

MORE INFORMATION

================

The SYSTEM.MDA file conflict is likely to occur only on systems with

many (100+) users.

Steps to Reproduce Behavior

---------------------------

1. User A and user B open the same database on a shared drive.

2. Both users create a new object of similar type (such as a table,

   form, report, query, or macro).

3. Both users choose Save from the File menu and enter a unique filename.

4. Simultaneously, user A and user B press ENTER to update the object.

5. Microsoft Access presents the error message listed above. Choose OK

   to dismiss the message and try again.

Additional reference words: 1.00 1.10 2.00 network errmsg

KBCategory:

KBSubcategory: GnlMu


PRB: "Field0" Appears in a Query But Not in the Source Table

Article ID: Q89686

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The resulting Datasheet view of a query reveals that a field called

Field<n> (where n is a number, for example, Field0) exists, but

you do not have a field by that name in the source table. The

SELECT statement of this query includes an asterisk (*) to indicate

that all fields should be displayed.

CAUSE

=====

The resulting data set of a query cannot contain two columns with

the same name. When you create an SQL statement with an asterisk as

the result of dragging the asterisk from the field list to a

column in the query grid, then you include another field from the

same table, there are in effect two fields with the same name. The

first field is from the group of fields represented by the

asterisk, and the second field is the one that was explicitly

included in the query grid. Note that this could also occur if you

try to add a field to the grid that is already there.

Rather than present an error message indicating that there are two

columns with the same name in the view, Access substitutes the name

of the second and subsequent duplicate fields with Field<n>.

RESOLUTION

==========

If you want to have the datasheet display a more meaningful name

than Field<n>, do the following (the steps below assume that you

have included an asterisk in the query grid and that you are ready

to add the duplicate field):

1. In the column of the query grid where the duplicate field is to

   appear, type the name of the heading you want to see in the

   datasheet followed by a colon (:). For example:

      EmployeeName2:

2. Following the colon, type the name of the field value you want

   to appear in this column.

When you display the query in datasheet mode, the field will

display with the alias name given in step 1.

Additional reference words: 1.00 1.10 2.00 crosstab xtab

KBCategory:

KBSubcategory: QryOthr


PRB: "Internal Database Error (-5001)" Msg Using Btrieve NLM

Article ID: Q97531

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when you are using the Btrieve

Network Loadable Module (NLM) with Microsoft Access version 1.0:

   Internal Database Error (-5001)

NOTE: You might also encounter an "Unexpected Error from External Database

Driver [1017]" error message if you are missing the WBTRVRES.DLL file. This

message occurs in Microsoft Access versions 1.0, 1.1, and 2.0.

CAUSE

=====

You do not have correct versions of the BREQUEST.EXE, WBTRCALL.DLL,

and WBTRVRES.DLL files. In order for the Btrieve NLM to function

properly with Microsoft Access, Microsoft recommends that the NLM

requester (client) use BREQUEST.EXE, WBTRCALL.DLL, WBTRVRES.DLL

version 6.0, and BTRIEVE.NLM version 5.15.

RESOLUTION

==========

Use the following procedure to obtain the correct versions of these

Btrieve files:

1. Sign on to CompuServe.

2. At the exclamation point (!) prompt, type "go novlib" (without the

   quotation marks).

3. Choose the BTRIEVE/XQL library section.

4. Download the BT515.EXE file and place it in an empty directory.

   Then unzip the file by running BT515.EXE. BT515.EXE is a

   self-extracting zip file and will extract several files and place

   them in directories.

5. After the files are extracted, follow the instructions in the

   BT515.TXT file to properly install these files and for information

   on how to apply patches to the BTRIEVE.NLM file on your server.

6. Add the following lines to your WIN.INI file:

      [BREQUESTDPMI]

      datalength=4096

      tasks=10

      local=no

      chkparms=no

MORE INFORMATION

================

Btrieve and the Btrieve NLM are manufactured by Novell, Inc., a

company independent of Microsoft; we make no warranty, implied or

otherwise, regarding these products' performance or reliability.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: IsmBtrv


PRB: "Invalid String or Buffer Length" Using Raima ODBC Driver

Article ID: Q116066

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when you try to import from, export

to, or attach a Raima Data Server table using version 1.x of Raima

Corporation's ODBC driver:

   ODBC call failed

After choosing OK, you receive the following message:

   [Raima ODBC RDS SQL Driver] Invalid string or buffer length [#15016]

CAUSE

=====

Raima Corporation's ODBC driver does not allow spaces in the data source

name.

RESOLUTION

==========

Modify the data source name by double-clicking the ODBC icon in Windows

Control Panel. In the Data Source box, select the Raima data source, and

then choose Setup. In the Data Source Name box, modify the data source name

so that it contains no spaces and is 32 characters or less in length.

MORE INFORMATION

================

The ODBC driver mentioned in this article is manufactured by Raima

Corporation, a vendor independent of Microsoft; we make no warranty,

implied or otherwise, regarding this product's performance or reliability.

REFERENCES

==========

For more information about Raima Corporation's ODBC driver, check the

driver documentation or contact Raima Corporation at (206) 557-0200.

Additional reference words: 1.10 2.00 third-party errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: "Invalid Use of Null" or "#Error" in Defined Function

Article ID: Q103432

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A user-defined function may return either of these error messages: "Invalid

Use of Null!" or "#Error."

CAUSE

=====

If a field's data type is explicitly defined as any type other than

Variant, Microsoft Access is unable to compare the variable to null.

RESOLUTION

==========

Define the variable as Variant, which includes date/time, floating-point

number, and string data types.

More Information

================

If the following function is used to evaluate a field that may return a

null value, the function will return the error "Invalid Use of Null!" or

"#Error" if the field is null:

   Function IsFieldNull (MyValue As String)

      If IsNull(MyValue) Then

         IsFieldNull = "The field is null!"

      Else

         IsFieldNull = "The field is not null!"

      End If

   End Function

Defining the variable MyValue as Variant by using the method in the

following function will prevent the error "Invalid Use of Null!" or

"#Error" even if the field is null:

   Function IsFieldNull (MyValue As Variant)

      If IsNull(MyValue) Then

         IsFieldNull = "The field is null!"

      Else

         IsFieldNull = "The field is not null!"

      End If

   End Function

REFERENCES

==========

Microsoft Access "Introduction to Programming," Chapter 5

Additional reference words: 1.00 1.10 2.00 pounderror

KBCategory:

KBSubcategory: PgmOthr


PRB: "Not Enough Memory to Run SETUP.EXE" Error Message

Article ID: Q94928

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

An attempt to run the Microsoft Access Setup program fails and

Setup displays one of the following out-of-memory error messages:

   Insufficient Memory

    -or-

   Not enough memory to run SETUP.EXE

When this error occurs, sufficient space is available on the disk

you are installing Microsoft Access to and your AUTOEXEC.BAT file

contains a valid SET TEMP statement that specifies a directory that

has free disk space.

CAUSE

=====

One cause of this error relates to an incorrect CMOS setting for

the floppy disk drive from which Microsoft Access is installed.

RESOLUTION

==========

Modify the CMOS setting to correctly configure the disk drive. If

you need assistance to change the settings appropriately, contact

your dealer or hardware manufacturer.

MORE INFORMATION

================

The error messages above can occur when you install Microsoft Access

from a 1.2 MB disk drive and the CMOS setting for that drive indicates

that it is a 360 KB disk drive.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: StpOthr


PRB: "Obsolete Database Format" Error Message from MS Query

Article ID: Q115900

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run a query against a Microsoft Access database from Microsoft

Word for Windows, Microsoft Excel, or Microsoft Query, you receive the

error message "Obsolete Database Format."

CAUSE

=====

You have not selected the correct database type.

RESOLUTION

==========

If you are trying to query against a Microsoft Access 1.x database, change

the database type from Access 2.0 Database to Access Database.

If you are trying to query against a Microsoft Access 2.0 database, change

the database type from Access Database to Access 2.0 Database.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: IntpOthr


PRB: "ODBC Call Failed" When Exporting Table to SQL Server

Article ID: Q109341

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the error message "ODBC - Call failed" when you export a

Microsoft Access table to a SQL Server database using ODBC if the table

field names are SQL reserved words. This error message is followed by

another which reads:

   [Microsoft][ODBC SQL Server Driver][SQL Server] Incorrect syntax

   near the keyword '<keyword>'. (#156)

CAUSE

=====

This problem will occur if the table you are exporting contains a field

name that is also an SQL keyword. The Microsoft ODBC driver for SQL Server

translates the export command into an SQL statement that can be interpreted

by the SQL Server. If a field name in the Microsoft Access table is an SQL

keyword, the SQL Server will interpret the field name as an SQL command

keyword.

RESOLUTION

==========

Rename the fields in the Microsoft Access table to non-SQL reserved words.

Field names such as Order, In, From, or Where should not be used when

you create Microsoft Access tables.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a new table with a field named Order.

2. Save the table with the name Test Table.

3. From the File menu, choose Export.

4. In the Data Destination box select <SQL Database>, and then choose OK.

5. In the Select Microsoft Access Object box, choose Test Table. Choose OK.

6. In the Export dialog box, choose OK.

7. In the SQL Data Sources dialog box, select a SQL Server. Choose OK.

8. If necessary, log on to the SQL Server using the SQL Server Login

   dialog box.

The error messages stated above will be displayed.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


PRB: "ORA-00904: Invalid Column Name" Error Message in Query

Article ID: Q108439

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you have a query based on an attached Oracle synonym that has a sort on

a column name, and the owner of the synonym has read-only permissions on

the table on which the synonym is based, you will receive the error

messages:

   ODBC - call failed

   -and-

   [PageAhead][ODBC Oracle Driver][Oracle OCI]ORA-00904: invalid

   column name. [#904]

CAUSE

=====

This error occurs because the owner of the synonym has read-only

permissions on the Oracle table on which the synonym is based.

RESOLUTION

==========

There are four ways to correct this problem:

 - Create a Public synonym in Oracle.

 - In Microsoft Access, attach directly to the table on which the

   synonym is based.

 - In Oracle, assign the owner of the synonym permissions greater

   than read-only.

 - In Microsoft Access, remove the "order by" clause from the

   query.

MORE INFORMATION

================

The following is an example of an SQL statement that will cause this

error:

   SELECT * FROM <owner>.<synonym_name>

      ORDER BY <owner>.<synonym_name>.<column_name>

Note that the same errors will occur if this command is issued in SQL*DBA

or SQL*PLUS, which are Oracle's interface tools. If you remove the ORDER BY

clause, the statement will run. The statement will run with the ORDER BY

clause if you remove the <owner>. clause instead. The statement will run

with all the clauses included if you increase the owner's permissions on

the table on which the query is based.

Steps to Reproduce Behavior

---------------------------

1. In Oracle, create a table. Assign all permissions on the table to user

   A, and read-only permissions to user B.

2. Log into Oracle as user A. Create synonym A based on the new table.

3. Log into Oracle as user B. Create synonym B based on the new table.

4. Start Microsoft Access. Attach synonym A with user A's login account.

   Create a query based on synonym A with a sort on one of the columns.

5. Run the query. Note that the query runs correctly.

6. Attach synonym B with user B's login account. Create a query based on

   synonym B with a sort on one of the columns.

7. Run the query. The error messages stated above will occur.

NOTE: You can reproduce this behavior in Oracle's SQL*DBA as well. To do

so, connect as user A and issue the following command:

  SELECT * FROM userA.synonymA ORDER BY userA.synonymA.column1;

Note that the command runs correctly. Next, connect as user B and issue the

following command:

  SELECT * FROM userB.synonymB ORDER BY userB.synonymB.column1;

An error message will occur.

Additional reference words: 1.10 2.00 ADK errmsg

KBCategory:

KBSubcategory: IntpOthr


PRB: "Out of Memory" Error Message Loading Large Module

Article ID: Q114515

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You get an "Out of Memory" error message when you attempt to load a large

module when Microsoft Access Wizards (such as the Form Wizard or Report

Wizard) are loaded.

RESOLUTION

==========

Break up large modules into multiple smaller modules. Also, load as few

Wizards as possible when dealing with large modules.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

2.0. We are researching this problem and will post new information here in

the Microsoft Knowledge Base as it becomes available.

Additional reference words: 2.00 errmsg oom

KBCategory:

KBSubcategory: PgmObj


PRB: "Out of Memory" or "Query Too Complex" Running Report

Article ID: Q103429

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive an "Out of Memory" or "Query too Complex" error message when

you run your report.

CAUSE

=====

Reports create temporary queries for each section of the report, including

the report header, page header, group header, detail section, group footer,

page footer, and report footer.

All of the temporary queries for each report are combined into a segmented

virtual table (SVT). The final output must be compiled within a 64K segment

limit. When this limit is reached, you may see either the "Query too

Complex," or the "Out of Memory" error message.

Similar 64k limits are used to compile and store all of the expressions

from page to page when the report is being processed or to store the

unbound controls or label information. If any of these segments exceed the

limit, controls on the report may start displaying the "#Name?" error

message.

RESOLUTION

==========

The error messages stated above are related to the complexity of the

underlying query or the report itself. The following items suggest several

ways to reduce the complexity of your queries or report:

 - Shorten table names, column names, and control names. Reducing a

   30-character name to the minimum length may help.

 - Reduce the number of text fields on the report.

 - Avoid extra overhead by removing any fields in the underlying query

   that are not used in the final output for the report.

 - Reduce expressions in underlying queries. Reducing space used for

   expressions in the select list helps to avoid these errors. If

   possible, place the expressions directly in the report.

 - Move complex expressions to a user-defined function that does all the

   evaluation.

 - Avoid stacked query objects, such as situations in which Query1 is

   used to pull data from Table2, where Query2 filters the data.

   Pulling information together in one query is preferable to having

   multiple queries each doing portions of the task.

 - Avoid basing main reports and their subreports on the same queries.

   Look for stacked query objects and for tables that are unnecessary

   to the subset.

 - Use subreports to break up a complex report into several less

   complicated reports.

 - If the report is based on a query, build a temporary table from the

   query to base the report on instead of the query. Create a Make Table

   query that includes all the fields from the original query to build

   the temporary table.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptOthr


PRB: "Out of Stack Memory" Error Message with SendKeys Macro

Article ID: Q101067

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when choosing a command

button:

   Not enough stack memory left

This problem occurs when you activate a macro from the OnPush property in

version 1.x, or the OnClick property in version 2.0, of a command button on

a form. The macro includes a SendKeys action, in which the keystrokes sent

include the ESC key and the Wait argument is set to Yes.

CAUSE

=====

The Cancel property of the command button is set to Yes.

RESOLUTION

==========

Change the Cancel property of the command button to No.

MORE INFORMATION

================

You receive the above error message if you choose a command button and

all the following conditions are met:

 - The macro attached to the command button includes a SendKeys action.

 - The command button's Cancel property is set to Yes.

 - You choose the command button by pressing ESC.

If the command button activates a macro that performs a SendKeys action,

which in turn sends an ESC keystroke, the button that repeatedly activates

the macro is chosen and an endless loop results. Note that if the Wait

argument on the SendKeys action is set to No, Microsoft Access will appear

to hang.

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new macro called Test Macro:

      Test Macro Actions

      ------------------

      SendKeys

         Keystrokes: {esc}

         Wait: Yes

3. Open the Customers form in Design view.

4. Add a command button to the form:

      Object: Command Button

      ----------------------

      ControlName: Test Button

        Caption: Test Button

        OnPush: Test Macro (version 1.x)

        OnClick: Test Macro (version 2.0)

        Cancel: Yes

5. Switch to Form view.

6. Choose the Test button. The following error message appears:

      Not enough stack memory left

REFERENCES

==========

Microsoft Access "Language Reference," versions 1.0 and 1.1, page 59

Additional reference words: 1.00 1.10 2.00 macro

KBCategory:

KBSubcategory: McrArg


PRB: "Output To" of Print Definition Contains Only Headers

Article ID: Q112794

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you use the Output To command to create an output file from a Print

Definition report, the file contains pages that have only headers. The rest

of each page is blank.

CAUSE

=====

All the information in Print Definition reports, except for the header, is

contained in subreports. The Output To command does not support subforms or

subreports. Print Definition reports cannot be saved because they are

created temporarily in a library database.

RESOLUTION

==========

You can work around this design limitation by saving the Print Definition

report as a table, or by printing it to a file. Both of these methods are

described below.

Saving the Print Definition Report as a Table

---------------------------------------------

When you preview a Print Definition report, the Save As Table command is

available in the File menu. Choosing this command saves the contents of the

Print Definition report as a table named Object Definition. If a table

already exists with this name, the new table is named Object Definition1.

You can create your own queries and reports on the Object Definition table

to analyze the structure of your database objects.

Printing the Print Definition Report to a File

----------------------------------------------

To print the Print Definition report to a file, open the report and use the

Output To command to print it to a text file using the Windows Generic

print driver attached to the FILE port.

For more information about how to print to a text file using the Windows

Generic printer, query on the following words here in the Microsoft

Knowledge Base:

   print and file and generic

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. In the Database window, select the Shippers table.

3. From the File menu, choose Print Definition, then choose OK.

4. Choose either the Publish It With MS Word or the Analyze It With

   MS Excel button on the tool bar.

   NOTE: If you do not have either Microsoft Word for Windows or

   Microsoft Excel installed on your computer, you can add a button to

   the tool bar to output text files. To do this, click the right mouse

   button on the tool bar, choose Customize, choose File in the

   Categories box, and then drag the Output To Notepad button to the

   tool bar.

The file that is output will contain text similar to the following:

   C:\ACCESS\SAMPAPPS\NWIND.MDB            Friday, April 1,  1994

   Table: Shippers                                        Page: 1

Note that the page is blank except for the header.

REFERENCES

==========

For more information about the Output To command, search for "Output To"

then "Output To Command" using the Microsoft Access Help menu.

Additional reference words: 2.00 Printing OutputTo Output To

KBCategory:

KBSubcategory: GnlOthr


PRB: "Page, Pages Properties" Help Topic Misleading

Article ID: Q114219

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The "Usage" section of the "Page, Pages Properties" Help system topic

correctly states that the Page and Pages properties are not available in

Design view. However, it then states:

   In other views, the Page property is read/write and the Pages

   property is read-only.

RESOLUTION

==========

This sentence is misleading, because these properties are available only

when you are printing or previewing. So, for forms, the Page and Pages

properties are not available in Form or Datasheet views.

REFERENCES

==========

For more information about the Page and Pages properties, search for "Page"

then "Page, Pages Properties" using the Microsoft Access Help menu.

Additional reference words: 2.00 docerr

KBCategory:

KBSubcategory: DcmOthr


PRB: "Record Lock Threshold Exceeded" with Large Action Query

Article ID: Q102522

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you exceed the maximum number of locks set per connection for the

Novell server, you will get the following error message on the server:

   Record Lock threshold exceeded

This error can also cause the Novell server to crash.

RESOLUTION

==========

To solve this problem, use the following steps:

1. Obtain the TTSFIX.NLM dynamic patch, either directly from Novell or

   from CompuServe. On CompuServe, look for 311PTD.ZIP in the NOVFILES

   forum.

2. Set the Record Lock threshold to some high value greater than the

   default of 500, preferably between 6,000 and 10,000, even though

   the server should no longer crash. However, Microsoft Access may

   still encounter problems when the server exceeds the lock count.

   There are no reports of any problems with the Record Lock threshold

   set to a high value. Even with this maximum set, if the threshold

   is reached, Microsoft Access will stop; with the fix, the Novell

   network will not crash.

3. Load the TTSFIX.NLM dynamic patch on the server to ensure that it

   will not crash if a lock count is exceeded.

   NOTE: The 311LPTD.ZIP file also contains PATCHMAN.NLM and

   TTSFIX.NLM. We recommend that these files be loaded in the

   AUTOEXEC.NCF of the server. This action requires a LOAD

   PATCHMAN.NLM, followed by a LOAD TTSFIX.NLM in the AUTOEXEC.NCF.

The following table details possible lock settings:

                                            Range        Defaults

                                            ---------------------------

#1 SET Maximum record locks per connection: 10-10,000    default 500

#2 SET Maximum file locks per connection:   10-1,000     default 250

#3 SET Maximum record locks:                100-200,000  default 20,000

#4 SET Maximum file locks:                  100-100,000  default 10,000

#1 is the setting that should be increased from the default to some

value within the 6,000 to 10,000 range.

NOTE: This problem is related to the record locks setting on the Novell

server. This problem is not related to the MS-DOS SHARE.EXE locks setting.

Additional reference words: 1.00 1.10 2.00 errmsg novell server 3.11

out of memory

KBCategory:

KBSubcategory: GnlMu


PRB: "Save Changes to Form" Prompt When No Changes Made

Article ID: Q115876

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Each time you open a form in Form view and then close it, you are prompted

to save the changes to the form, even if you have not made any changes to

the form.

CAUSE

=====

The form contains an OLE Object, and the object frame's Locked property is

set to No.

RESOLUTION

==========

To keep from being prompted to save your changes each time you close the

form, set the object frame's Enabled property to No and its Locked property

to Yes. Note that if you set both the Enabled and the Locked properties to

Yes, you will receive the following message when you close the form, and

any changes to the form will be discarded:

   The object is locked and any changes made will be discarded

   when the form is closed.

Workaround to Allow Editing

---------------------------

The following example demonstrates how to keep from being prompted to save

your changes each time you close the form, but still allow changes to be

made to the form.

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

1. Open the Sales By Product form in Design view.

2. Add a new command button to the form.

3. Click the right mouse button on the new command button. Choose Build

   Event, then select Code Builder and choose OK. Enter the following

   code in the module:

      Me!Embedded13.Enabled = -1

      Me!Embedded13.Locked = 0

      DoCmd GoToControl "Embedded13"

4. Close the module.

5. Set the graph object's Enabled property to No and its Locked

   property to Yes.

6. Set the graph object's OnExit property to the following event

   procedure:

      DoCmd GoToControl "Product Name"

      Me!Embedded13.Enabled = 0

      Me!Embedded13.Locked = -1

      SendKeys "%FS"

   To create this event procedure, click in the OnExit property field,

   then choose the Build button at the right side of the field. Select

   Code Builder, and then choose OK. Enter the code in the module, and

   then close the module.

7. Save and then close the form.

When you open the form, the graph will not be enabled. If you close the

form, you will not be prompted to save your changes. However, if you choose

the new command button, the graph will be enabled. When you select a

different control on the form, the graph will be locked and the form will

be saved.

Note that if you choose the command button and then immediately close the

form, you will be prompted to save your changes. This is due to the timing

of the OnExit property.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Open the Sales By Product form.

3. Close the form without making any changes. Note that you are prompted

   to save your changes even though you did not make any.

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsOthr


PRB: "Setup Parse Error..." Error Message in Run-Time Setup

Article ID: Q116063

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are running Setup from disks you created with the Microsoft Access

Developer's Toolkit, you receive the following error message after the

"Setup is searching for installed components" screen:

   Setup Parse Error in Initialize Path Object ID 1: AppSearch Object:

   Bad Default Path Field.

After this error message, Setup quits without completing.

CAUSE

=====

When you ran the Setup Wizard to create the disks, you specified C:\ as

the default installation directory, or you specified a directory name that

is more than eight characters long. For example, specifying the directory

C:\MYPROGRAM would cause the error message to occur.

RESOLUTION

==========

Create a new set of installation disks. In the Setup Wizard's Default

Installation Directory box, make sure to specify the full path name for the

directory into which your application should be installed (for example,

C:\MYAPP).

REFERENCES

==========

Microsoft Access Developer's Toolkit "Advanced Topics," version 2.0,

Chapter 2, "Creating a Custom Setup Program"

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: StpOthr


PRB: "Table Exclusively Locked" Error Switching to Form View

Article ID: Q97513

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

An attempt to switch from Design view to Form view fails and

Microsoft Access generates the following message:

   Table <tablename> is exclusively locked

CAUSE

=====

The form's RecordSource property refers to a table that remains

open in Design view.

RESOLUTION

==========

Perform one of the following three procedures to address this

behavior:

 - Close the open table.

 - Change the open table to Datasheet view.

 - Open the form before opening the table (this opens the table in

   Design view for read-only access).

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: FmsOthr


PRB: "Unexpected Error from External Database Driver [20]"

Article ID: Q100173

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are using the network loadable module (NLM) version of

Btrieve and try to import, export, or attach a Btrieve table you

receive the error message "Unexpected error from external database

driver [20]."

CAUSE

=====

Btrieve returns this error message if you try to access Btrieve data

with Microsoft Access before loading the BREQUEST.EXE program. The

Xtrieve manual lists this error with the following description:

   20  Record Manager inactive.

       You made a request before starting the Record Manager.

       Restart the Record Manager.

RESOLUTION

==========

You must start the BREQUEST.EXE program before starting Microsoft

Windows. You may want to create a batch file to execute the

BREQUEST.EXE program before starting Windows.

This error can also occur if the NLM version of the WBTRCALL.DLL file is

used on a non-NLM version of Btrieve. The NLM version of WBTRCALL.DLL is

approximately 13K, while the non-NLM version of WBTRCALL.DLL is

approximately 51K. Verify that the NLM version of WBTRCALL.DLL is not in

the path prior to the non-NLM version to ensure that the correct version is

in use.

MORE INFORMATION

================

Btrieve is manufactured by Novell, a vendor independent of Microsoft;

we make no warranty, implied or otherwise, regarding this product's

performance or reliability.

REFERENCES

==========

For a complete list of Xtrieve error messages, refer to the Novell

Xtrieve manual, Appendix A.

Additional reference words: 1.10 2.00 brequest errmsg

KBCategory:

KBSubcategory: IsmBtrv


PRB: "Unexpected Error from External Database Driver [22]"

Article ID: Q101319

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to open an attached Btrieve table, you receive the

following error message:

  Unexpected error from external database driver [22]

CAUSE

=====

Btrieve returns this error message when there is a mismatch between

the FIELD.DDF file and the Btrieve data table. This problem usually

occurs when the internal structure of the Btrieve table has been

changed without corresponding changes having been made to the

FIELD.DDF file. The Xtrieve manual lists this error with the following

description:

   22  Data buffer length too short

       The data buffer parameter is not long enough to accommodate the

       length of the data record defined when the file was created.

       Verify that the length of the data buffer is at least as long

       as the file's defined record length.

RESOLUTION

==========

Make sure that the internal structural definition of the Btrieve table

is the same as the FIELD.DDF file. This can be done using Novell's

Xtrieve program or a third-party DDF builder to update the FIELD.DDF

file.

MORE INFORMATION

================

Btrieve is manufactured by Novell, a vendor independent of Microsoft;

we make no warranty, implied or otherwise, regarding this product's

performance or reliability.

REFERENCES

==========

For a complete list of Xtrieve error messages, refer to the Novell

Xtrieve manual, Appendix A.

Additional reference words: 1.10 2.00

KBCategory:

KBSubcategory: IsmBtrv


PRB: #Error When Control Name Used in ControlSource Expression

Article ID: Q90860

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A field resulting in "#Error" will be created when the ControlSource

property (bound field) contains the ControlName property in version 1.x, or

the Name property in version 2.0, in an expression. However, in an unbound

text box, the same expression generates the expected value rather than

"#Error."

CAUSE

=====

There is a circular dependency in either a form or a report. Control names

take precedence over field names when binding. Microsoft Access currently

does not provide a more descriptive error for circular references.

RESOLUTION

==========

If you need to reference the ControlName (in version 1.x) or the Name (in

version 2.0) property in an expression, use an unbound text box. Otherwise,

reconstruct the ControlSource property expression so that it does not

reference the ControlName or Name property. Another alternative is to

change

the ControlName on the form.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

If you create a bound form and drag a numeric field onto the form, by

default the ControlSource property and the ControlName or Name property

will be given the name of the actual field in the underlying table or

query. If you change the ControlSource property to an expression that

includes the ControlName or Name property, you will see "#Error" in this

field when you switch to Form or Datasheet view. The following example

demonstrates an expression within the ControlSource property:

   ControlName: Person_ID (version 1.x)

   Name:        Person_ID (version 2.0)

   ControlSource: =[Person_ID] + 1

Additional reference words: 1.00 1.10 2.00 pounderror

KBCategory:

KBSubcategory: ExrOthr


PRB: 'Unable to Load Communication Module'

Article ID: Q95612

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The following error message is displayed:

   Unable to load communication module.

   Driver has not been properly installed.

   Unable to connect to data source.

CAUSE

=====

The error occurs because the DBNMP3.DLL file you are using may be

old, you may have duplicate DBNMP3.DLL files on your system and the

wrong one is being used, or the DBNMP3.DLL file you are using may

be damaged or corrupted.

This error can also be caused by an incorrect [SQLSERVER] entry in

your WIN.INI file. This entry should look like:

   [SQLSERVER]

   MY_SERVER=DBNMP3,\\MY_SERVER\PIPE\SQL\QUERY

If there are any spaces in the above entry, or if DBNMP3 is

misspelled, you will receive the error.

RESOLUTION

==========

In Microsoft Access version 1.0, the DBNMP3.DLL file installed by

Microsoft Access version 1.0 is dated 9/15/92, has a size of 8241 bytes.

In Microsoft Access version 1.1, the DBNMP3.DLL file is dated 5/26/93

with a file size of 9941 bytes. In both versions, this file should be

installed in the \WINDOWS\SYSTEM directory.

MORE INFORMATION

================

It is possible that there are other situations that may indirectly

cause the above error message to display. To  troubleshoot this

problem, do the following:

 - Use File Manager to search for multiple, corrupted, or outdated

   copies of these files:

      Filename     Date              Size

      -----------------------------------

      ODBC.DLL     10/16/92 or later (44736 bytes)

      SQLSRVR.DLL  10/16/92 or later (135792 bytes)

      NETAPI.DLL   depends on the network being used

      COMMDLG.DLL  10/25/92 or later (89248 bytes)

      Note: The sizes and dates referenced are correct if the files

      are installed by Access version 1.0.

 - Make sure the files listed above are in their appropriate

   locations. All of the files except NETAPI.DLL are usually installed

   in the Windows \SYSTEM subdirectory. The NETAPI.DLL file is a

   network specific driver and is usually located in the network's

   program directory, which should be in the path.

 - Use another application, such as Q+E, SAF, or PowerBuilder, on the

   same machine to attempt to attach to the same data source. If you

   cannot access the data source from another application, then it is

   probably a problem with the network, such as NETAPI.DLL, or a

   problem with the server, not with Microsoft Access or ODBC.

 - Attempt to attach to another data source, if available, such as

   another SQL server. If you can attach to another server, then the

   original server may be down or you may need to reconfigure the entry

   for that server using the ODBC Administration Utility.

 - Attempt to attach to the same data source from another machine. If

   you cannot access the SQL server from another machine, it may

   indicate a network-wide problem or that the server is down or not

   communicating.

 - Try increasing your ODBC timeout settings in the ODBC section of

   the MSACCESS.INI file.

 - Check with the system administrator to see if the SQL server is up,

   available for transactions, and operating properly.

 - Reinstall ODBC after performing a clean boot and renaming the

   ODBC.DLL, DBNMP3.DLL, and SQLSRVR.DLL files.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 660-662

Additional reference words: 1.00 1.10 2.00 tshoot

KBCategory:

KBSubcategory: ObcOthr


PRB: AccessWizards Button Unavailable

Article ID: Q90097

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

----------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Access version 1.x, the FormWizards or ReportWizards button is

disabled and not available.

In Microsoft Access version 2.0, you receive the following error message:

   Cannot Find Wizard or Error in Wizard code. Check the [Libraries]

   section of your MSACC20.INI file.

CAUSE

=====

One reason for this behavior is that no table or query object exists in the

Database window. You can correct this by creating a table.

Another reason for this behavior is that the MSACCESS.INI file (or the

MSACC20.INI file in Microsoft Access version 2.0) is missing information in

its [Libraries] section.

RESOLUTION

==========

To check the .INI file, do the following:

In Microsoft Access version 1.x:

1. Open the MSACCESS.INI file in a text editor.

2. Find the [Libraries] section.

3. Verify that the following entry appears:

      [Libraries]

      wizard.mda = ro

In Microsoft Access version 2.0:

1. Open the MSACC20.INI file in a text editor.

2. Find the [Libraries] section.

3. Verify that the following entry appears:

      [Libraries]

      wzfrmrpt.mda = ro

Additional reference words: 1.00 1.10 2.00 report wizard grey disable

KBCategory:

KBSubcategory: FrmrptWzd


PRB: Activate, Deactivate Events Do Not Occur on Pop-Up Form

Article ID: Q117173

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The macro or Access Basic code specified by a pop-up form's OnActivate or

OnDeactivate property setting is not triggered as you expect.

CAUSE

=====

The Activate and Deactivate events are triggered only when you switch among

forms that are "child" forms of the Microsoft Access MDI window. Child

forms are forms that have a Windows window style of WS_CHILD, and whose

parent is the MDI window. Pop-up forms have a window style of WS_POPUP, and

are not governed by the same Windows MDI messages and events as child

windows.

RESOLUTION

==========

Instead of assigning your macro or Access Basic code to the pop-up form's

Activate or Deactivate event, try using the Open, Load, Resize, or Current

event instead.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new, unbound form called Test Pop-Up.

2. Set the form's OnActivate property to the following macro. Use the

   Macro Builder to create the macro. Save the macro as Beep.

      Action

      ------

      Beep

3. Set the OnDeactivate property to the Beep macro.

4. Close the form and then open it in Form view. Note that you hear the

   beep when you open the form.

5. Select the Database window, then select the form. Note that you hear the

   beep as you toggle back and forth between the form and the Database

   window.

6. View the form in Design view. Set its PopUp property to Yes. Save the

   form and then close it.

7. Open the form in Form view. Select the Database window, then select the

   form. Note that you do not hear the beep as you toggle back and forth

   between the form and the Database window.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 25, "Using Macros

with Forms"

For information on the Activate, Deactivate, Open, Load, Resize, or Current

event, search for the event name using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsEvnt


PRB: Adding Records to AutoLookup Form Generates Error

Article ID: Q116062

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are adding a record to a form based on an AutoLookup query, either

of the following messages is generated when you try to enter anything in

the foreign key field:

   To make changes to this field, first save the record

    -or-

   Current field must match join key "?" on 'one' side of outer join

CAUSE

=====

You have one or more default values set on control(s) bound to the one-side

table in your AutoLookup query.

RESOLUTION

==========

Make sure that the control(s) on the "one" side have no default values set.

MORE INFORMATION

================

When you enter a value in the foreign key field in an AutoLookup query,

fields from the one-side table should update automatically with related

information. However, if you are adding a new record and one or more fields

from the "one" side has a default value, Microsoft Access assumes you are

trying to add a record to the "one" side as well as to the "many" side.

If there are no default values for any of the many-side fields, when you

enter a value in the foreign key field after making an entry in another

field from the many-side table, you receive the error message:

   Current field must match join key "?" on 'one' side of outer join

If there are default values for any of the many-side fields, or if you have

not entered any value in any field from the many-side table, you will

receive the following warning message in the status bar after you enter a

value in the foreign key field:

   To make changes to this field, first save the record

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Use a Form Wizard to create a new form based on the AutoLookup query.

   Include all the fields in the form.

3. View the form in Design view. Set the Region control's DefaultValue

   property to 0.

4. View the form in Form view. From the Records menu, choose Data Entry.

   Try to type any value in the Customer ID field. Note the message in the

   status bar.

5. Press the ESC key.

6. In the Order ID field, enter "1111" (without quotation marks). In the

   Customer ID field, enter any value. You will receive an error message

   when you try to exit the field.

REFERENCES

==========

For more information about the AutoLookup feature, search for "AutoLookup"

then "Looking Up Information Automatically (AutoLookup)" using the

Microsoft Access Help menu.

Additional reference words: 2.00 rowfixup defaultvalue

KBCategory:

KBSubcategory: FmsProp


PRB: AddNew Method Uses Table Default Values

Article ID: Q115898

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The documentation for the AddNew method states that when you add a new

record using the AddNew method,

   This method sets the fields to Null (the default values specified for a

   table-type Recordset in Design view of the corresponding table aren't

   used).

This statement is incorrect.

RESOLUTION

==========

The documentation should state:

   This method sets the fields to either Null or to the default value

   specified in Design view of the corresponding table.

When you add a new record using the AddNew method, the default values in a

table are used since default values are enforced at the database-engine

level in Microsoft Access version 2.0. In Microsoft Access version 1.x,

default values are not used when you add a new record using the AddNew

method.

REFERENCES

==========

Microsoft Access "Language Reference," version 2.0, Appendix B, "Data

Access Reference," page 666

For more information about the AddNew method, search for "AddNew" then

"AddNew Method (Data Access)" using the Microsoft Access Help menu.

Additional reference words: 2.00 docerr

KBCategory:

KBSubcategory: MdlEdit


PRB: Append Query Results in Duplicate Counter Numbers

Article ID: Q94105

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A table that you append data to using an append query now has

duplicated numbers in a field defined as a Counter data type. The

expected result was appended data with incremented numbers in the

Counter field.

CAUSE

=====

Your append query is explicitly referencing the field with the

Counter data type. You are, in essence, overriding the automatic

counter function that you specified in your table design. This may

result in duplicate numbers.

RESOLUTION

==========

Do not include a field with a Counter data type in the Append To

row of the QBE grid in your append query. By omitting this field in

your append query, Microsoft Access will automatically generate

incremental numbers in the appended table's Counter field.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

You will only get duplicates if there is no Primary Key or Index (No

Duplicates) defined on the Counter field in the table that you are

appending to. By definition, primary keys are unique.

Including fields with Counter data types in your append query might also

result in non-contiguous numbers in the table that you are appending to.

For example, if the table you are appending to has values of 1 to 20 in the

Counter field, and the table you are appending from has values of 20, 34,

and 55, you will end up with one duplicate value. The next time you add a

new row to the appended to table, the Counter field will be assigned a

value of 56.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryMktbl


PRB: Avery 4xxx-Series Labels Do Not Work on Laser Printer

Article ID: Q89621

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are using Microsoft Access ReportWizards for mailing labels, note

that the Avery labels 4xxx series are intended for dot-matrix printers, and

the 5xxx series are intended for laser printers. The dot-matrix, or

continuous, labels will print incorrectly when they are printed on a laser

printer.

CAUSE

=====

These labels are meant for dot-matrix printers and their sizes do not match

the standard page sizes available for laser printers.

STATUS

==========

This behavior is by design.

REFERENCES

==========

For more information on creating mailing labels for dot-matrix printers,

query on the following words here in the Microsoft Knowledge Base:

   creating and mailing and labels and "dot-matrix" and printers

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptLabel


PRB: BeforeUpdate and AfterUpdate Field Properties Not Working

Article ID: Q100134

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The macro or function attached to a field's BeforeUpdate or AfterUpdate

property does not run.

CAUSE

=====

A field's BeforeUpdate and AfterUpdate events will not be triggered if

the field was modified by a macro or by Access Basic code.

RESOLUTION

==========

This behavior is by design. You can work around this behavior by

causing the macro or Access Basic code that modifies the field to

manually trigger the event pointed to by the field's BeforeUpdate or

AfterUpdate property.

MORE INFORMATION

================

Steps to Reproduce Behavior

--------------------------

1. Open the sample database NWIND.MDB.

2. Create and save the following macro:

      Macro Name       Actions

      -------------------------

      Test1            OpenForm

                       SetValue

      Test1 Actions

      --------------------------------------

      OpenForm

         Form Name: Employees

      SetValue

         Item: Forms![Employees]![Last Name]

         Expression: Null

3. Open the Employees form in Design view and add the Required Entry

   macro to the Last Name field's BeforeUpdate property.

4. Close the Employees form.

5. Run the Test1 macro. Note that it successfully blanked out the

   employee's last name (you can press ESC twice to get it back).

   If the field's BeforeUpdate event had been triggered, the Required

   Entry macro would not have allowed the field to be blank.

6. Try to remove the employee's last name manually. The Required Entry

   macro will be triggered, displaying the following message:

      You must enter a last name

7. Do not save changes when closing the Employees form.

Additional reference words: 1.00 1.10 2.00 before after update ui

KBCategory:

KBSubcategory: FmsEvnt


PRB: BeforeUpdate Macro Running Twice

Article ID: Q92810

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The BeforeUpdate macro appears to be running twice, rather than

only once.

CAUSE

=====

The BeforeUpdate macro will run whenever an edited record is

saved. And if you add records using the Paste Append command, it

will run when each of those records is added. If you find that

the BeforeUpdate macro is running more than once, check to see

exactly what actions you are taking.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Create a macro with a MsgBox action and then a CancelEvent action.

 2. Save this macro as Macro1.

 3. Create a bound form with text boxes.

 4. Set the form's BeforeUpdate property to Macro1.

 5. Switch the form from Form Design view to Form view.

 6. Enter data in a field, then select the data in that field.

 7. From the Edit menu, choose Copy.

 8. From the Edit menu, choose Paste Append.

 9. Choose the OK button when the Message box (that you created in

    Macro1) appears.

10. Close the form.

11. Choose the OK button when the Message box (that you created in

    Macro1) appears.

12. Choose the OK button when the following error message appears:

       The record being edited can't be saved. If you close the form,

       the changes you've made to the record will be lost. Close

       anyway?

Note that the message box you created in Macro1 reappeared in step 11.

The macro that you assigned to the BeforeUpdate property is running

twice: when the record that you added using the Paste Append command

is saved, and when when the edited record is saved.

REFERENCES

==========

For more information, search for "BeforeUpdate, AfterUpdate Properties"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 before update

KBCategory:

KBSubcategory: McrName


PRB: Bitwise AND Operator with Hex Values Results Incorrect

Article ID: Q116498

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive incorrect results when you use the bitwise AND operator against

two hexadecimal numbers.

CAUSE

=====

This behavior occurs when an integer is promoted and sign-extended to a

long number. For example, if you were to enter the expression

   ?HEX(&HFFFFFFFF AND &H0000FFFF)

in the Immediate window, you might expect to receive the value H0000FFFF as

the result. However, the number &H0000FFFF is actually promoted and sign-

extended to a long integer, to return the value &HFFFFFFFF.

RESOLUTION

==========

Add a trailing ampersand (&) to the hexadecimal numbers. This causes

Microsoft Access to interpret the numbers as long integers, and prevents

the sign-extension from taking place. For example, the expression

   ?HEX(&HFFFFFFFF& AND &H0000FFFF&)

will result in the value &H0000FFFF, as you expect.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 6

Additional reference words: 1.00 1.10 2.00 hex long operator

KBCategory:

KBSubcategory: MdlOthr


PRB: Bound OLE Object Blank in Form View

Article ID: Q92950

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If a bound object frame on a form has its ControlSource property

set to a field that is not of the type OLE Object, the control

will be blank when the form is in Form view. In Datasheet view, the

cells for the control contain "Invalid Object" or "Long Binary Data"

depending on the version of Microsoft Access you are using.

CAUSE

=====

A bound object frame must refer to a field of the type OLE Object

in a table or query in order to display anything in Form view. To

display an object in this control, the ControlSource property must

be set to an OLE Object field. For example, Microsoft Access cannot

display the contents of a Text field as an OLE Object. Object

frames will appear blank unless there is something to show.

RESOLUTION

==========

Choose an OLE Object field as the ControlSource for the bound frame.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

The following steps use the sample database NWIND.MDB:

1. Create a new form using the Employees table.

2. Add a bound object frame control to the form.

3. Set the ControlSource property to First Name.

4. Switch the form to Form View.

Note that the bound object frame is blank.

REFERENCES

==========

For more information, search for "bound object frame" using the Microsoft

Access Help menu.

Additional reference words: 1.00 1.10 2.00 linking embedding empty control

KBCategory:

KBSubcategory: IntpOle


PRB: Bound SubReport Does Not Show DDE Data

Article ID: Q95441

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The result of a DDE expression in a subreport does not display in

Print Preview or when a report is printed.

CAUSE

=====

If the subreport is bound, there must be at least one row of data

in the underlying table or dynaset before the subreport's DDE data

will display.

RESOLUTION

==========

There are three possible resolutions:

 - Hide the DDE expression if the dynaset for the subreport is

   empty.

 - Place the DDE expression in an unbound subreport.

 - Place the control that contains the DDE expression in the main

   report.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Start Microsoft Excel and create a new worksheet. Place the text "This

    is a test" (without quotation marks) in row 1, column 1. Save this

    worksheet as DDETEST.XLS, and leave this worksheet open.

 2. In Microsoft Access, create a new table:

       Table: Table1

       -------------

       Field Name: TXT

       DataType:   Text

 3. Create a new report bound to Table1.

 4. Add a text box bound to the field TXT by dragging TXT from the

    field list to the report.

 5. To add an unbound text box, select the text box tool from the

    toolbox and click the report. Put the following expression in

    the ControlSource property of this unbound text box:

       =DDE("Excel","DDEtest.xls","R1C1")

 6. Save this report as "SubRep" (without the quotation marks).

 7. View SubRep in Print Preview. "This is a test" displays

    correctly.

 8. Close SubRep and create a new report. Drag the report, SubRep,

    from the Database window onto this new report. Save this report as

    MainRep.

 9. View MainRep in Print Preview. "This is a test" is not visible

    on the report. Close MainRep.

10. Open Table1 and add some data to it. View MainRep in Print

    Preview. Notice that "This is a test" is now visible.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpDde


PRB: Btrieve Files Created with Btrieve 6.0 NLM Not Supported

Article ID: Q94829

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to attach to a Btrieve FILE.DDF file, the

following error message is displayed:

   Disk or Network error

RESOLUTION

==========

This error message appears when you attempt to attach to a Btrieve file

created with the Btrieve 6.0 NLM version. Microsoft Access does not support

Btrieve files created with this networked version of Btrieve. Microsoft

Access only supports Btrieve files created with Btrieve 5.x.

Additional reference words: 1.00 1.10 2.00 xtrieve errmsg

KBCategory:

KBSubcategory: IsmBtrv


PRB: Btrieve ISAM Is Not Installed with Typical Setup

Article ID: Q115570

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you install Microsoft Access version 2.0 using the Typical setting, you

will be unable to import, export, or attach Btrieve tables. The Btrieve

option will not appear in the Data Source or Data Destination box for these

operations.

CAUSE

=====

Installing Microsoft Access using the Typical setting does not install the

Btrieve indexed sequential access method (ISAM) driver that is necessary

for accessing Btrieve data.

RESOLUTION

==========

There are two ways to add the Btrieve ISAM to your system:

 - Install Microsoft Access using the Complete/Custom setting instead

   of the Typical setting.

   -or-

 - Add the Btrieve components by running Setup from the Microsoft Access

   Setup icon. To do this, follow these steps:

   1. Double-click the MS Access Setup icon (by default, this icon

      is in the Microsoft Office program group).

   2. Choose the Add/Remove button.

   3. In the Options box, select ISAM Drivers, and then choose the

      Change Option button.

   4. In the Options box, select the Btrieve ISAM check box, and then

      choose OK.

   5. Choose Continue.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 1, page 7

Additional reference words: 2.00

KBCategory:

KBSubcategory: IsmBtrv


PRB: Canceling a DoCmd Print Returns Error Messages

Article ID: Q106181

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Choosing Cancel to cancel printing that was started by a macro that

contains a function with a DoCmd Print A_Printall statement will return a

series of alert messages.

STATUS

======

This behavior is by design. It allows you to trap and test for execution

failure and cancellation as individual results.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Create a new module. Enter the following in the Declarations section:

       Option Explicit

       Function PrintTest()

          DoCmd Print A_PRINTALL,,,True

       End Function

 2. Save the module as Print Test Module.

 3. Create the following new macro:

       Action

       -------

       RunCode

       Macro Actions

       -----------------------------

       RunCode

          Function Name: PrintTest()

 4. Save the macro as Print Test Macro

 5. Open a new form in Design view.

 6. Add a command button to the form.

 7. Set the command button's OnPush property to Print Test Macro.

    NOTE: In version 2.0, the OnPush property is named OnClick.

 8. View the form in Form view. Choose the Print Test Macro button.

 9. Once printing begins, choose Cancel.

10. The message "Action Print Was Cancelled" will appear. Choose the OK

    button.

11. The Module Design window will be open to the PrintTest function. Close

    the Module Design window by selecting Close from the File menu. When

    you receive the message "Reset halted programs so Code window can be

    closed," choose OK.

12. The Action Failed dialog will be in the foreground, referring to the

    macro action. Choose the Halt button.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


PRB: Cannot Add Security Items to Custom Menu

Article ID: Q103992

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you add a security command to a custom menu with a DoMenuItem action,

the security command will be unavailable.

CAUSE

=====

You can only perform DoMenuItem actions with commands available from the

current context. If you have a form open, you can only perform menu items

available to a form. Since security items are available only from the

Database window, they will not work when invoked from a form.

RESOLUTION

==========

You can add the security command Change Password to a custom menu using

the following sample macro:

   Macro Name         Action        Defined Below

   ----------------------------------------------

   Change Password    Echo               1

                      SelectObject       2

                      DoMenuItem         3

                      DoMenuItem         4

                      SelectObject       5

   Change Password Actions

   ---------------------------------------------------------

   1. Echo

         Echo On: No

   2. SelectObject

         Object Type: Form

         Object Name: <name of the form that the menu is on>

         In Database window: Yes

   3. DoMenuItem

         Menu Bar: Database

         Menu Name: Security

         Command: Change Password

   4. DoMenuItem

         Menu Bar: Database

         Menu Name: Window

         Command: Hide

   5. SelectObject

         Object Type: Form

         Object Name: <name of the form that the menu is on>

         In Database window: No

NOTE: Actions 1 and 5 are used if you need to have the Database window

hidden while using the retail version of Microsoft Access. The Echo

action in step 1 ensures that the Database window is not visible when it

is activated in step 2. Step 4 hides the Database window again. If you

are using the Microsoft Access Distribution Kit (ADK), steps 1 and 5 can

be omitted since the Database window is always hidden.

The only side effect to this workaround is that when the Change Password

dialog box appears, you will see the Database window menu items in the

background. However, you will not be able to choose them.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create the following macro and save it as Security Menu:

      Action      Defined Below

      -------------------------

      AddMenu          1

      Security Menu Actions

      ---------------------------------------------

      1. AddMenu

            Menu Name: Security Menu

            Menu Macro Name: Security Menu Password

            Status Bar Text: Change Password

2. Create the following macro and save it as Security Menu Password:

      Macro Name        Action     Defined Below

      -----------------------------------------

      Change Password   DoMenuItem       1

      Security Menu Password Actions

      ------------------------------

      1. DoMenuItem

            Menu Bar: Database

            Menu Name: Security

            Command: Change Password

3. Create a form and set the OnMenu property to Security Menu.

4. View the form in Form view and note that Change Password is

   unavailable on the Security menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: McrOthr


PRB: Cannot Attach Paradox Table on Read-Only Drive

Article ID: Q92653

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You cannot attach a Paradox table (*.DB) located on a read-only drive. If

you try to attach a Paradox table on a read-only drive, you receive the

following error message:

   Couldn't open file '<FILENAME#DB>' (in Microsoft Access version 1.x)

   -or-

   Couldn't lock table '<tablename.db>', currently in use by user

   '<username>' on machine '<machinename>' (in Microsoft Access version

   2.0)

CAUSE

=====

Neither Paradox nor the Paradox indexed sequential access method (ISAM)

shipped with Microsoft Access supports databases located on read-only

drives.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Paradox is manufactured by Borland International, Inc., a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmPdox


PRB: Cannot Change Combo Box Value If ControlSource Is Counter

Article ID: Q95450

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

After setting the ControlSource property of a combo box to a field that

has a Counter data type, you try to change the value in the combo box

and receive the following status bar message:

   Control bound to counter column '<Field name>'

CAUSE

=====

The ControlSource of a combo box is a table field where Microsoft Access

writes your combo box selection. By design, modifications to a Counter

field are not allowed. Therefore, if the ControlSource property of a

combo box is set to a Counter field, Microsoft Access cannot update the

value in the Counter field, so you cannot change the combo box value.

Microsoft Access gives you the message to tell you why it cannot update

the combo box control.

RESOLUTION

==========

Either change the data type of the field now in the ControlSource

property of the combo box, or set the ControlSource property to a

field that does not have a Counter data type.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access, open the NWIND.MDB sample database, and create

   a new table called MyTest.

2. Add the following three fields to the MyTest table:

      Field Name     Data Type

      ------------------------

      MyCounter      Counter

      MyData         Number

      MyBucket       Number

3. Enter a few random numeric values in the MyData field. Notice that

   Microsoft Access automatically fills in the MyCounter field and puts

   zeroes in the MyBucket field as you enter values in the MyData field.

4. Create a new blank form.

5. In Design view, place a combo box on the form. Set its ControlSource

   property to the MyCounter field, and its RowSource property to the

   MyTest table.

6. Switch to Form view. Notice that the combo box values are the sequential

   numbers coming from the MyCounter field.

7. Drop down the combo box list and attempt to select a new value from

   it. You receive the following message on the status bar:

      Control bound to counter column 'The Counter'.

   The value in the combo box does not change.

8. Switch back to Design view and change the combo box ControlSource

   property from MyCounter to MyBucket.

9. Switch back to Form view and repeat step 7. Now you can select items

   from the combo box. If you look at the contents of the table, you can

   see the values you select come from the MyBucket field.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 9, "Designing

Forms," pages 235-238

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: FmsCmbo


PRB: Cannot Change Some Properties of Attached Tables

Article ID: Q114216

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You cannot change engine-enforced properties such as FieldSize,

DefaultValue, ValidationRule, ValidationText, Required, or AllowZeroLength

on attached tables. When you open the attached table in Design view, the

following warning is displayed:

   Table 'tablename' is an attached table. Some properties can't be

   modified. Open it anyway?

If you try to modify one of the properties listed above, you receive a

message that states:

   This property cannot be modified in attached tables.

CAUSE

=====

You cannot modify engine-enforced properties in attached non-Microsoft

Access tables because Microsoft Access cannot enforce validation of a field

that may be updated by other products, such as Microsoft Visual Basic.

RESOLUTION

==========

You can add a default value or validation rule at the form level, instead

of modifying the attached table. For attached Microsoft Access tables, you

should change engine-enforced properties in the base tables before you

attach them.

REFERENCES

==========

For more information about validation rules, search for "validation: rules

and text" then "Validating Data in a Table" using the Microsoft Access Help

menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: TblFldp


PRB: Cannot Choose Custom Bitmap for Toolbar Button

Article ID: Q112135

UifOthr


PRB: Cannot Connect DDE from Word 6.0 to Microsoft Access

Article ID: Q109948

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Word version 6.0 for Windows

---------------------------------------------------------------------

SYMPTOMS

========

When you are running a Mail Merge in Microsoft Word version 6.0 for

Windows, you cannot connect to a Microsoft Access database using dynamic

data exchange (DDE) because the DDE option is not available in the Confirm

Data Source dialog box.

CAUSE

=====

This problem occurs because Microsoft Access and its database extension

(.MDB) is not registered with Microsoft Windows.

RESOLUTION

==========

Follow the steps below to register Microsoft Access and its database

extension with Windows:

1. In Microsoft Windows File Manager, choose Associate from the File

   menu.

2. Type "MDB" (without the quotation marks) in the Files With Extension

   box.

3. Choose the Browse button.

4. Select your Access directory in the Directories box, and then select

   MSACCESS.EXE in the File Name box.

5. Choose OK.

6. Exit and restart Microsoft Windows.

Additional reference words: 1.00 1.10 2.00 Interoperability

KBCategory:

KBSubcategory: IntpPrtm


PRB: Cannot Delete Admin User

Article ID: Q114838

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to delete the user Admin, you get the error message:

   Can't perform this operation

CAUSE

=====

In Microsoft Access version 2.0, you cannot delete any of the default

user or group accounts (Admin, Guest, Admins, Guests, and Users).

RESOLUTION

==========

With the security enhancements in Microsoft Access version 2.0, it is not

necessary to delete the default users and groups. Instead, you can create

alternate users and groups and then disable the default users and groups.

For example, follow the steps below to create a new database

administrator:

1. Add a new user to the Admins group.

2. Log in as the new user.

3. Remove the Admin user from the Admins group, leaving the Admin user

   in the Users group.

NOTE: Step 3 is optional as long as you do not create any databases or

database objects while logged in as the Admin user. You may want to assign

the Admin user a unique password so that you can log in as another user,

and to keep others from logging in as the Admin user on the SYSTEM.MDA that

was used to create the database.

REFERENCES

==========

For more information about security, search for "security: object

ownership" then "Viewing and Changing Ownership" using the Microsoft Access

Help menu. Or, search for "security: basics" then "Securing a Database."

Additional reference words: 2.00 Security

KBCategory:

KBSubcategory: ScrtOthr


PRB: Cannot Delete Item When You Exit a LimitToList Combo Box

Article ID: Q90116

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you delete an entry in a combo box, you receive the following error

message when you attempt to leave the control:

   The text you enter must match an entry in the list.

CAUSE

=====

This behavior is by design in order to prevent Microsoft Access from adding

nulls to the list just as it would any other new value. When LimitToList is

set to YES, no new values are accepted by the list, including nulls.

RESOLUTION

==========

To add a blank entry to a combo box list, include a blank value in

the combo box's source table. You can then select the blank value

from the list rather than deleting the entry in the field.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create an unbound form with a combo box row source attached to any

   table. Set the LimitToList property to Yes.

2. Browse the form. Choose a value from the combo box and press ENTER.

   Note that the field is committed.

3. Choose the combo box again. Delete the value and attempt to leave

   the control. The error mentioned above will appear.

REFERENCES

==========

For more information about the LimitToList property, search for

"LimitToList" then "LimitToList Property" using the Microsoft Access Help

menu.

Additional reference words: 1.00 1.10 2.00 controls commit

KBCategory:

KBSubcategory: FmsCmbo


PRB: Cannot Display More Than 4 Graph Objects At One Time

Article ID: Q114729

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Attempting to open a form or preview a report that contains more than four

Microsoft Graph version 5.0 objects results in the error message:

   Not enough memory to complete the operation on the OLE object.

NOTE: You may have been able to open the form or preview the report in

Microsoft Access version 1.x without any error messages.

CAUSE

=====

In Microsoft Access version 2.0, displaying each unbound Graph 5.0 object

requires approximately 10% of system resources. This limits the number of

graphs that can be displayed at one time to three or four (the actual limit

is determined by the resources available in a particular system).

Activating a graph object in-place takes approximately 15% of the available

system resources. For performance reasons, once a graph is activated in-

place, the instance of Graph 5.0 that was started to support the editing

remains in memory until the form is closed. This limits the number of

graphs that can be activated to three.

RESOLUTION

==========

Limit the number of graphs on a single page to four. Reduce that number to

three in forms where in-place activation of the graphs will take place.

If the graphs are not based on data that will change, convert them to

pictures, or store them in tables. More than four bitmaps or bound graphs

can be displayed on a single page. If multiple graphs overlap on a form or

report but only one is shown at a time, consider using only one graph

object and setting its row source with code each time a different set of

data is shown.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a new report.

2. Add a Graph 5.0 object to the report.

3. Copy and paste the Graph 5.0 object to create a total of six graphs.

4. Preview the report. The error message stated above will occur. If you

   choose OK, the report will be displayed, but one or more of the graph

   objects will be blank.

Workaround

----------

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

The following example demonstrates how to modify the Sales By Product form

in the sample database NWIND.MDB so that you can choose between a graph

showing sales by month for 1992 and a graph showing sales by month for

1993:

1. Open the Sales By Product form in Design view.

2. Place a command button on the form. Change the button's Caption

   property to "1992" (without quotation marks).

3. Create an event procedure for the button's OnClick property by clicking

   in the OnClick property field, and then choosing the Build button to the

   right of the field. Select Code Builder, and then add the following

   code.

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Me!Embedded13.RowSource = "SELECT DISTINCTROW_

      Format([Order Date], ""MMM \'YY"") AS [Sales for 1992], _

      SUM([Sales by Product].[Product Amount]) AS [Product Amount]_

      FROM [Sales by Product] WHERE [Order Date] BETWEEN _

      #1/1/92# AND #12/31/92# GROUP BY Year([Order Date])*12_

      +Month([Order Date])-1, Format([Order Date], ""MMM \'YY"");"

   HINT: This query was created by copying the RowSource property of the

   graph on the Sales By Product form. The year in the criterion and chart

   title was changed and extra quotation marks were added to the second

   argument of the Format() function.

4. Choose the Compile Loaded Modules button on the toolbar, and then

   close the module.

5. Add another command button to the form. Set the new command button's

   Caption property to "1993" (without quotation marks).

6. Create the following event procedure for the button's OnClick property.

   NOTE: In the following sample code, an underscore (_) is used as a line-

   continuation character. Remove the underscore when re-creating this code

   in Access Basic.

      Me!Embedded13.RowSource = "SELECT DISTINCTROW_

      Format([Order Date], ""MMM \'YY"") AS [Sales for 1993], _

      SUM([Sales by Product].[Product Amount]) AS [Product Amount]_

      FROM [Sales by Product] WHERE [Order Date] BETWEEN _

      #1/1/93# AND #12/31/93# GROUP BY Year([Order Date])*12_

      +Month([Order Date])-1, Format([Order Date], ""MMM \'YY"");"

7. Choose the Compile Loaded Modules button on the toolbar and then

   close the module.

8. View the form in Form view. Choose the 1992 button to change the

   graph's row source so that it displays sales for 1992.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 19, "Using Pictures,

Graphs, and Other Objects," pages 478-483

Additional reference words: 2.00 chart memory

KBCategory:

KBSubcategory: IntpGrph


PRB: Cannot Enforce Referential Integrity in Relationship

Article ID: Q112111

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You cannot enforce referential integrity when you are defining a

relationship between tables.

CAUSE

=====

There are several reasons why you might not be able to enforce referential

integrity when you define a relationship, including the following:

 - Existing data in the tables violates referential integrity. For example,

   you have a child record that does not have a matching parent in the

   primary table.

 - You can define a relationship with an attached table, but Microsoft

   Access will not enforce referential integrity between two tables unless

   both tables are in the same database and the database user has

   permissions to create the relationship in that database.

 - You started dragging from the wrong table or field. You must drag the

   primary key field (or uniquely indexed field) from the primary table to

   the related table. For example, to enforce referential integrity between

   the Customers and Orders tables in the sample database NWIND.MDB, you

   must drag the Customer ID field (primary key) from the Customers table

   to the Customer ID field in the Orders table. If you did not start

   dragging from the primary table, choose Cancel in the Relationships

   dialog box and start again.

 - You chose the correct fields, but they are not appropriately indexed.

   Before adding relationships, open the primary table in Design view and

   set a primary key or create a unique index for the fields you want to

   use in an enforced relationship.

 - Although you can create relationships using queries as well as tables,

   referential integrity is not enforced with queries.

MORE INFORMATION

================

Referential integrity is a set of rules that preserves the defined

relationships between tables when you enter or delete records. If you

enforce referential integrity, you cannot add a record to a related table

when there is no associated record in the primary table, change a value in

a primary table that would result in an orphan record in a related table,

or delete a record from a primary table when there is a matching related

record.

If you select the Cascade Update Related Fields or Cascade Delete Related

Records option for a relationship, Microsoft Access will change or delete

related records to ensure that the referential integrity rules are enforced

when you change or delete records.

REFERENCES

==========

For more information about referential integrity, search for "referential

integrity" then "Defining Relationships Between Tables" using the Microsoft

Access Help menu.

Additional reference words: 2.00 Tables RI Relationships

KBCategory:

KBSubcategory: RltRef


PRB: Cannot Open Datasheet as a Pop-Up or Modal Form

Article ID: Q111779

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A form in Datasheet view opens as a normal form rather than a modal or pop-

up form, although you have set its Modal or PopUp properties to Yes. If an

OpenForm macro action with a Dialog Window Mode argument is used to open

the form in Datasheet view, the form will open as a modal, pop-up form.

CAUSE

=====

Only forms that open in Form view can be made to be modal or pop-up.

RESOLUTION

==========

If you need to have a form in Datasheet view displayed as a modal or pop-up

form, consider placing the datasheet form as a subform in an unbound main

form. The main form can be displayed in Form view as a modal or pop-up

form. This also gives you the ability to add other features to your form,

such as a Close command button, that you could not add otherwise.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

Opening the Form with a Macro:

1. Open the sample database NWIND.MDB.

2. Create and then run the following new macro:

      OpenForm

         Form Name: Employees

         View: Datasheet

         Window Mode: Dialog

Note that the form opens in Form view as a modal, pop-up form, rather than

opening in Datasheet view.

Setting the Form's Modal and PopUp Properties:

1. Open the sample database NWIND.MDB.

2. Open the Employees form in Design view and set the following

   properties:

      DefaultView: Datasheet

      Modal: Yes

      Popup: Yes

3. Save and then close the form.

4. In the Database window, select the Employees form and then choose

   Open. Note that the form opens in Datasheet view but is not modal or

   pop-up.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 10, "Creating Forms

Based On More than One Table," pages 272-274

Microsoft Access "User's Guide," version 1.1, Chapter 10, "Creating Forms

Based On More than One Table," pages 278-280

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsProp


PRB: Cannot Open Multiple Instances of the Same Form

Article ID: Q101312

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to open a second instance of an open form with an OpenForm

macro action, the instance of the form that is already open is activated.

CAUSE

=====

You can have only one copy of a form open at a time.

RESOLUTION

==========

NOTE: This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual in version 2.0.

The following information describes how to create and use an Access

Basic function called OpenFormInstance(), which allows you to open

more than one copy of the same form in Microsoft Access. To make

OpenFormInstance work, you must first make <x> number of copies of

your original form, giving each copy a numeric suffix greater than

zero. That is, if your form is called "Customers," make copies of the

form renaming them to "Customers1," "Customers2," "Customers3," and so

forth.

When OpenFormInstance() is invoked with "Customers," it checks to see

if a copy of the form is available for display. It returns the

following error message if all instances are currently open:

   Could not open form "Customers"

   Please close another instance and try again.

To use the OpenFormInstance() function, create a new module with the

following Access Basic functions:

NOTE: In the following sample code, an underscore (_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Access Basic.

   '*****************************************************************

   ' DECLARATION SECTION

   '*****************************************************************

   Option Explicit

   '*****************************************************************

   ' FUNCTION: OpenFormInstance()

   '

   ' PURPOSE:

   '   Allows you to open more than one copy of the same form

   '   on screen at a time.

   '

   ' PREREQUISITES:

   '   You must make X number of copies of the the

   '   form, renaming them with a numeric suffix greater than zero.

   '   Example:

   '

   '        "Customers1," "Customers2," "Customers3," ...

   '

   ' REQUIRES:

   '   Function IsLoaded() - Determines if form is loaded.

   '   Function GetFormNames() - Supplied in this module.

   '

   ' ARGUMENTS:

   '   FormName - The generic name of the form to open.

   '   Example:

   '

   '        "Customers"

   '

   ' RETURNS:

   '   True  - if an instance of FormName was opened.

   '   False - if no instance of FormName was found or all available

   '           instances are active.

   '

   ' NOTES:

   '   You can customize the OpenForm action in the code below to add

   '   additional (optional) parameters, such as a Where condition or

   '   or alternate view.

   '

   '********************************************************************

   Function OpenFormInstance (ByVal FormName As String)

      Dim Count, i, Msg As String, InstanceCount

      ReDim Names(0) As String

      ' Get a list of all the forms in the current database.

      Count = GetFormNames(Names())

      ' Loop through the list of forms for a match with

      ' .. the requested form.

      For i = 0 To Count - 1

         ' Is the name of the form, minus the suffix, the same?

         If FormName = Left(Names(i), Len(FormName)) Then

            ' .. is the suffix a number greater than zero?

            If Val(Mid(Names(i), Len(FormName) + 1)) > 0 Then

               ' Count the number of instances.

               InstanceCount = InstanceCount + 1

               ' If the form is NOT loaded,load it.

               If Not IsLoaded(Names(i)) Then

                  DoCmd OpenForm Names(i)

                  OpenFormInstance = True

                  Exit Function

               End If

            End If

         End If

      Next i

      ' No form was found or all instances are being used.

      OpenFormInstance = False

      ' If no instance was found, just return.

      If InstanceCount = 0 Then Exit Function

      ' If all instances are being used, display error message.

      Msg = "Couldn't open form """ & FormName & """."

      Msg = Msg & Chr$(13) & Chr$(13)

      Msg = Msg & "Please close another instance and try again."

      MsgBox Msg, 48

   End Function

   '****************************************************************

   ' FUNCTION: GetFormNames()

   '

   ' PURPOSE:

   '   Fills the string array with a list of forms names.

   '

   ' ARGUMENTS:

   '    Names      - A single dimensional array of type string.

   '

   ' RETURN:

   '   The number(zero based) of names stored in the Names array.

   '

   ' NOTES:

   '   This function uses information stored in the

   '   MySysObject table of the currently opened database.

   '   The system tables are undocumented and are subject to

   '   change in future versions of Microsoft Access.

   '

   '****************************************************************

   Function GetFormNames (Names() As String)

      Dim db As Database, ss As Snapshot

      Dim Count, SQL

      Dim Msg As String

      SQL = "Select Name,Type from MSysObjects Where Type="

      SQL = SQL & "-32768 And Left(Name,1)<>'~' Order By Name;"

      Set db = CurrentDB()

      Set ss = db.CreateSnapshot(SQL)

      ss.MoveLast

      If ss.RecordCount > 0 Then

         ReDim Names(0 To ss.RecordCount - 1)

      Else

         GetFormNames = 0

         Exit Function

      End If

      ss.MoveFirst

      Count = 0

      Do While Not ss.EOF

         Names(Count) = ss![name]

         Count = Count + 1

         ss.MoveNext

      Loop

      GetFormNames = ss.RecordCount

   End Function

How to Use the OpenFormInstance() Function

------------------------------------------

The following steps assume there is a need to see more than one

customer form on the screen at a given time in the sample database

NWIND.MDB:

1. Open NWIND.MDB and choose the Form button in the Database window.

2. Click, 1 time, on the Customers form, and choose Copy from the Edit

   menu.

3. Choose Paste from the Edit menu. Type "Customers1" (without the

   quotation marks) in the Form Name box and then press ENTER.

4. Repeat step 3 for however many instances you expect your users to

   need ("Customers2," "Customers3," and so on).

5. Open the module containing the OpenFormInstance() function in Design

   view, and then choose Immediate Window from the View menu.

6. Type the following and press ENTER:

      ? OpenFormInstance("Customers")

   NOTE: The first instance of the Customers form opens.

7. Repeat step 6.

   NOTE: The second instance of the Customers form opens.

8. Repeat step 6 until you receive an error message indicating that no

   more instances are available.

Problems to Consider When Using OpenFormInstance()

--------------------------------------------------

Since you are not actually opening the same form multiple times (you

are opening copies), it is important that any macros and module code

that make direct references to the form using "Forms!FormName"

references be reconsidered.

If you have more than one instance of the form opened, it is best to

use the following techniques when you reference controls on the form.

 - User Screen.ActiveForm form notation wherever possible.

      MsgBox Screen.ActiveForm![ControlName]

 - When Screen.Active form is not appropriate, pass the name of the

   form to the Access Basic function to call.

      Function MyFunction(MyForm)

         MsgBox Forms(MyForm)![ControlName]

      End Function

 - Since you cannot pass arguments to macros, consider reworking the

   macro as an Access Basic function. You could call the function above,

   MyFunction(), using a RunCode macro action as follows:

      RunCode

         Function Name: =MyFunction(Screen.ActiveForm.FormName)

STATUS

======

This behavior is by design.

REFERENCES

==========

Microsoft Access, "Introduction to Programming," version 1.1, Chapter 7,

"Forms and Report Variables"

Microsoft Access, "Building Applications," version 2.0, Chapter 4, "Using

Forms to Collect, Display, and Filter Information"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsOthr


PRB: Cannot Open Paradox 4.x Table

Article ID: Q114082

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to import or attach a Paradox version 4.x file, you receive

the following error message:

   Can't open this Paradox 4.x table because ParadoxNetStyle is set

   to 3.x in msacc20.ini.

CAUSE

=====

The ParadoxNetStyle entry in the [Paradox ISAM] section of your MSACC20.INI

file is set to 3.x. When this entry is set to 3.x, you can only import or

attach Paradox version 3.x files.

RESOLUTION

==========

Set the ParadoxNetStyle setting to 4.x instead of 3.x. When this setting is

set to 4.x, you can import or attach Paradox version 3.x or 4.x files.

Note that all the users of a shared database must have the same

ParadoxNetStyle settings. If users of a shared database need to access

both Paradox 3.x and 4.x files, all the users should use the 4.x

ParadoxNetStyle setting.

The [Paradox ISAM] section of your MSACC20.INI file should contain:

   [Paradox ISAM]

   ParadoxNetStyle=4.x

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

NOTE: For this example to work, you must have the ParadoxNetStyle setting

set to 3.x in the [Paradox ISAM] section of your MSACC20.INI file.

1. Start Microsoft Access version 2.0 and open a database.

2. From the File menu, choose Import.

3. In the Data Source box, select Paradox 4.x, and then choose OK.

4. In the File Name box, select the Paradox 4.x file you want to import.

5. Choose the Import button.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 9, "Importing,

Exporting, and Attaching," pages 159-194

For more information about importing or attaching files, search for

"Import" or "Attach Table" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: IsmPdox


PRB: Cannot Perform OpenTable Method on an Attached Table

Article ID: Q94036

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

--------------------------------------------------------------------

SYMPTOMS

========

If you try to use an OpenTable method on an attached table, you will

receive one of the following error messages:

   Can't perform operation; it is illegal.

   -or-

   Invalid Operation.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Attach any valid table.

2. Create the following module:

      '***********************************************************

      'Declarations section of the module

      '***********************************************************

      Option Explicit

      '================================================================

      'The following will set the database to the current database and

      'attempt to open the attached SQL table. Name equals the attached

      'table's name.

      '================================================================

      Sub Test

         Dim db as Database

         Dim t as Table

         Set db = CurrentDB()

         Set t = db.OpenTable("dbo_name")

      End Sub

3. Compile the module, then execute the sub. You will receive one of the

   error messages stated above.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: PgmObj


PRB: Cannot Run Setup for Solutions Pack on Workstation

Article ID: Q114878

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Access Solutions Pack version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

On a computer running a network installation of Microsoft Access version

2.0, running Setup for the Microsoft Access Solutions Pack version 1.0

results in the following message:

   Setup could not find Microsoft Access version 2.0 installed locally

   on your system. Please install Microsoft Access version 2.0 before

   installing this application.

CAUSE

=====

The Microsoft Access Solutions Pack requires that Microsoft Access be

installed on the local computer and will not accept a network location

for the Microsoft Access directory.

RESOLUTION

==========

To work around this problem, either install Microsoft Access 2.0 locally

on the computer, or use the following steps to force Setup to believe that

Microsoft Access is installed locally.

NOTE: The technique documented in this article does not work if you are

running on a computer that does not have a local hard drive.

1. On the local hard drive, create a directory called ACC20 that you

   will cause Setup to believe is the local Microsoft Access directory.

2. In the directory that you created in step 1, create a file called

   UTILITY.MDA. You can create the empty file with any text editor (such

   as Windows Notepad).

3. In your local Windows directory, rename the MSACC20.INI file to

   MSACC20.OLD.

4. Using any text editor (such as Windows Notepad) create a file

   containing the following lines:

      [Options]

      UtilityDB=C:\ACC20\UTILITY.MDA

   Save the file in your local Windows directory as MSACC20.INI. You

   should now be able to run Setup successfully for the Microsoft Access

   Solutions Pack.

5. Once Setup is finished, delete the MSACC20.INI file in your local

   Windows directory. Rename the MSACC20.OLD file that you created

   in step 3 to MSACC20.INI.

Additional reference words: 2.00 solpack errmsg

KBCategory:

KBSubcategory: StpOthr


PRB: Cannot Save a Blank Record in a Table or Form

Article ID: Q109819

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You cannot save a blank, new record in a table or form.

CAUSE

=====

Microsoft Access requires some form of data entry in the blank, new record

in order to create a new record.

RESOLUTION

==========

To add a blank record to a table, press SPACE BAR in any field in the

table.

To add a blank record to a form, press SPACE BAR in any field whose

ControlSource property points to a field in the underlying record source. A

SetValue or SendKeys macro action directed at the bound control will also

work.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

When you are adding new records, Microsoft Access does not recognize that a

new record is being created until a field in the record has been "dirtied,"

or has received some input from an external source. That external source

can be a keyboard entry (other than the TAB or ENTER keys), or it can be

the result of a SendKeys or SetValue macro action. Note that default values

for fields do not qualify as external input, and have no effect on

triggering a new record in a table or form.

Steps to Reproduce Behavior

---------------------------

Microsoft Access version 2.0:

1. Open, in Design view, the Products table in the sample database

   NWIND.MDB.

2. Change the Product Name field's AllowZeroLength property from No

   to Yes.

3. Save the table and then switch it to Datasheet view.

4. From the Records menu, choose Data Entry. The insertion point will

   be positioned at the first field in a blank record.

5. Tab through all the fields twice. Note that the record indicator does

   not increment, indicating that you are still on the same record, and

   that the record has not been saved.

6. Tab to the Product Name field, and then press SPACE BAR.

7. Tab through the remaining fields until you come back to the Product Name

   field. Note that the record indicator has been updated by one.

Microsoft Access version 1.x:

1. Open, in Datasheet view, the Products table in the sample database

   NWIND.MDB.

2. From the Records menu, choose Data Entry. The insertion point will

   be positioned at the first field in a blank record.

3. Tab through all the fields twice. Note that the record indicator does

   not increment, indicating that you are still on the same record, and

   that the record has not been saved.

4. Tab to the Product Name field, and then press SPACE BAR.

5. Tab through the remaining fields until you come back to the Product Name

   field. Note that the record indicator has been updated by one.

REFERENCES

==========

For more information about adding records, search for "adding records"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 dirty

KBCategory:

KBSubcategory: TblFldp


PRB: Cannot Sum Calculated Controls in Forms or Reports

Article ID: Q113354

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

"#Name?" is displayed in a text box in a form footer, or a parameter box

appears requesting the field specified in the sum expression in a report.

CAUSE

=====

The text box is trying to perform a sum on a calculated control in the

detail section of the form or report.

You cannot sum a calculated control on a form or report because the

calculation is not stored anywhere for use in a later computation. The

calculation is computed and then output to the screen for display only.

RESOLUTION

==========

There are two solutions to this problem.

1. Repeat the calculation being computed in the calculated control in the

   sum expression. If the calculated control on the form or report has the

   expression

      =[Unit Price] * [Quantity]

   repeat this calculation in the sum expression as:

      =SUM([Unit Price] * [Quantity])

2. Base the form or report on a query and calculate the expression as a

   calculated field in the query rather than as a calculated control on the

   form or report. Since the calculation is being computed in the query,

   the result will be available for other computations. This method is

   considerably faster than the first method as the computation does not

   have to be done twice. If the calculated control on the form or report

   has the expression

      =[Unit Price] * [Quantity]

   then the new calculated field in the query will have the following in

   the Field row of the query grid:

      Extended Price: [Unit Price] * [Quantity]

   If the form or report is based on a query with this calculated field,

   Extended Price will appear in the field list and should be used in place

   of the calculated control on the form or report. The sum expression in

   the form or report footer would look like the following:

      =SUM([Extended Price])

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Open the form Orders Subform in Design view.

3. Place a text box with the following properties in the detail section:

      ControlName: My Extended Price

      ControlSource: =[Unit Price] * [Quantity]

4. Alter the Order Subtotal text box ControlSource property from

      =Sum([Extended Price])

   to:

      =Sum([My Extended Price])

   NOTE: The original expression will correctly display the sum of the

   Extended Price field since this field is being computed as a calculated

   field in the Order Details2 query the form is based on. The Extended

   Price calculated field in the Order Details2 query looks like the

   following:

      Extended Price: CLng([Order Details].[Unit Price]*[Quantity]*(1-

      [Discount])*100)/100

5. Change the form's ViewsAllowed property from Datasheet to Both.

6. View the form in Form view. "#Name?" will appear in the Order

   Subtotal box in the form footer.

Work Around 1: Repeating the Calculation in the Sum Expression

--------------------------------------------------------------

NOTE: These steps continue from the "Steps to Reproduce Behavior" section

above.

Alter the Order Subtotal ControlSource property from

   =Sum([My Extended Price])

to:

   =Sum([Unit Price] * [Quantity])

Note that the calculation correctly displays in the Order Subtotal box in

the form footer.

Work Around 2: Repeating the Calculation in the Sum Expression

--------------------------------------------------------------

1. Open the Order Details2 query in Design view.

2. In an empty query grid column, type the following in the Field row:

      My Extended Price: [Order Details].[Unit Price]*[Quantity]

3. Remove the My Extended Price calculated control in the detail

   section.

The calculation correctly displays in the Order Subtotal box in the form

footer.

REFERENCES

==========

For more information, search for "totals" then "Calculating Totals in

Forms" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 1.0, Chapter 11, "Using

Expressions in Forms," pages 295-298

Microsoft Access "User's Guide," version 1.1, Chapter 11, "Using

Expressions in Forms," pages 299-302

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsSubf


PRB: Cannot Use "y," "n," "t," or "f" in Yes/No Field

Article ID: Q94391

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when you type the letter "y"

or "n" into your field:

   The value you entered isn't appropriate for this field

CAUSE

=====

You are not typing the entire word into a Yes/No boolean field, a

True/False field, or an On/Off field.

RESOLUTION

==========

Type the entire word "yes" or "no" instead of the abbreviation "y" or "n"

in a field defined with a Yes/No data type. The capitalization does not

make a difference.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: TblDatyp


PRB: Close Action from Function Does Not Trigger OnClose Error

Article ID: Q89603

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If a form's OnClose property points to a nonexistent Access Basic function,

no error message is generated when you exit the form with a Close action

called from an Access Basic function.

RESOLUTION

==========

Close the form with a Close action called from a macro, rather than closing

the form with a Close action called from a function.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a module with the sample function CloseMe() as follows:

      Function CloseMe()

         DoCmd Close

      End Function

2. Save the module with the default name, Module1.

3. Create a new form.

4. Set the new form's OnClose property to:

      =Bogus()

5. Place a command button on the form.

6. Set the command button's OnPush property (in Microsoft Access version

   2.0, the OnPush property is called OnClick) to:

      =CloseMe()

7. View the form in Form view.

8. From the File menu, choose Close. An error message will occur.

9. Open the form in Form view again. Click the command button to close the

   form. Note that no error message occurs, even though the same

   nonexistent function is called.

Additional reference words: 1.00 1.10 2.00 on close

KBCategory:

KBSubcategory: FmsEvnt


PRB: Closing Forms, Tables, or Queries Is Slow

Article ID: Q109398

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.1 and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Closing forms, tables, or queries based on attached Sybase SQL Server

tables can take a long time.

CAUSE

======

When you close the table, Microsoft Access issues an ODBC API SQLCancel()

call. This tells the server to cancel processing of the current query.

However, some network libraries are not able to cancel a query request in

an efficient manner. Instead, they continue to read the query results from

the server until the process is complete, discarding the results.

RESOLUTION

==========

If you are using standard IPX, append the string "URGENT" (without the

quotation marks) to the end of the SQUERY or the <MYDATASOURCE> line in

the WIN.INI file. Substitute the name of the SQL Server for <MYDATASOURCE>.

This tells the network library that your SQL Server supports in-band

attention signals. The new line in the WIN.INI file should look like:

   <MYDATASOURCE> = 111.111.111.111,3801,URGENT

Sybase SQL Server is manufactured by Sybase Inc., a vendor independent

of Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

Additional reference words: 1.10 2.00

KBCategory:

KBSubcategory: ObcOthr


PRB: Color Builder Does Not Save Custom Colors

Article ID: Q116068

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You create a custom color with the Color Builder, but after you quit and

restart Microsoft Access the custom color is gone.

CAUSE

=====

Custom colors created with the Color Builder are only available in the

Microsoft Access session in which they are created.

RESOLUTION

==========

To use custom colors in other Microsoft Access sessions, write down the

custom color number that the Color Builder places in the object's property

sheet. You can enter the custom color number manually in other objects'

properties.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Open the sample database NWIND.MDB.

 2. Open the Customers form in Design view.

 3. Select the Company Name text box and view the property sheet.

 4. Click in the BackColor property field, and then choose the Build button

    to the right of the field.

 5. Choose the Define Custom Colors button.

 6. Create a custom color and then choose Add To Custom Colors.

 7. Choose OK to close the Color Builder.

 8. Save the Customers form.

 9. Quit Microsoft Access.

10. Restart Microsoft Access and open NWIND.MDB.

11. Repeat steps 2-4. Note that the custom color is no longer available in

    the Color Builder, even though the text box retains the custom color.

REFERENCES

==========

For more information about the Color Builder and custom colors, search for

"Color Builder" then "Color Builder" using the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: WzOthr


PRB: Column Widths in Table Design Not Saved

Article ID: Q92813

UifOthr


PRB: Concatenation of Memo Fields Creates Text Field

Article ID: Q92892

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you use a make-table query to concatenate two memo fields, the

query concatenates the memo fields into a text field in the resulting

table. This will result in the truncation of memo field data in the

new text field if you have over 255 characters in the memo fields.

CAUSE

=====

Text fields have a limit of 255 characters, but memo fields can

contain up to 32,000 characters.

RESOLUTION

==========

A workaround is to perform an append query to an existing table with a

memo field and concatenate the two memo fields into the existing memo

field.

MORE INFORMATION

================

Steps To Reproduce:

-------------------

1. Create a table with two memo fields:

      Table: OldTable

      ------------------

      Field Name: Memo1

         Data Type: Memo

      Field Name: Memo2

         Data Type: Memo

2. Create a make-table query based on OldTable. Use the following SQL

   statement for the query:

      SELECT DISTINCTROW

         [Memo1]&[Memo2]

      AS Concat

      INTO NewTable

      FROM OldTable;

   After running the query, note that the NewTable table contains a text

   field with only 255 characters.

Workaround

----------

1. Create another table containing one memo field:

      Table: ExistingTable

      -------------------------

      Field Name: ExistingField

         Data Type: Memo

2. Create an append query based on OldTable. Use the following SQL

   statement for the Query:

      INSERT INTO ExistingTable

         ( ExistingField )

      SELECT DISTINCTROW

         [Memo1]&[Memo2]

      AS Concat FROM OldTable;

When you run this query, ExistingTable will contain the two memo fields

concatenated.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryMktbl


PRB: Counter Starts at 2 in Table Created by Make-Table Query

Article ID: Q112160

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you create an empty table with a make-table query and then add

records to the new table, the counter starts at 2 instead of 1.

CAUSE

=====

Microsoft Access provides the first value for auto-increment fields

internally. Since it provided 1 internally for the previous auto-increment

column, the next value is 2, which shows in the new table.

RESOLUTION

==========

Create the table manually, instead of using a make-table query, to start

the counter at 1.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new query based on the Employees table.

3. From the Query menu, choose Make Table. Enter "Empty Table" (without

   quotation marks) in the Table Name box, and then choose OK.

4. Drag the Employee ID and Last Name fields to the QBE grid.

5. In the Criteria row for the Employee ID column, enter "<1" (without

   quotation marks).

6. Run the query. A new, empty table called Empty Table will be created.

7. Open the Empty Table table and enter a name in the Last Name field.

   Note that the counter starts at 2 instead of 1.

Additional reference words: 2.00 Queries

KBCategory:

KBSubcategory: QryMktbl


PRB: Creating Multiple New Import/Export Specifications

Article ID: Q93136

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Creating multiple new Import/Export specifications using the

Import/Export Setup dialog box requires that you either exit the

dialog or delete or change each entry in the dialog that does not

apply. The dialog does not provide a method to clear or reset each

option in the dialog.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open any database or create a new one.

2. From the File menu, choose Imp/Exp Setup.

3. Enter information in several fields.

4. From the File menu, choose Save As.

If you want to create another specification at this point, you must

either exit this dialog or manually delete all of the irrelevant

information.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


PRB: Data Not Sorted In Index Field Order

Article ID: Q114081

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are using an index on a table without a primary index, the table

does not sort according to the order of the fields in the index.

CAUSE

=====

Opening a table in Datasheet view is, internally, the same as opening a

dynaset. If there is no primary index on the table, Microsoft Access uses

any field with a unique index to sort the dynaset. If none or more than one

of the fields has a unique index, Microsoft Access chooses one at random.

The order of the indexes shown in the Index window has no bearing on which

index will be used to sort the dynaset.

RESOLUTION

==========

To sort a dynaset on a particular field, either make that field the primary

index for the table (by setting its PrimaryIndex property to Yes), or use a

query to sort the data.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open any database.

2. Create a table with three fields. Make one of the fields a Counter

   field, and make the other two Text fields.

3. Do not specify a primary key for the table. Define an ascending

   compound index on the two text fields. For example:

      Index Name     Field Name     Sort Order

      ----------------------------------------

      FieldText      Field1          Ascending

                     Field2          Ascending

   Set all index properties to No.

4. Save the table, and then enter the following data in the table:

      Counter  Field1  Field2

      -----------------------

      1        zzzz    dddd

      2        dddd    yyyy

      3        mmmm    iiii

5. Close the table, and then open it in Datasheet view. It will be

   sorted as follows:

      Counter  Field1  Field2

      -----------------------

      2        dddd    yyyy

      3        mmmm    iiii

      1        zzzz    dddd

6. Switch to Design view and add the Counter field to the index:

      Index Name     Field Name     Sort Order

      ----------------------------------------

      Counter        Counter        Ascending

      FieldText      Field1         Ascending

                     Field2         Ascending

   Leave all the index properties set to No.

7. Save and then close the table, and then open it in Datasheet view.

   It will be sorted as follows:

      Counter  Field1  Field2

      -----------------------

      2        dddd    yyyy

      3        mmmm    iiii

      1        zzzz    dddd

   Instead of sorting first on the Counter field, and then on Field1 and

   Field2 as you might expect, the sorting remains unchanged.

8. Set the Counter field's UniqueIndex property to Yes. The table will be

   sorted as follows:

      Counter  Field1  Field2

      -----------------------

      1        zzzz    dddd

      2        dddd    yyyy

      3        mmmm    iiii

   Note that the data is sorted on the Counter field.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 8, "Changing and

Customizing Tables," pages 151-154

Additional reference words: 2.00 Indexes Indexing Sorting Ordering

KBCategory:

KBSubcategory: RptSort


PRB: Databases Truncated with LAN Manager 2.1a and Earlier

Article ID: Q90133

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft LAN Manager versions 2.1a and earlier

---------------------------------------------------------------------

SYMPTOMS

========

There is a problem in Microsoft LAN Manager versions 2.1a and earlier that

causes file truncation when the workstation (client) computer is faster

than the server. This problem is not specific to Microsoft Access, but can

cause damage to a networked database if Microsoft Access is used in

conjunction with Microsoft LAN Manager versions 2.1a and earlier.

CAUSE

=====

When a client workstation sends information to the server through LAN

Manager version 2.1a or earlier, LAN Manager performs a "lazy" write (the

data is buffered in memory and then written to disk at a later time). If

the client workstation sends information to the server too quickly, the

server sends a message to the client telling it to send information slower

or to wait. With LAN Manager versions 2.1a and earlier, this "slow down"

message is misinterpreted by the client redirector and the client writes 0

bytes to the file, effectively truncating it where the write operation was

occurring.

This problem is specific to the lazy writing process. When the client

writes to the server, it sends the data in a burst. This burst

overloads the server and elicits the slow down message.

RESOLUTION

==========

To work around this problem, disable the lazy write function of the

LAN Manager client. This can be done by adding the following line to

the [Workstation] section in the LANMAN.INI file:

   ;.............012345678901234567890123456789012

   wrkheuristics=X0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

NOTE: The top line with the numbers is only a comment line for

spacing. The total number of x's and 0's (zeros) is 33 decimal.

STATUS

======

This workaround should be used with Microsoft LAN Manager versions

2.1a and earlier. This problem was corrected in Microsoft Windows for

Workgroups.

Additional reference words: 1.00 1.10 2.00 lanman corruption 2.10a 2.10

KBCategory:

KBSubcategory: StpNet


PRB: DateAdd() "w" Interval Does Not Work As Expected

Article ID: Q115489

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you add days to a date using the "w" interval, the DateAdd() function

adds the total number of days you specified to the date, instead of adding

the appropriate number of workdays to the date as you expect.

CAUSE

=====

The intervals in the DateAdd() function are the same as those used in the

DatePart() function. The DatePart() function uses the "w" interval to

return the weekday, or day of the week, from a date. The value returned

from the DatePart() function is an integer from 1 to 7 representing the

days of the week (Sunday through Saturday). When you add days using the "w"

interval, weekdays (which include all the days of the week) are added.

To add workdays (Monday through Friday) to a date, use the sample function

described in the "Resolution" section below.

RESOLUTION

==========

You can use the following sample user-defined function to add workdays,

rather than weekdays, to a date.

NOTE: In the following sample code, an underscore (_) at the end of a line

is used as a line-continuation character. Remove the underscore from the

end of the line when re-creating this code in Access Basic.

   '**********************************************************

   'Declarations section of the module

   '**********************************************************

      Option Explicit

   '==========================================================

   'The DateAddW() function provides a workday substitute

   'for DateAdd("w", number, date). This function performs

   'error checking and ignores fractional Interval values.

   '==========================================================

   Function DateAddW (ByVal TheDate, ByVal Interval)

     Dim Weeks As Long, OddDays As Long, Temp As String

     If VarType(TheDate) <> 7 Or VarType(Interval) < 2 Or _

                VarType(Interval)  > 5 Then

        DateAddW = TheDate

     ElseIf Interval = 0 Then

        DateAddW = TheDate

     ElseIf Interval > 0 Then

        Interval = Int(Interval)

   '    Make sure TheDate is a workday (round down).

        Temp = Format(TheDate, "ddd")

        If Temp = "Sun" Then

           TheDate = TheDate - 2

        ElseIf Temp = "Sat" Then

           TheDate = TheDate - 1

        End If

   '    Calculate Weeks and OddDays.

        Weeks = Int(Interval / 5)

        OddDays = Interval - (Weeks * 5)

        TheDate = TheDate + (Weeks * 7)

   '    Take OddDays weekend into account.

        If (DatePart("w", TheDate) + OddDays) > 6 Then

           TheDate = TheDate + OddDays + 2

        Else

           TheDate = TheDate + OddDays

        End If

        DateAddW = TheDate

     Else                        'Interval is < 0

        Interval = Int(-Interval) 'Make positive & subtract later.

   '    Make sure TheDate is a workday (round up).

        Temp = Format(TheDate, "ddd")

        If Temp = "Sun" Then

           TheDate = TheDate + 1

        ElseIf Temp = "Sat" Then

           TheDate = TheDate + 2

        End If

   '    Calculate Weeks and OddDays.

        Weeks = Int(Interval / 5)

        OddDays = Interval - (Weeks * 5)

        TheDate = TheDate - (Weeks * 7)

   '    Take OddDays weekend into account.

        If (DatePart("w", TheDate) - OddDays) < 2 Then

           TheDate = TheDate - OddDays - 2

        Else

           TheDate = TheDate - OddDays

        End If

        DateAddW = TheDate

      End If

   End Function

How to Use the DateAddW() Function

----------------------------------

Use the DateAddW() function wherever you would use the DateAdd() function.

For example, instead of

   DateAdd("w",[StartDate],10)

use:

   DateAddW([StartDate],10)

To test the DateAddW() function, enter the following line in the Immediate

window, and then press ENTER:

   ? DateAddW(#2/2/93#,10)

Note that the result is 2/16/93 (10 workdays).

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

Enter the following line in the Immediate window, and then press ENTER:

   ? DateAdd("w",#2/2/93#,10)

Note that the result is 2/12/93 (10 days), not 2/16/93 (10 workdays).

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 102-107 and 492-

493

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


PRB: DateDiff "W" Option Does Not Work

Article ID: Q95977

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When calculating the number of weekdays between two dates using the

"w" Weekday option, DateDiff() returns the number of weeks, not the

number of work days. The "w" option is supposed to function the same as

"d" for DateDiff(). It is provided as an option for compatibility with

the DatePart() function.

RESOLUTION

==========

If you are using the DateDiff() function to return the number of

days, substitute "d" for "w". You can use the Access Basic code in

this article to return the number of work days rather than the number

of days.

The code below shows how to calculate the number of work days in a

date range. To understand the following information, you need to be

familiar with Access Basic, know how to create and use Access Basic

procedures, and know how to use the Immediate window.

The following code provides a function, DateDiffW(), that calculates

the number of work days between two dates.

NOTE: In the following sample code, an underscore (_) is used as a

line continuation character. Remove the underscore when re-creating

this code in Access Basic.

   '**********************************************************

   'Declaration section of the module

   '**********************************************************

   Option Explicit

   Function DateDiffW(BegDate, EndDate)

      Const SUNDAY = 1

      Const SATURDAY = 7

      Dim NumWeeks As Integer

      If BegDate > EndDate Then

         DateDiffW= 0

      Else

         Select Case Weekday(BegDate)

            Case SUNDAY : BegDate = BegDate + 1

            Case SATURDAY : BegDate = BegDate + 2

         End Select

         Select Case Weekday(EndDate)

            Case SUNDAY : EndDate = EndDate - 2

            Case SATURDAY : EndDate = EndDate - 1

         End Select

         NumWeeks = DateDiff("ww", BegDate, EndDate)

         DateDiffW= NumWeeks * 5 + Weekday(EndDate) - Weekday(BegDate)

      End If

   End Function

How to Use the DateDiffW() Function

-----------------------------------

Use the DateDiffW() function wherever you would use DateDiff().

Instead of

   DateDiff("W",[StartDate],[EndDate])

use the following:

   DateDiffW([StartDate],[EndDate])

Steps to Test the DateDiffW() Function

--------------------------------------

In the Immediate window, type:

   ?DateDiffW(#2/2/93#,#2/18/93#)

The result is 12, the number of work days.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

In the Immediate window, type:

   ? DateDiff("W",#2/2/93#,#2/18/93#)

The result is 2 (the number of weeks), not 16 (the number of days) or

12 (the number of work days).

REFERENCES

==========

For more information on the DateDiff() and WeekDay() functions, search for

"DateDiff" and "WeekDay" using the Microsoft Access Help menu

Microsoft Access "Language Reference," version 1.0, pages 102-107 and 492-

493

Additional reference words: 1.00 1.10 2.00 dates work day diff part

KBCategory:

KBSubcategory: PgmOthr


PRB: DateDiff() Function Returns Incorrect Value

Article ID: Q104973

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you use the DateDiff() function on a large interval where the time

periods are specified in minutes or seconds, the result is not correct.

CAUSE

=====

The DateDiff() function returns a long integer. If the result is greater

than the allowed range for long integers (-2,147,483,648 to 2,147,483,647),

Microsoft Access truncates the value and returns the truncated value.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new module. Enter the following in the module's Immediate

   window, and then press ENTER:

      ? DateDiff("n",#12-31-100#,#12-31-9999#)

   The returned value, 911,403,103 minutes, is truncated because the actual

   value exceeds 2,147,483,647.

2. Enter the following calculation, which is equivalent to the function

   above, and then press ENTER:

      x=#12-31-100#

      y=#12-31-9999#

      ? (y-x)*24*60

   The returned value, 5,206,370,400 minutes, is correct. Note that

   Microsoft Access uses double-precision real numbers when doing immediate

   calculations.

Additional reference words: 1.00 1.10 2.00 date

KBCategory:

KBSubcategory: ExrOthr


PRB: DDEPoke to Word for Windows Incorrectly Formatted

Article ID: Q103993

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Word for Windows versions 1.0, 1.1, 1.1a, 2.0, 2.0a,

   2.0a-CD, 2.0b, 2.0c, and 6.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are "poking," or sending, data to a bookmarked location in a

Microsoft Word for Windows document during a DDE conversation, the

information may arrive in Word for Windows formatted with an incorrect font

and size.

RESOLUTION

==========

The Word for Windows product support group has described a workaround for

any application that tries to poke data into Word for Windows. To review

the article that lists the workaround, query on the following words here in

the Microsoft Knowledge Base:

   ddepoke and bookmark and format and character

STATUS

======

Microsoft has confirmed this to be a problem in the versions of Microsoft

Word for Windows listed above. We are researching this problem and will

post more information here in the Microsoft Knowledge Base as it becomes

available.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


PRB: DebugLibraries=True Instead of DebugLibraries=Yes

Article ID: Q115194

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The "Customizing MSACC20.INI Settings" topic in the Microsoft Access Help

system states that you should add the following line to the [Options]

section of your MSACC20.INI file in order to debug libraries:

   DebugLibraries=Yes

This information is incorrect.

RESOLUTION

==========

In order to debug libraries, add the following line to the [Options]

section of your MSACC20.INI file:

   DebugLibraries=True

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 15, "Using

Library Databases and Dynamic-Link Libraries," page 349

Additional reference words: 2.00 docerr

KBCategory:

KBSubcategory: GnlOthr


PRB: Default Width in Report Design Does Not Reflect Margins

Article ID: Q92670

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The default grid area is independent of how a report or form is printed.

The controls you place in the document determine the size.

In the United States, the default width of the grid area is set to 5

inches, regardless of the print settings (paper size, orientation, and

margins). There is no relationship between the default grid area size and

the default paper size or print area.

STATUS

======

This behavior is by design.

REFERENCES

==========

For more information on how to change the default layout for forms or

reports, search for "template" then "Creating a New Template for Forms and

Reports" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 defaults

KBCategory:

KBSubcategory: RptLayou


PRB: Detail Section Blank When Form Is Printed or Previewed

Article ID: Q117172

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you print or preview a form, the detail section is blank, even though

controls are visible in the detail section when you view the form in Form

view. Other sections, such as the form header and form footer, appear

correctly when you print or preview the form.

CAUSE

=====

This behavior occurs if the form's underlying table or query returns no

records, or if the detail section's DisplayWhen property is set to Screen

Only.

RESOLUTION

==========

Make sure the underlying table or query returns at least one record, or

place necessary controls in other sections, such as the form header or form

footer. If the detail section's DisplayWhen property is set to Screen Only,

change it to Always or Print Only.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

Example 1: No Records in Underlying Table:

1. Open the sample database NWIND.MDB.

2. Create a new table with several fields. Do not add any records to the

   table.

3. Save the new table as Table1 and then close it.

4. Create a new form based on Table1. Place the fields from the table in

   the form's detail section.

5. Place some controls, such as labels or buttons, in the form header and

   form footer.

6. View the form in Form view. Note that you can see all the controls.

7. Print or preview the form. Note that the detail section is blank.

Example 2: DisplayWhen Property Set to Screen Only:

1. Open the sample database NWIND.MDB.

2. Preview the Categories form. Note that you can see the controls in the

   form's detail section.

3. View the form in Design view.

4. Change the detail section's DisplayWhen property to Screen Only.

5. Preview the form again. Note that the detail section is blank.

Additional reference words: 2.00 missing fields

KBCategory:

KBSubcategory: FmsOthr


PRB: DFirst() and DLast() Functions Return Unexpected Records

Article ID: Q109380

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The DFirst() and DLast() functions do not return the first and last records

of the specified domain as you expect. If the domain is a query, the

DFirst() and DLast() functions appear to ignore the sort order of the

query.

CAUSE

=====

The DFirst() and DLast() functions return values from the first and last

records according to the order of the records in the domain. If the domain

is an indexed table, the functions will return the first and last records

in the indexed order. If there is no index, the functions will return the

first and last records in the order in which they were entered in the

underlying table.

RESOLUTION

==========

The following two sample Access Basic functions, GetFirst() and GetLast(),

can be used in place of the DFirst() and DLast() functions to return the

first and last records in the sorted domain as you expect.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

   Option Explicit

   Function GetFirst (Expr$, Domain$, Criteria$)

      Dim MyDB As Database

      Dim MyDyna As Dynaset

      On Error GoTo Err_GetFirst

      Set MyDB = CurrentDB()

      Set MyDyna = MyDB.CreateDynaset(Domain$)

      If Len(Criteria$) > 0 Then

         MyDyna.Filter = Criteria$

         Set MyDyna = MyDyna.CreateDynaset()

      End If

      MyDyna.MoveFirst

      GetFirst = MyDyna(Expr$)

   Bye_GetFirst:

      Exit Function

   Err_GetFirst:

      GetFirst = Null

      Resume Bye_GetFirst

   End Function

   Function GetLast (Expr$, Domain$, Criteria$)

      Dim MyDB As Database

      Dim MyDyna As Dynaset

      On Error GoTo Err_GetLast

      Set MyDB = CurrentDB()

      Set MyDyna = MyDB.CreateDynaset(Domain$)

      If Len(Criteria$) > 0 Then

         MyDyna.Filter = Criteria$

         Set MyDyna = MyDyna.CreateDynaset()

      End If

      MyDyna.MoveLast

      GetLast = MyDyna(Expr$)

   Bye_GetLast:

      Exit Function

   Err_GetLast:

      GetLast = Null

      Resume Bye_GetLast

   End Function

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Open the Employee List query. Note that the employee names are sorted

   by last name, with the name "Buchanan, B. L." listed first, with an

   Employee ID of 5.

3. Open the Introduction To Programming module in Design view, and

   then choose Immediate Window from the View menu.

4. Type the following in the Immediate window, and then press ENTER:

      ? DFirst("[Employee ID]","Employee List")

Employee ID 1 is returned, not Employee ID 5, even though Employee ID 5 is

first in the sort order. Employee ID 1 is the first indexed record in the

table that the query is based on.

REFERENCES

==========

Microsoft Access "Language Reference," pages 139-140

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ExrOthr


PRB: Duplicate Procedure Errors After Installing OUTPUTAS.MDA

Article ID: Q115187

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you install the Microsoft Access version 1.x OutPutAs library

(OUTPUTAS.MDA) in Microsoft Access version 2.0, the following error

messages will occur when you start Microsoft Access 2.0:

   Tried to load module with duplicate procedure definition:

   SOA_IsNull

   Tried to load module with duplicate procedure definition:

   SOA_RptToBIFF

   Tried to load module with duplicate procedure definition:

   SOA_RptToRTF

   Tried to load module with duplicate procedure definition:

   SOA_AddStyles

CAUSE

=====

The procedures named in the error messages above are already included in

Microsoft Access 2.0. When you load OUTPUTAS.MDA as a library database, the

duplicate procedure names cause the error messages.

RESOLUTION

==========

The functionality contained in OUTPUTAS.MDA is already in Microsoft Access

2.0. Uninstall OUTPUTAS.MDA as a database library.

If you do not want OUTPUTAS.MDA to appear in the Add-in Manager's list of

available libraries, do one of the following:

 - Move OUTPUTAS.MDA to another directory.

 - Rename OUTPUTAS.MDA to OUTPUTAS.OLD.

 - Delete OUTPUTAS.MDA.

MORE INFORMATION

================

The OutPutAs library is a supplemental version 1.x library that you use in

version 1.x to output reports to a Microsoft Excel spreadsheet, an RTF

file, or a text file. When you install Microsoft Access version 2.0, the

OutPutAs library is not loaded in version 2.0's MSACC20.INI file, since the

functionality in this library is included in version 2.0. The OUTPUTAS.MDA

file will appear in the Add-in Manager's list of available libraries in

version 2.0 if you install version 2.0 in the same directory as Microsoft

Access version 1.x.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 20, "Report Basics,"

page 499, and Appendix D, "Using Other Windows-Based Applications with

Microsoft Access," pages 735-738.

Additional reference words: 2.00 biff rtf ascii output.exe output.zip

KBCategory:

KBSubcategory: OtpTxt


PRB: Edit Find Dialog Box Is Modal in Form View

Article ID: Q95651

UifOthr


PRB: Empty Field List in Report or Form's Design View

Article ID: Q106286

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A blank field list appears when you are viewing an unbound form or report

in Design view.

CAUSE

=====

A field list will appear automatically if it was displayed in the form or

report you last designed. If the current form or report is unbound, the

field list will be empty.

RESOLUTION

==========

Close the field list. The Field List command on the View menu will become

unavailable until the form or report in Design view is bound.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB. Open the Categories form in

   Design view.

2. From the View menu, choose Field List. The field list will be displayed.

3. Close the form.

4. Open a new, unbound form in Design view.

An empty field list will be displayed.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmrFld


PRB: Empty Row in List Box Can Be Selected

Article ID: Q98298

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

An empty or null row of a list box can be selected.

CAUSE

=====

Null is a valid selection in Microsoft Access.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

It is also possible to select an empty or null value in a combo box.

Steps to Reproduce Behavior

---------------------------

1. Create a new form.

2. Create a list box on the form with the following properties:

      Object: list box

      ----------------

      RowSourceType: Value List

      RowSource: 1;2;;4

3. From the View menu, choose Form.

You can select the empty row between 2 and 4.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 9, "Designing

Forms" pages 233-243

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: FmsCmbo


PRB: Empty Table List When Attaching Btrieve Table

Article ID: Q94828

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attach a Btrieve table, you select the Xtrieve dictionary

file (FILE.DDF) in the Select File box. When you choose OK, Microsoft

Access opens the dictionary file and displays a list of tables you can

import or attach. However, the list is empty. In Microsoft Access version

2.0, you may receive the error message:

   Btrieve: Can't find file FIELD.DDF

CAUSE

=====

You do not have the FIELD.DDF file that Microsoft Access requires to

attach a Btrieve table.

RESOLUTION

==========

Microsoft Access requires the following three .DDF files in order to

attach a Btrieve table: FILE.DDF, INDEX.DDF, and FIELD.DDF. Make sure

that you have all three .DDF files before you try to attach a Btrieve

table.

MORE INFORMATION

================

When Microsoft Access cannot find the FIELD.DDF file, it creates a

6144-byte dummy FIELD.DDF file in the same directory in which FILE.DDF

appears. If you find this dummy file, you know that you are missing

the required FIELD.DDF file. Use Xtrieve or another third-party

utility to create the required .DDF files.

Btrieve and Xtrieve are manufactured by Novell, Inc., a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding these products' performance or reliability.

Additional reference words: 1.00 1.10 2.00 Xtrieve Btrieve index

KBCategory:

KBSubcategory: IsmBtrv


PRB: Err Msg "The Other Application Quit" with MS Excel 4.0

Article ID: Q103258

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the error message "The Other Application Quit" when you

are closing Microsoft Excel over a dynamic data exchange (DDE)

channel.

CAUSE

=====

Microsoft Excel version 4.0 automatically closes down any open DDE

channels when quitting, rather than waiting for the DDE channels to be

closed properly. This behavior generates the error message "The Other

Application Quit" in Microsoft Access.

RESOLUTION

==========

There are two methods to work around this problem. The first method is

to add an On Error Resume Next statement to your Microsoft Access

function, before the DDE quit command. The sample function below

demonstrates this method:

   Function CallExcel ()

      Dim chan

      x = Shell("c:\excel\excel.exe c:\excel\macro1.xlm", 1)

      chan = DDEInitiate("Excel", "System")

      DDEExecute chan, "[Run(""macro1.xlm!Message"")]"

      AppActivate "Microsoft excel"

      On Error Resume Next

      DDEExecute chan, "[quit]"

      DDETerminate chan

    End Function

The second method is to have Microsoft Excel quit itself, rather than

having Microsoft Access send the quit instruction. You can do this by

having the second to last line in a Microsoft Excel macro call another

macro. The first macro will contain a line similar to

   =ON.TIME(NOW()+"0:0:3","Leave")

that will call a second macro in three seconds. The second macro will

contain the two lines:

   =QUIT()

   =RETURN()

You can remove the DDE quit command from your Microsoft Access function

if you use this method.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

The following sample Access Basic function will open Microsoft Excel

and run a macro named Message. When the function instructs Microsoft

Excel to quit, the error message stated above will occur:

   Function CallExcel ()

      Dim chan

      x = Shell("c:\excel\excel.exe c:\excel\macro1.xlm", 1)

      chan = DDEInitiate("Excel", "System")

      DDEExecute chan, "[Run(""macro1.xlm!Message"")]"

      AppActivate "Microsoft excel"

      DDEExecute chan, "[quit]"

      DDETerminate chan

   End Function

REFERENCES

==========

Microsoft Excel "Function Reference," version 4.0, page 305

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpDde


PRB: Err: "Data Source Not Found, No Default Driver Specified"

Article ID: Q95050

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are trying to attach a SQL Server table, or use a table that has

already been attached, you receive the following error message:

   Data source not found and no default driver specified.

CAUSE

=====

You may have a missing, damaged, or incorrect ODBC.INI file.

Other situations may indirectly cause this error message. For more

information, query on the following words here in the Microsoft

Knowledge Base:

   debugging and troubleshooting and tips and Q102437

RESOLUTION

==========

Verify the following:

 - There is an ODBC.INI file in your WINDOWS subdirectory.

 - There is only one copy of the ODBC.INI file available on the computer

   you are using.

 - The entries in the ODBC.INI file are correct for the SQL database

   server to which you want to connect.

MORE INFORMATION

================

The contents of your ODBC.INI file should resemble the following:

   [ODBC Data Sources]

   MYSERVER=SQL Server

   YOURSRVR=SQL Server

   [MYSERVER]

   Driver=C:\WINDOWS\SYSTEM\SQLSRVR.DLL

   Description=SQL Server on server MYSERVER

   OemToAnsi=No

   Network=dbnmp3

   Address=\\MYSERVER\PIPE\SQL\QUERY

   [YOURSRVR]

   Driver=C:\WINDOWS\SYSTEM\SQLSRVR.DLL

   Description=SQL Server on server YOURSRVR

   OemToAnsi=No

   Network=dbnmp3

   Address=\\YOURSRVR\PIPE\SQL\QUERY

You will receive the error message if there is no section that refers

to the SQL database server to which you are trying to attach or if any

of the following are true:

 - The [MYSERVER] section is missing.

 - The Driver= line is missing.

 - The .DLL file on the Driver= line is missing its .DLL extension.

 - The .DLL file is missing, damaged, or outdated.

Additional reference words: 1.00 1.10 2.00 tshoot errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: Error in FontBold Property Help Menu Topic

Article ID: Q115568

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The "FontBold Property" Help menu topic incorrectly states that the

FontBold property applies only to reports.

RESOLUTION

==========

The FontBold property applies to the following controls on forms and

reports: combo boxes, command buttons, labels, list boxes, text boxes,

toggle buttons, and toggle buttons in option groups.

Note that the Print method in the "Description" section, and the Access

Basic code example in the "Remarks" section, of the Help topic only apply

to FontBold as a property of a report.

MORE INFORMATION

================

You can use the FontBold property to change text between bold and normal

rather than using the FontWeight property. Like the FontWeight property,

you can read and change the FontBold property in any view. For example,

   FontBold=False (0) is equivalent to FontWeight=400

while

   FontBold=True (-1) is equivalent to FontWeight=700.

REFERENCES

==========

For more information about the FontBold property, search for "FontBold"

then "FontBold Property" using the Microsoft Access Help menu.

Additional reference words: 2.00 docerr

KBCategory:

KBSubcategory: DcmOthr


PRB: Error In Help Files for Custom Control Refresh Method

Article ID: Q115192

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The Refresh method syntax in the Help files for the Scroll Bar and Calendar

custom controls is incorrect. These custom controls and their Help files

are included with the Microsoft Access Developer's Toolkit (ADT) version

2.0.

RESOLUTION

==========

The correct syntax for the Refresh method for the Scroll Bar and Calendar

custom controls is:

   calendar.object.[refresh]

   -or-

   scroll.object.[refresh]

Make sure to use brackets ([]) around the word "refresh."

MORE INFORMATION

================

The ADT includes a Help file for each of the three custom controls shipped

with the ADT. Only the Data Outline custom control Help file has the

correct syntax for the Refresh method.

Using the incorrect syntax listed in the other Help files will generate the

error message:

   Method not applicable for this object

REFERENCES

==========

For more information about the Refresh method, search for "Refresh" then

"Refresh Method" by double-clicking the Data Outline Control Help icon in

the Microsoft ADT program group in Program Manager.

Additional reference words: 2.00 docerr

KBCategory:

KBSubcategory: IntpOle


PRB: Error Message "Couldn't Find Input Table or Query"

Article ID: Q95909

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run a query, the following error message is displayed:

   Couldn't find input table or query '<Object name>'.

When you open the query in Design view, the field list is empty, but

the query grid still refers to deleted tables or fields.

CAUSE

=====

The query refers to a deleted table or query.

STATUS

======

This behavior is by design. The query will continue to refer to the

deleted table or fields so that you can determine what was deleted.

Modify your query so that it refers to tables or fields that do exist

after making this determination.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new table with one field. Save the table as Table1.

2. Create a new query based on Table1. Drag the field from the field

   list to the query grid.

3. Save the query as Query1.

4. In the Database window, delete Table1.

5. Open Query1. You will receive the error message listed above. Open

   the query in Design view. Note that although the field list is

   empty, the query grid still refers to the deleted table and field.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.1, Chapter 5, "Query Basics"

Microsoft Access "User's Guide," version 2.0, Chapter 10, "Query Basics"

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: QryOthr


PRB: Error Message "Couldn't Find Object [Object Name]"

Article ID: Q96589

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message:

   Couldn't Find Object [object name]

RESOLUTION

==========

Use the following to troubleshoot the problem:

 - First check to ensure that [object name] exists. It could be a

   table, a query, or an SQL statement. If it does not exist, you must

   remove all references to it from your application. Often, the

   RecordSource property of a form or report will contain a reference to

   an object whose name has changed or has been deleted.

 - If [object name] exists, then it is likely that there is a syntax

   or spelling error in the reference to it.

 - You're trying to open an attached table, but the file containing the

   table isn't on the path you specified when you attached it. If you've

   moved the file, you can use the Attachment Manager in Microsoft Access

   2.0 to update the attachment so it points to the correct path.

Additional reference words: 1.00 1.10 2.00 misc tshoot msg errmsg

KBCategory:

KBSubcategory: ExrObj


PRB: Error Message "Couldn't Open File" in Shared Environment

Article ID: Q103254

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You cannot open multiple instances of a Microsoft Access database even

though multiuser options have been set. You receive either the error

message

   Couldn't Open File <database name>

or the error message:

   <Database name> This file is already in use. Use a new filename or

   close the file in use by another application.

CAUSE

=====

This problem can occur if you attempt to open a shared database by

choosing it from the list at the bottom of the File menu, instead of

using the Open Database command on the File menu. When you open a

database by choosing it from the bottom of the File menu, Microsoft

Access opens the database with the same settings as the last time it

was opened.

RESOLUTION

==========

Running a single instance of Microsoft Access, open that particular

database with the Open Database command on the File menu. Then close

the database, thereby making the correct settings to the database.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

This problem occurs when Microsoft Access is being shared on a

network, but can be reproduced on a stand-alone computer with the

following steps:

1. Open the sample database NWIND.MDB by choosing Open Database from

   the File menu. Select the Exclusive check box and clear the Read

   Only check box before choosing OK.

2. From the View menu, choose Options.

3. In the Category box, choose Multiuser.

4. In the Items box, set Default Mode For Open Databases to Shared,

   and then choose OK.

5. Quit Microsoft Access.

6. Restart Microsoft Access, and then open the sample database

   NWIND.MDB by choosing Open Database from the File menu.

7. Start a second instance of Microsoft Access.

8. Open the sample database NWIND.MDB by choosing the database from

   the bottom of the File menu.

The following error message occurs:

    Couldn't Open File.

If steps 6 and 8 are reversed the following error message occurs:

    This File Already In Use.

REFERENCES

==========

For more information on problems opening databases in a shared

environment, query on the following words here in the Microsoft

Knowledge Base:

   couldn't and open and file

   -or-

   file and already and use

Additional reference words: 1.00 1.10 2.00 UI err msg recent multi user

KBCategory:

KBSubcategory: GnlMu


PRB: Error Message "Couldn't Open Table MSysAccounts"

Article ID: Q98224

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when attempting to start

Microsoft Access:

   Couldn't open Table 'MSysAccounts' in SYSTEM.MDA

CAUSE

=====

The SystemDB entry in the [Options] section of your .INI file points to a

file other than a valid SYSTEM.MDA.

NOTE: In Microsoft Access version 1.x, the .INI file is named MSACCESS.INI.

In Microsoft Access version 2.0, the file is named MSACC20.INI.

RESOLUTION

==========

Use the Change Workgroup Icon in the Microsoft Access Group to reset the

.INI file to the correct path for the SYSTEM.MDA file. Or, open the .INI

file using Notepad to correct the entry.

MORE INFORMATION

================

A correct entry in the .INI file looks like the following:

   [Options]

   SystemDB=C:\ACCESS\SYSTEM.MDA

In the sample line above, make sure to use the correct drive and path for

your Microsoft Access configuration.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: StpOthr


PRB: Error Message "Expression Is Too Long for the QBE Grid"

Article ID: Q90106

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive either of the following error messages:

   Expression is too long for the QBE grid

   -or-

   Expression is too long for the QBE grid and has been truncated:

   '<Expression>'

CAUSE

=====

Microsoft Access combines Criteria columns in the Query by Example (QBE)

grid if two or more columns in the grid have the same field name, in order

to avoid repetitive columns. You will see this behavior after you save the

query and then open it again.

This behavior only causes a problem when you are trying to use a long WHERE

clause. In Microsoft Access version 2.0, each cell of the QBE grid is

limited to 1024 characters. If your expression is longer than this, you

will receive the error message:

   Expression is too long for the QBE grid

In Microsoft Access version 1.x, each cell of the query grid is limited to

255 characters. If your expression is longer than this, you will receive

the error message:

   Expression is too long for the QBE grid and has been truncated:

   '<Expression>'

This error can also occur if you type too long a WHERE clause in the SQL

View window and then switch back to Design view.

RESOLUTION

==========

There are two workarounds for this behavior. The first is to break the

larger statement into two smaller statements. The other method is to use

SQL view only, avoiding displaying the query in Design view. This method is

only available in Microsoft Access version 2.0.

To break a long statement into two smaller statements, choose either of the

two columns with the same field name and put parentheses around the field

name. The following example demonstrates this method:

1. Create the following sample query:

      Query1

      --------------------------

      FieldName: UserID

         Criteria: Like "DON*"

      FieldName: UserID

         Criteria: Like "DONFU*"

2. Save and then close the query.

3. Open the query in Design view. Note that the query is now:

      Query1

      ------------------------------------------

      FieldName: UserID

         Criteria: Like "DON*" And Like "DONFU*"

      FieldName: UserID

4. Re-create the original query from step 1.

5. Place parentheses around the second field name, so the query is:

      Query1

      --------------------------

      FieldName: UserID

         Criteria: Like "DON*"

      FieldName: (UserID)

         Criteria: Like "DONFU*"

   NOTE: If the field name is more than one word, place brackets

   around the field name before putting the field name in parentheses.

6. Save and then close the query.

7. Open the query in Design view. Note that the query is now:

      Query1

      ----------------------------

      FieldName: UserID

         Criteria: Like "DON*"

      FieldName: Expr1: ([UserID])

         Criteria: Like "DONFU*"

Putting parentheses around the field name turns it into an expression. This

differentiates the column from the other column with the same field name,

and prevents Microsoft Access from combining the columns.

STATUS

======

This behavior is by design.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 5, "Query Basics"

Microsoft Access "User's Guide," version 2.0, Chapter 10, "Query Basics,"

and Chapter 11, "Designing Select Queries"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryOthr


PRB: Error Message "Unable to Connect to Data Source"

Article ID: Q95012

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

----------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when you are trying to access

a SQL Server:

   Unable to connect to data source

CAUSE

=====

The SQL Server you are trying to access does not have a correct entry

in the [SQLSERVER] section of the WIN.INI file, or the SQL server is down,

overloaded, or otherwise unavailable.

RESOLUTION

==========

To correct this situation, verify that the SQL Server is up and

available and that the entry in the [SQLSERVER] section of the WIN.INI

file looks like this:

   [SQLSERVER]

   MY_SERVER=DBNMP3,\\MY_SERVER\PIPE\SQL\QUERY

If there are any spaces in this entry or if the server name in the

\\MY_SERVER\PIPE\SQL\QUERY part of the statement is misspelled, you

will receive the error message.

MORE INFORMATION

================

It is possible that there are other situations which may indirectly

cause this error message. Here are several other things you can check to

troubleshoot this problem:

1. Use File Manager to search for multiple, corrupted, or outdated

   copies of these files:

      ODBC.DLL - 44736 bytes, dated 10-16-92 or later

      DBNMP3.DLL - 8241 bytes, dated 9-15-92 or later

      SQLSRVR.DLL - 135792 bytes, dated 10-16-92 or later

      NETAPI.DLL - depends on the network being used

      COMMDLG.DLL - 89248 bytes, dated 10-25-92 or later

   NOTE: The sizes and dates referenced are correct if the files were

   installed by Microsoft Access version 1.0.

2. Make sure the files listed above are in appropriate locations. All files

   except NETAPI.DLL are usually installed in the Windows System directory.

   The NETAPI.DLL file is a network specific driver, so it's usually

   located in the network's program directory, which should be in the path.

3. Use another application, such as Q+E, SAF, or PowerBuilder, on the same

   computer to attempt to attach to the same data source. If you cannot

   access the data source from another application, there is probably a

   problem with the network (NETAPI.DLL) or with the server, not with

   Microsoft Access or ODBC.

4. Attempt to attach to another data source, if available, such as

   another SQL server. If you can attach to another server, then the

   original server may be down or you may need to reconfigure the entry

   for that server using the ODBC Administration Utility.

5. Attempt to attach to the same data source from another computer. If

   you cannot access the SQL server from another computer, there may be a

   network wide problem or the server may be down or not communicating.

6. Try increasing the ODBC timeout settings in the ODBC section of the

   MSACCESS.INI file.

7. Check with the system administrator to see if the SQL server is up,

   available for transactions, and operating correctly.

8. Reinstall ODBC after performing a clean boot and renaming the ODBC.DLL,

   DBNMP3.DLL, and SQLSRVR.DLL files.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Appendix D, "Setting Up

Microsoft Access on a Network," pages 660-662

Additional reference words: 1.00 1.10 2.00 ODBC errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: Error Message When Importing Informix Delimited Text File

Article ID: Q99406

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to import an Informix delimited text file that uses

the pipe (|) symbol as a delimiter, you receive the following error

message:

   Name " contains invalid characters

CAUSE

=====

When you export in Informix as text delimited and you specify the pipe

symbol as the delimiter, Informix adds an extra pipe symbol at the end

of the line. When you import this file to Microsoft Access by

specifying "First row contains field names," Microsoft Access assumes

there is another field after the last pipe symbol. Since the value is

null, Microsoft Access returns the above error message.

RESOLUTION

==========

 - Open the file in a text editor and add a dummy name after the last pipe

   symbol. After you import the file, you can delete this dummy field.

 - Clear the First Row Contains Field Names check box when you import the

   file. After you import the file, delete the first row of the table

   (which contains the field names instead of data). Then, switch to Design

   view and modify the table's field names.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a text file in Microsoft Windows Notepad as follows:

      A|B|C|

      1|2|3|

   Place a pipe symbol between each character. The pipe symbol is

   usually found on the backslash (\) key on your keyboard.

2. Save the file as INFORMIX.TXT.

3. Open a database in Microsoft Access.

4. From the File menu, choose Import.

5. Select Text (delimited) as your data source and choose Import.

6. Select the INFORMIX.TXT file that you created in step 1. Choose OK.

7. The Import Options dialog box appears. Select the First Row

   Contains Field Names check box, then choose the Options button.

8. In the Field Separator combo box, type the pipe symbol and choose

   OK. The above error message appears.

Informix is manufactured by Informix Software, Inc., a vendor

independent of Microsoft; we make no warranty, implied or otherwise,

regarding this product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 Import\Export Informix

KBCategory:

KBSubcategory: IsmTxtd


PRB: Error Message When Opening Second Instance of .MDB File

Article ID: Q93139

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you open a database exclusively, and then attempt to open the same

database as shared in another instance of Microsoft Access, you receive the

following error message:

   'Database.mdb' This file is already in use. Use a new filename or

   close the file in use by another application.

In Microsoft Access version 1.x, when you open a database as shared, then

attempt to open the same database exclusively in another instance of

Microsoft Access, you receive the error message:

   Couldn't open file '<path><filename>'.

This message is not very helpful, in that it does not state why the file

could not be opened.

In Microsoft Access version 2.0, you receive the error message:

   The Database is opened by user '<username>' on machine

   '<machine name>'. You can't open this database exclusively.

RESOLUTION

==========

Open the database as shared in the second instance of Microsoft Access, or

close the database in the first instance of Microsoft Access.

STATUS

======

This behavior is by design.

REFERENCES

==========

For more information on opening a database for shared access, search for

"opening databases" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 lock network multiuser errmsg

KBCategory:

KBSubcategory: GnlMu


PRB: Error Message: Cannot Change Working Directory to Default

Article ID: Q95904

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you start Microsoft Access, you may receive the following error

message

   Couldn't change working directory to <Default Database Directory>.

   Click OK or press ENTER to continue.

where <Default Database Directory> is the path that appears as the

Default Database Directory property in the Items box when you choose

Options from the View menu.

Choosing OK or pressing ENTER opens Microsoft Access.

CAUSE

=====

You receive this error message if any of the following is true about

the Default Database Directory property:

 - The property is not pointing to a valid path.

 - The path is longer than 64 characters.

 - In version 1.x, if the property is a period (.), there is one space

   before it. This problem does not occur in version 2.0.

RESOLUTION

==========

Make sure that the path shown in the Default Database Directory

property does not exceed 64 characters and that no leading space

precedes a period, if a period is present.

MORE INFORMATION

================

To check the default directory for Microsoft Access, complete the

following steps:

1. Start Microsoft Access and open any database.

2. From the View menu, choose Options.

3. In the Category box, select General. In the Items box, select

   Default Database Directory.

Normally, during Microsoft Access installation, the default directory

is set to ".", which represents the Microsoft Access Startup

directory.

You can also set a default directory to ".\subdir" and it will set the

default to a subdirectory under the Microsoft Access startup directory

called "subdir." Or you can specify a complete path.

Additional reference words: 1.00 1.10 2.00 errmsg period default database

KBCategory:

KBSubcategory: StpOthr


PRB: Error Msg. "Error Occurred in WriteSTF" in Setup Wizard

Article ID: Q117767

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run the Microsoft Access Developer's Toolkit version 2.0 Setup

Wizard, you receive the following error message when the Setup Wizard

creates the disk images:

   Error occurred in WriteSTF

CAUSE

=====

This error message can occur if any of the files you included with your

application has a name that contains an apostrophe (').

RESOLUTION

==========

Rename the file that has an apostrophe in its name to a new name that does

not contain an apostrophe, and then run the Setup Wizard again.

MORE INFORMATION

================

After you see the "Error occurred in WriteSTF" error message, the following

error message will appear:

   File '<disk-image path>\Disk1\setup.stf' is opened for exclusive access

   by another application.

Although the Setup Wizard will seem to finish successfully, the Setup disks

that are created will not work correctly. When you try to install your

application from these Setup disks, you will receive the following error

message and then Setup will terminate:

   Object ID 23: Group Object: Bad Data Value.

Steps to Reproduce Behavior

---------------------------

1. Use any text editor (such as Windows Notepad) to create a text file with

   the name TEST'1.TXT. (Note the apostrophe in the filename.)

2. Start the Setup Wizard. In the Files To Include box, include only the

   TEST'1.TXT file, then choose Next.

3. In the Available Options box, do not select any options. Choose Next.

4. In the Application Name box, type "TestIt" (without quotation marks). In

   the Default Installation Directory box, type "C:\TESTIT" (without

   quotation marks). Choose Next.

5. Do not type anything in the Executable File Name box or the Command Line

   box. Choose Next.

6. In the Application Setup Directory box, type "C:\SETUP" (without

   quotation marks). Select the Network Setup (Flat) option button. Choose

   Finish. The error messages stated above will appear.

REFERENCES

==========

Microsoft Access Developer's Toolkit "Advanced Topics," version 2.0,

Chapter 2, "Creating a Custom Setup Program"

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: StpOthr


PRB: Error When Trying to Enforce Referential Integrity

Article ID: Q113494

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you create a relationship in the Relationships window by dragging a

field from one table to another, you get the following error message when

you select "Enforce Referential Integrity" and choose the Create button.

   Can't create relationship to enforce referential integrity. The

   field(s) in the primary table must be the primary key or have a unique

   index.

CAUSE

=====

You must drag the joining field from the "one" side to the "many" side in

order to enforce referential integrity." The field on the "one" side must

also be the primary key field in that table, or have a unique index. If you

are dragging the joining field from the "one" side to the "many" side and

still get this error, another possible cause might be the way your indexes

are set up.

RESOLUTION

==========

To set up your indexes correctly, open the "one-side" table in Design view

and set a primary key, or create a unique index, for the field you want to

use. Then, create the relationship between the tables.

The following example uses the sample database NWIND.MDB to demonstrate a

relationship with referential integrity enforced:

1. Open the sample database NWIND.MDB.

2. From the Edit menu, choose Relationships.

3. From the Edit menu, choose Clear Layout. When you are prompted

   to continue, choose OK.

4. From the Relationships menu, choose Add Table.

5. Double click the Products table and the Order Details table. Choose

   Close.

6. If there is already a relationship line drawn between the Products

   table and the Order Details table, select it and press DEL

   to remove it. When you are prompted to continue, choose OK.

7. Drag the Product ID field from the Products table onto the Product

   ID field in the Order Details table.

8. In the Relationships dialog box, select the "Enforce Referential

   Integrity" check box, and then choose Create.

   This will create a one-to-many relationship between the Products table

   and the Order Details table.

9. Close the Relationships window. Do not save your changes.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce the Error:

-----------------------------

1. Open the sample database NWIND.MDB.

2. From the Edit menu, choose Relationships.

3. From the Edit menu, choose Clear Layout. When you are prompted

   to continue, choose OK.

4. From the Relationships menu, choose Add Table.

5. Double click the Products table and the Order Details table. Choose

   Close.

6. If there is already a relationship line drawn between the Products

   table and the Order Details table, select it and press DEL

   to remove it. When you are prompted to continue, choose OK.

7. Drag the Product ID field from the Order Details table onto the Product

   ID field in the Product table.

8. In the Relationships dialog box, select the "Enforce Referential

   Integrity" check box, and then choose Create.

   This will cause the error message to pop up. You must drag the field

   from the "one" side (the Products table) to the "many" side (the Order

   Details table) in order to enforce referential integrity.

9. Close the Relationships window. Do not save your changes.

REFERENCES

==========

For additional information about setting up relationships, search for

"Relationships" using the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 2.0, Chapter 2, "Designing a

Database (Determining the Relationships)"

Microsoft Access "User's Guide," version 2.0, Chapter 7, "Table Basics"

Additional reference words: 2.00

KBCategory:

KBSubcategory: TblOthr


PRB: ESC While Creating Control Does not Deselect Control

Article ID: Q90094

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Pressing ESC while creating a control on a form does not deselect

the control in the toolbox.

CAUSE

=====

The toolbox is not reset until the mouse button is released. This

behavior allows you to press ESC so that you can realign a control

on the form.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open a new form.

2. From the View menu, choose Toolbox.

3. Using the left mouse button, select the text box control in the

   toolbox and drag the control to the new form, but do not release

   the left mouse button.

4. Press ESC.

   The text box is canceled but the text box control remains selected

   in the toolbox.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 214-230

Additional reference words: 1.00 1.10 2.00 toolbox deselect checkpage

KBCategory:

KBSubcategory: FmrTlbx


PRB: Every Other Page Blank in Printed Reports

Article ID: Q95920

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you print a report generated in Microsoft Access, a blank page appears

between every printed page of the report or a blank mailing label appears

between every printed label.

CAUSE

=====

Blank pages or mailing labels are generated when a report or label is

wider or longer than the specified page. This condition can be caused by

one or more of the following problems:

 - The total width of the form or report, plus the widths of the left and

   right margins, exceeds the page width (which is usually 8.5 inches).

 - The page size exceeds the user-defined paper size.

 - You used the Groups/Totals ReportWizard, but did not select the

   Fit All Fields On One Page check box. Because of this, the

   ReportWizard may have located fields or controls off the page.

 - In the Print Setup box under Item Size, the Same As Detail check box

   has been cleared.

RESOLUTION

==========

The following resolutions correspond to each of the four causes described

above:

 - Reduce the width of the form or report, reduce the left or right

   margins, or reduce all three so that the total width of the form or

   report, plus the width of the margins, does not exceed the page width.

   Use the following formula:

      (Form or Report Width)+(Left Margin)+(Right Margin)<=(Page Width)

   Use the form or report's property sheet to view or change the Width

   property. Before you reduce the width of a form or report, move the

   fields and controls on it to match the new size.

   To view the left and right margin values, choose Print Setup from the

   File menu.

   If problems persist, use the following procedure to check the Print

   Setup dimensions:

   1. From the File menu, choose Print Setup.

   2. Choose More.

   3. Under Item Size, verify that the Same As Detail box is

      selected.  If so, the width and height listed will match the

      dimensions of the detail section of the report. If not, these

      settings will override the detail settings of the report and may

      cause blank pages to print.

      NOTE: Item Size is usually used for multiple-column reports. You

      must ensure that all the columns fit on the report form when you set

      these values.

 - If the page size is user-defined, Microsoft Access reads the settings

   that you specified for that printer driver with the Printers utility in

   the Windows Control Panel. If your report page exceeds this user-defined

   paper size, your report will include blank pages.

   A new page size will not be available in Microsoft Access until you

   set one up in the Printers utility in the Control Panel.

   The following steps describe how to change the page size with the

   Printers utility:

   1. Open Control Panel, usually found in the Main program group of

      Microsoft Windows Program Manager.

   2. Double-click the Printers icon to start the Printers utility.

   3. Select the printer driver you want to change and then choose the

      Setup button.

   4. In the Paper Size box, select User-Defined. A dialog box will be

      displayed in which you can adjust the settings.

      NOTE: Only dot-matrix printer drivers have a user-definable page

      option. Laser printer drivers do not.

 - When you are using the Groups/Totals ReportWizard, select the Fit All

   Fields On One Page check box on the last screen before you switch to

   Design view or print or preview the report. Once you select this check

   box, the ReportWizard assumes a page 8.5 inches wide, then sizes the

   fields and controls accordingly. If the check box is cleared, the

   resulting report width may exceed the page size.

 - The Same As Detail option is useful when you create a detailed,

   multiple-column report and want the detail section to be a different

   size than the other sections. Clearing this check box can cause blank

   pages if the width defined for the detail section of the report is

   greater than the page size specified. This box, found under Item Size in

   the Print Setup dialog box, is selected by default. The Width property

   is set to match the report's Width property.

STATUS

======

This behavior is by design.

Additional reference words: 1.00 1.10 2.00 skipping blank page report

errmsg

KBCategory:

KBSubcategory: RptLayou


PRB: Export Table to Other Database Type Does Not Create Index

Article ID: Q97773

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you export a Microsoft Access table with a primary key field to any of

the supported database formats, an index is not created. Also, if you

import a supported foreign database table having an index or primary key,

the resulting Microsoft Access table will not have a primary key defined.

CAUSE

=====

The Microsoft Access import and export utility only imports and exports

data, not key or index definitions.

RESOLUTION

==========

When you export a Microsoft Access table to an external database format,

you will need to use the native application for that file type to define

the index or key fields. Likewise, after a foreign database is imported to

your Microsoft Access database, you will need to open the table in Design

view and define the primary key field or fields.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

The following database formats can be imported or exported by Microsoft

Access. After a table is exported from Microsoft Access, use the native

product for each file type to create your indexes or key fields.

   FoxPro 2.x

   Paradox 3.x

   Paradox 4.x (Microsoft Access version 2.0 only)

   dBASE III +

   dBASE IV

   Btrieve

   SQL Server

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


PRB: Exporting Date Fields to Text Includes Time Format

Article ID: Q103174

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you export a table that includes a date field to a text file,

Microsoft Access will automatically add the time format to the date in

the exported text file. The information will be formatted as "mm/dd/yy

hh:nn:ss".

CAUSE

=====

In Microsoft Access, dates are stored with both date and time formats.

During the export process Microsoft Access creates both the date and

time format in the exported text file. If there is no data for the

time format it will show up as all zeros (indicating 12 A.M.).

RESOLUTION

==========

There are two methods you can use to work around this problem:

Method 1

--------

Create a query with a calculated field to format the date field

appropriately, and then export the results of the query. The details

of this method are listed below in the "workaround" section.

Method 2

--------

Microsoft Access can create a fixed width text file, using the "Text

(Fixed Width)" export format. Using this method, you can set the size

of the date field to 8 characters in the Import/Export specification.

This will truncate the time portion of the date field during export.

NOTE: Common text exports require the data to be delimited using the

"Text (Delimited)" format. Method 2 will not be useful in these cases.

For more information on this method, see the Microsoft Access "User's

Guide," pages 78-79.

STATUS

======

This behavior is by design. This feature is under review and will be

considered for revision in a future release.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a table with a new field called Birthday with Date/Time

   chosen as the data type.

2. From the File menu, choose Save. Save the table with a unique name,

   such as "MyTable".

3. From the View menu, choose Datasheet. Type "11/15/67" (without the

   quotation marks) in the first record, and then close the table.

4. From the File menu, choose Export.

5. Select "Text (Delimited)" from the list of available export

   formats, and then choose OK.

6. Select the table saved in step 2 from the list of available tables,

   and then choose OK.

7. Type a unique name in the File Name box, and then choose OK.

8. In the Export Text Options dialog box, select OK.

9. Open the exported text file in any text editor (for example, the

   Windows Notepad text editor), and note that the date is formatted

   as "11/15/67 00:00:00".

Workaround (Using a Query to Export Date Fields Appropriately)

--------------------------------------------------------------

1. Create a new query and add the name of the table to be exported.

2. Include all desired fields in the query grid except for the date

   field.

3. For a date field called "Birthday", type the following in an empty

   column's FieldName box:

      Birthday2: Format([Birthday], "mm/dd/yy")

   NOTE: The new calculated field name cannot match the name of any

   other field that is included in the query.

4. Repeat step 3 for all other date fields.

5. From the Query menu, choose Make Table. In the Table Name box, type

   a unique table name, and then choose OK.

6. From the Query menu, choose Run to execute the query.

   The query will run and the results will be stored in the new table

   named in step 5.

7. Close the query. Make sure to save the query with a unique name if

   you will want to use it again.

8. Activate the Database window, and then export the new table using

   the Export command on the File menu.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 78-79 and 162-167

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


PRB: Exporting Table with OLE Object or Memo Field to Paradox

Article ID: Q93928

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you export a table from Microsoft Access that contains a field

with an OLE object or Memo data type in Paradox 3.x format, the

resulting Paradox table contains one entry that says m_i_c_r_o_s_o_f_t.

You can see this result by importing the Paradox table you just exported

and then opening the table.

Microsoft Access version 2.0 can export Memo and OLE fields to Paradox 4.x

format. If you export Microsoft Access version 2.0 Memo or OLE fields to

Paradox 3.x format, the problem mentioned above will occur.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. In Microsoft Access, copy any existing table to a new name.

2. In Design view, add an OLE Object field or Memo field to the copied

   table.

3. After saving and closing the table, export it choosing Paradox 3.x as

   the data destination and TESTFLD.DB as the name. You will get this

   error: "Invalid Data Type." However, the TESTFLD.DB file is created.

4. Import TESTFLD.DB using Paradox 3.x as the Data Source.

5. Open the resulting table. You will see a table consisting of one field

   with the field name m_i_c_r_o_s_o_f_t and the data type Number, but

   there is no data in the table.

Paradox is manufactured by Borland International, a vendor independent of

Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 memo

KBCategory:

KBSubcategory: IsmPdox


PRB: Exporting to Fixed-Width Text File Left Justifies Numbers

Article ID: Q98663

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you export a table containing a Number or Currency field to a

fixed-width text file, the numbers in the table become left justified.

CAUSE

=====

Since the numbers are being exported to a fixed-width text file,

Microsoft Access pads zeroes to the right of the number until it meets

the proper field width.

RESOLUTION

==========

To make the numbers align with the decimal and pad zeros to the

left instead of the right, you first must determine the maximum length

of the Number or Currency field. Use this number of zeros in the

Format() function below. Next, you must determine the number of decimal

places the field in question uses. Use this value to determine how

many zeros to place after the decimal point in the Format() function

below. Finally, create a query based on the following Microsoft Access

SQL statement:

   SELECT DISTINCTROW

      Format([MyNumber],"0000.00")

   AS [Expr1]

   INTO [MyNewTable]

   FROM [MyOldTable];

For this example, this SQL statement assumes that you have the

following table:

   Table: MyOldTable

   -----------------

   FieldName: MyNumber

   DataType: Currency

It also assumes that the longest value in the MyNumber field is 7

characters in length (including the decimal and decimal places) and

that each value has two decimal places. The above Microsoft Access SQL

statement, when typed in the SQL window in the query-by-example

(QBE) grid, makes a new table called MyNewTable with the MyNumber

field padded to the left with zeros.

When you use the above Microsoft Access SQL statement in a query, the

data from MyOldTable is formatted with decimal justification and

placed in a new table called MyNewTable.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

--------------------------

1. Create the following table:

      Table: MyOldTable

      -----------------

      FieldName: MyNumber

      DataType: Currency

2. Enter the following numbers in the table:

      34.5

      123.56

      4578.90

3. From the File menu, choose Export and select the Text (Fixed Width)

   option. Export MyOldTable.

4. Open the exported text file with a utility, such as Microsoft

   Windows Notepad,and view the numbers. They appear as follows:

      34.5000

      123.560

      4578.90

Additional reference words: 1.00 1.10 2.00 Importing/Exporting

Justification

KBCategory:

KBSubcategory: IsmTxtfx


PRB: Exporting to SQL Server Does Not Create Indexes

Article ID: Q90149

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access allows you to export data to SQL Server backends.

However, Microsoft Access does not build the index on export, thus

creating potential problems and confusion. For example, if you then

attach the table, updates are not allowed and the data is displayed as

read only in datasheet or form view.

CAUSE

=====

Microsoft Access can update an attached SQL Server table only if the

table has a unique index. However, Microsoft Access does not build

indexes on the SQL Server table when exporting information.

RESOLUTION

==========

You can create indexes on exported SQL Server tables manually. After the

indexes are created, attach (or re-attach) the tables.

REFERENCES

==========

For more information on creating indexes on SQL Server database

tables, see the SQL Server "System Administrator's Guide," or pages

67-72 in the SQL Server "Language Reference."

Additional reference words: 1.00 1.10 2.00 export odbc

KBCategory:

KBSubcategory: ObcOthr


PRB: Field Object Type Property Returns "Invalid Operation"

Article ID: Q115901

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you assign a variable to a property (such as Type) of a field object

of an Index object, you receive the error message "Invalid Operation." This

occurs for all properties except Name and Attributes.

CAUSE

=====

Field objects of an Index object have a subset of the normal properties.

The only valid properties are Name and Attributes, and the Attributes

property has special values. For an Index object's field object, the

Attributes property represents an ascending or descending sort order.

RESOLUTION

==========

If you need to refer to other properties of the field object, use the

TableDef field object. For example, to get the Type property you could use

   x = tabledef.fields("myfield").properties("Type")

instead of:

   x = tabledef.indexes("Myindex").fields("myfield").properties("Type")

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB and create a new module.

2. Enter the following line in the Declarations section of the module:

      Option Explicit

3. Enter the following code in the module:

      Function FieldType ()

         Dim ws As WorkSpace

         Dim db As Database

         Dim tdef As TableDef

         Dim result As String

         Dim i As Integer

         ' Set up the environment.

         Set ws = DBEngine.Workspaces(0)

         Set db = ws.Databases(0)

         ' Main routine

         Set tdef = db.tabledefs("Employees")

         ' The line below results in "Invalid Operation."

         result = tdef.indexes("PrimaryKey").fields(0).properties("Type")

         Debug.Print result

         ' Cleanup

         db.Close

         ws.Close

      End Function

4. From the View menu, choose Immediate Window.

5. In the Immediate window, type the following line and then press

   ENTER:

      ? FieldType()

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: PgmObj


PRB: Floating Objects Can Cause Unusual Effects

Article ID: Q89548

UifOthr


PRB: Fonts May Change Zooming Out in Print Preview

Article ID: Q90859

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Zooming out when previewing a report may cause the font to change

to a generic font.

CAUSE

=====

Microsoft Access chooses fonts so that the font displayed will

always be readable. The normal font will print as expected.

RESOLUTION

==========

This behavior is by design.

REFERENCES

==========

For more information on previewing a report, search for "preview" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmrColr


PRB: Form Opened in Form View Is Completely Blank

Article ID: Q93261

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You open a form in Form view, and it is completely blank. There are no

controls or text. Everything is blank.

CAUSE

=====

Typically, this happens because the dynaset contains no records or

privileges have been limited.

RESOLUTION

==========

Controls located in form headers or footers are always visible--even

when privilege limits or empty dynasets prevent the display of controls

located in the detail section. Therefore, when you design a form, place

necessary controls such as command buttons and check boxes in the form

header or footer section. Also, you should ensure that each dynaset

contains at least one record.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

The following situations may cause a blank form to display:

 - The form is based on a query that contains a one-to-many join, and

   the query returns no records.

 - The form is not updatable at all. It is a read-only form with the

   AllowUpdating property set to No Tables, or it is a static form that

   displays results by using a GROUP BY clause or a DISTINCT operator.

 - The form is based on a query that contains a one-to-one join, and one of

   the tables is in a read-only database.

 - The form is based on a query that contains a many-to-one inner join,

   and the query does not contain all the joined columns of the many-side

   table.

 - The form is based on a query that includes an updatable remote table

   but does not include all the columns that make up the primary key.

 - The form is read-only and is based on an empty table.

Steps to Reproduce Situation 1

------------------------------

1. Change the Catalog query in the NWIND sample database placing IS NULL

   in the criteria cell for the field [Category Name].

2. Create a new form based on the modified query, and place some fields

   and a command button in the detail section.

3. Switch to Form view.

Result: The blank form is displayed.

Steps to Reproduce Situation 6

------------------------------

1. Create a new table. Do not enter any data.

2. Create a new form based on the table. Add a command button and

   make the form read-only.

3. Switch to form view.

Result: A blank form is displayed.

The form displays blank in all situations because the dynaset is empty.

The form would display as expected if you were adding new records, but

the setting for the form or the joins in the query prevent you from

using the form to add new records.

To work around this issue, place necessary controls or command buttons in

the form header and footer. Headers and footers display even when the

detail section is blank.

Additional reference words: 1.00 1.10 2.00 object has no value

KBCategory:

KBSubcategory: FmsOthr


PRB: Form or Report Cannot Be Opened or Previewed

Article ID: Q90137

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you open a form or report in Design view and then preview it, the form

or report is not previewed. In addition, if you select the form or report

from the Database window and choose Open or Preview, nothing happens.

CAUSE

=====

The form or report's OnOpen property may have a macro attached to it whose

first action is StopAllMacros. This macro action acts like the CancelEvent

action, which prevents the form or report from opening.

The StopAllMacros action stops all macros that are currently running. In

this case, the form or report's OnOpen property calls a macro that is

immediately terminated, which aborts the preview of the report.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new macro and add StopAllMacros as the first action.

2. Save the macro as Macro1.

3. Open a report in Design view.

4. Set the report's OnOpen property to Macro1.

5. Preview the report. Note that nothing happens.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 522 and 566

Additional reference words: 1.00 1.10 2.00 container checkpage

KBCategory:

KBSubcategory: McrActn


PRB: Forms and Reports Print Slowly, Large Temporary Files

Article ID: Q103430

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You run out of temporary disk space when you print forms and reports,

or your reports print very slowly.

CAUSE

=====

Forms and reports that contain lines, bordered fields, or opaque

fields print much more slowly than the same form or report without

graphic objects. This behavior holds true for Microsoft Windows

applications in general.

Because lines, bordered fields, and opaque fields are treated as

bitmaps, a great deal of data is being sent to the printer at once.

Large temporary files are needed to print the form or report.

If you specify an incorrect or low setting for printer memory in

Control Panel, Windows "bands" complex print jobs. It sends small

chunks of graphics to the printer, then clears them after the printer

has processed them. Since Windows cannot band text, it sends TrueType

fonts to the printer as graphics. When this occurs, the files become

extremely large.

When you print your document in landscape format, your print speed may

decrease and your temporary files may increase in size. This problem

occurs primarily because Microsoft Access versions 1.0 and 1.1

print lines as graphics.

Printing a line as a graphic is acceptable if the line is horizontal,

since graphics are sent to the printer one row of pixels at a time.

However, vertical lines can be a problem. In large graphics, a record

is sent to the printer for each pixel in the line. When you print in

landscape format, the printer interprets these horizontal lines as

vertical lines.

MORE INFORMATION

================

Microsoft Access version 2.0 has a FastLaserPrinting property for forms and

reports. If you set the FastLaserPrinting property setting to Yes, lines

and rectangles in your form or report will be replaced by rules when you

print the form or report. This property speeds up printing only on certain

laser printers; it has no effect on dot-matrix printers. The

FastLaserPrinting property also cannot speed up early versions of laser

printers that do not support rules.

REFERENCES

==========

For more information about the FastLaserPrinting property in Microsoft

Access version 2.0, search for "FastLaserPrinting" then "FastLaserPrinting

Property" using the Microsoft Access version 2.0 Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PtrOthr


PRB: Global Custom Menu Overrides Form or Report Custom Menu

Article ID: Q117162

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Access version 2.0, a global menu bar should be displayed

unless a form or report that is open has its own custom menu bar. If an

open form or report has a custom menu bar, then the custom menu bar

should be displayed instead of the global menu bar. However, if you use

the sample macro on page 46 of the Microsoft Access version 2.0 "Building

Applications" manual to set an application's global menu bar, the global

menu bar will be displayed instead of the form or report's custom menu bar.

The sample macro on page 46 of the Microsoft Access version 2.0 "Building

Applications" manual that demonstrates how to set an application's global

menu bar lists the following actions:

   DoMenuItem

   OpenForm

   SetValue

The order of these actions is incorrect.

RESOLUTION

==========

Switch the OpenForm and SetValue actions, so that the order of the actions

is:

   DoMenuItem

   SetValue

   OpenForm

Changing the order of the macro actions will cause custom menu bars to be

displayed when appropriate instead of the global menu bar.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, pages 45-46

Additional reference words: 2.00 menubar docerr

KBCategory:

KBSubcategory: FmsOthr


PRB: GoToControl to Control with Focus in AfterUpdate Ignored

Article ID: Q90806

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When a control has the focus, and the GoToControl action is

executed with the same control name that has the focus, the focus

will move to the next control in the tab order. The focus will not

stay on the control that currently has the focus, as expected.

RESOLUTION

==========

To prevent the focus from leaving the field, you can use an OnExit

macro that performs the CancelEvent action. Or, if you want to

prevent the field from being saved (and also prevent the focus from

leaving the control), you can use a validation rule or a

BeforeUpdate macro.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. In NWIND.MDB, create the following macro:

      Condition                 Action           Control Name

      --------------------------------------------------------

      ([Category ID]="aaaa")    GoToControl      [Category ID]

2. Save the macro as Macro1.

3. Open the Categories form in Design view. Call the macro in the

   AfterUpdate property of the Category ID control.

4. View the Categories form in Browse mode.

5. Type "aaaa" into the Category ID field and press TAB.

   The focus moves to the next field in the tab order. However, if you

   had moved to another control before pressing TAB, the focus would

   not have changed.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: McrActn


PRB: GP Fault Using an Out of Date ODBC Driver

Article ID: Q94219

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access displays the following error message when

using an out of date ODBC.DLL driver:

   General Protection Fault (GPF) in ODBC.DLL

CAUSE

=====

When Microsoft Access initiates an ODBC connection, ODBC does not check

the version of the ODBC driver. The ODBC Setup program will only replace

an older version of the ODBC.DLL with a newer version if the file

resides in the \WINDOWS\SYSTEM subdirectory. If the file is found

elsewhere, ODBC Setup places a copy of ODBC.DLL in the \WINDOWS\SYSTEM

subdirectory. This can cause a problem if the directory that contains

the older .DLL is in the path, and is found first.

RESOLUTION

==========

Rename or delete the old ODBC.DLL and run the ODBC Setup program

from the Setup disks that come with Microsoft Access. This will

install a correct version of ODBC.DLL.

Additional reference words: 1.00 1.10 2.00 UAE unrecoverable application

error gpf

KBCategory:

KBSubcategory: IntpOthr


PRB: GPF with Diamond Viper VESA Local Bus Video Driver V1.01

Article ID: Q100172

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are using version 1.01 of the Diamond Viper VESA local bus

video driver for Microsoft Windows version 3.1, you receive a general

protection (GP) fault when you attempt to run Microsoft Access. The GP

fault occurs immediately after you try to open a database.

CAUSE

=====

This problem is caused by a fault in version 1.01 of the Diamond Viper

VESA local bus video driver for Windows 3.1.

RESOLUTION

==========

According to Diamond Computer Systems, later versions of the driver

correct this problem. To obtain this driver, call Diamond Computer

Systems Technical Support or download the latest VPRxxx.EXE file by modem

from the Diamond Computer Systems bulletin board service (BBS) at

(408) 730-1100.

The Diamond Viper VESA local bus video driver is manufactured by

Diamond Computer Systems, Inc., a vendor independent of Microsoft; we

make no warranty, implied or otherwise, regarding this product's

performance or reliability.

Additional reference words: 1.00 1.10 2.00 WinIss video driver GP fault GPF

KBCategory:

KBSubcategory: EvnOs


PRB: Graph Object Is Dimmed in Form View

Article ID: Q95913

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A Microsoft Graph object appears gray, or dimmed, in Form view.

CAUSE

=====

If the RowSource property for a Graph object is invalid, the graph will be

dimmed.

RESOLUTION

==========

To work around the problem, make the RowSource property valid.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new unbound form.

2. From the Edit menu, choose Insert Object. In the Object Type box,

   select Microsoft Graph, then choose OK.

3. Update the graph to Microsoft Access by closing Microsoft Graph and

   choosing Yes to update Microsoft Access.

4. Change the following properties of the object frame:

      Object: Object Frame

      --------------------

      Scaling: Scale

      RowSourceType: Value List

      RowSource: Title;AAA;H1;H2;H3;1;2;3

      ColumnCount: 3

5. From the View menu, choose Form. Note that the graph is gray.

The problem is that the RowSource property contains eight values and the

Column Count is 3. To correct the graph, add another value.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 13, "Using

Pictures, Graphs, and Other Objects," pages 327-330

Additional reference words: 1.00 1.10 2.00 grey checkpage

KBCategory:

KBSubcategory: IntpGrph


PRB: HelpContextID Property Accepts Valid Negative Values

Article ID: Q90808

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are creating a Help file using the Microsoft Windows Help

Compiler, the HelpContextID must be entered in the [Map] section of the

.HPJ file. Values in this section must be positive values in the range 0 to

4,294,967,295.

When you enter a HelpContextId property value in Microsoft Access, you can

enter values in the range -2,147,483,648 to 2,147,483,647.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

The acceptable value range for the HelpContextID property in Microsoft

Access is -2,147,483,648 to 2,147,483,647. Values outside of this range

generate the following error message:

   The value you entered isn't appropriate for this field.

The HelpContextID value is a number that Microsoft Access passes to the

Microsoft Windows application programming interface (API) WinHelp()

function, which takes an unsigned long value. Microsoft Access property

sheets do not recognize unsigned long values, so large numbers show up as

negative numbers instead.

The range of values 2,147,483,648 to 4,294,967,295 for unsigned long values

corresponds to the range -2,147,483,648 to -1 for signed long values. In

some cases, it may be more convenient to enter values in hexadecimal

notation, rather than converting the large unsigned values to their

negative signed equivalent. Microsoft Access will automatically convert

hexadecimal values to their signed long equivalent values.

The hexadecimal notation for the positive number range is &h0 to

&h7FFFFFFF, and the negative number range is &h80000000 to &hFFFFFFFF.

Steps to Reproduce Behavior

---------------------------

1. Create a new item on a form.

2. Open the property sheet.

3. Enter -2147483648 for the HelpContextID property. Microsoft Access will

   not generate an error message.

4. Change the HelpContextID to -2147483649. Microsoft Access will generate

   the following error message:

      The value you entered isn't appropriate for this field.

Additional reference words: 1.00 1.10 2.00 help

KBCategory:

KBSubcategory: FmsProp


PRB: Hewlett-Packard Dashboard GP Faults in Microsoft Access

Article ID: Q94111

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive a general protection (GP) fault error message when you use

Microsoft Access with the Hewlett-Packard Dashboard 1.0 for Windows.

RESOLUTION

==========

Hewlett-Packard has released version 2.0 of Dashboard for Windows.

Version 2.0 does not cause GP faults when used with Microsoft Access.

Hewlett-Packard has also released a patch for users of version 1.0 that

corrects the GP fault problem. The patch file is available as DB101U.EXE,

in the HPSYS forum on CompuServe.

MORE INFORMATION

================

To obtain the patch file, sign on to CompuServe and follow this procedure:

1. Type GO HPSYS at the ! prompt in CompuServe, and press ENTER. CompuServe

   will give you general information about the forum and ask you to join.

2. Press ENTER until you reach the Forum! prompt.

3. Type LIB, and press ENTER. When CompuServe prompts you for a library

   number, type 11, and press ENTER.

4. Type DOWN DB101U.EXE, and press ENTER. CompuServe will ask you for a

   local file name. Enter DB101U.EXE along with the path indicating where

   you want to store the file, and press ENTER. For example, you might

   enter this:.

      C:\WINDOWS\DB101U.EXE

   At this point, CompuServe will begin to download the file.

5. When the download process is complete, you are ready to run the patch.

   When you run it, it will expand into more than one file, so create a

   subdirectory and copy DB101U.EXE into it. Then change to that

   subdirectory and enter DB101U at the MS-DOS command prompt.

   DB101U.EXE will automatically extract and expand the patch and a

   Readme file. Hewlett-Packard Company recommends that you follow the

   instructions in that Readme file.

Dashboard for Windows is a trademark of, and manufactured by Hewlett-

Packard Company, a vendor independent of Microsoft.  Microsoft makes no

warranty, implied or otherwise, regarding this product's performance or

reliability.

Additional reference words: 1.00 1.10 2.00 WinIss 3rdparty gp fault gpf

KBCategory:

KBSubcategory: EvnGpf


PRB: Hourglass May Not Change After Illegal Function Call

Article ID: Q93723

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A user can change the mouse pointer from an arrow to an hourglass

cursor with a user-defined function in Access Basic. If the user

encounters an illegal function, or halts the code after setting the

pointer to an hourglass, the hourglass cursor does not change back

to the arrow pointer. However, you can still open and close items

by clicking them.

RESOLUTION

==========

You can type "DoCmd Hourglass False" (without quotation marks) in the

Immediate window to get the pointer back while in design of the module.

STATUS

======

This behavior is by design. Access Basic will never reset Echo,

Warnings, or Hourglass when run from Access Basic. These are only

reset when the last script runs.

MORE INFORMATION

================

Because an illegal function call stopped the execution of the

function before the command to reset the mouse pointer from an

hourglass to an arrow, the mouse pointer remains in the hourglass

state.

Additional reference words: 1.00 1.10 2.00 mousepointer checkpage

KBCategory:

KBSubcategory: PgmOthr


PRB: How the Scaling Property Affects Embedded MS Draw Object

Article ID: Q101371

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you have an embedded Microsoft Draw object that includes both

text and graphical elements, the text and graphical elements grow and

shrink in different degrees.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

If the Scaling property is set to Scale when you adjust the size of an

embedded object's frame, the object grows or shrinks to fit the size of the

frame. This setting allows graphical elements, such as rectangles and

ovals, to become distorted. Fonts do not become distorted when you resize

their width, but will be distored if you resize their height to greater

than 1 inch.

Steps to Reproduce Behavior

---------------------------

1. Create a new unbound form.

2. Create an unbound object frame using the Object Frame tool, which

   is located directly beneath the Graph tool in the toolbox.

3. Select Microsoft Drawing as the Object Type.

4. Select the Text Object tool in Microsoft Draw, and type some text.

5. Select the Rectangle tool in Microsoft Draw and draw a rectangle

   around the text. From the Edit menu, choose Send To Back.

6. From the File menu, choose Exit And Return To Microsoft Access.

   When the dialog box asks you to update Microsoft Access, choose Yes.

7. Change the Scaling property of this Object Frame control to Scale.

8. Stretch the right side of the object to the right a few inches.

Note that the box stretches. The text stretches, but not to the extent that

it becomes disproportionate.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 13, "Using Pictures,

Graphs, and Other Objects," page 320

Additional reference words: 1.00 1.10 2.00 Object Frame

KBCategory:

KBSubcategory: IntpOle


PRB: Imported MS Excel Carriage Returns Become Vertical Bars

Article ID: Q115576

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

 - Microsoft Excel versions 2.x, 3.x, 4.x, and 5.0

---------------------------------------------------------------------

SYMPTOMS

========

When you import a Microsoft Excel spreadsheet into Microsoft Access,

carriage return (CR) characters appear as small vertical bars.

For example, when you import a Microsoft Excel spreadsheet mailing list

with complete addresses stored in single cells formatted with carriage

returns, the addresses appear in Microsoft Access as single lines with

small vertical bars between the address items.

CAUSE

=====

The CR character used in Microsoft Excel (ALT+ENTER) differs from that used

in Microsoft Access (CTRL+ENTER). As a result, the CR characters in

Microsoft Excel spreadsheets are not parsed into carriage returns in

Microsoft Access, but into small vertical bars.

RESOLUTION

==========

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Building Applications" manual.

You can use the following sample user-defined Access Basic function to

convert the CR character used in Microsoft Excel to the CR character

used in Microsoft Access.

1. Start Microsoft Access and open any database.

2. Enter the following user-defined function in a module.

   NOTE: In the following sample code, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this code in Access Basic.

      Function ChangeStr (s As Variant, a As String, n As String,_

       c As Integer) As Variant

         ' This function changes all substrings "a" and string "s"

         ' to "n." The parameter "c" has the same function as in the

         ' InStr() function.

         Dim temp As String, pos As Integer

         temp = ""

         If IsNull(s) Then

          ChangeStr = Null

          Exit Function

         End If

         If a = "" Or s = "" Then

          ChangeStr = s

          Exit Function

         End If

         pos = InStr(1, s, a, c)

         While pos > 0

          temp = temp & Mid$(s, 1, pos - 1) & n

          s = Right$(s, Len(s) - pos - Len(a) + 1)

          pos = InStr(1, s, a, c)

         Wend

         ChangeStr = temp & s

      End Function

3. Create a new update query. Drag the field that you want converted to

   the query grid.

4. In the Update To row of the query grid, enter the following expression:

      ChangeStr([<fieldname>],Chr$(10),Chr$(13) & Chr$(10),0)

   Substitute the name of the field that you want converted for

   <fieldname> in the expression above.

5. Run the query. Text that contains small vertical bars will be

   separated into separate lines with carriage returns.

STATUS

======

This behavior is by design. Changes to this behavior are being reviewed and

will be considered for inclusion in a future release of Microsoft Access.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. In Microsoft Excel, create a spreadsheet with the following data:

      Fred Test

      111 Main

      Anytown, USA

      Joe Test

      222 Broadway

      Anytown, USA

2. Save the spreadsheet.

3. Start Microsoft Access and open any database.

4. From the File menu, choose Import.

5. In the Data Source box, select either Microsoft Excel 2.0-4.0 or

   Microsoft Excel 5.0, depending on the version of Microsoft Excel you

   are using, and then choose OK.

6. In the File Name box, select the spreadsheet you saved in step 2,

   and then choose the Import button.

7. In the Table Options group, select the Create New Table option button,

   then choose OK.

8. When you get a message stating that two records were imported

   successfully, choose OK. Choose Close.

9. Open the new table in Datasheet view. Note the small vertical bars

   between the data elements in the table.

REFERENCES

==========

For more information about importing, search for "Import" then "Import

Command (File Menu)" using the Microsoft Access Help menu.

Additional reference words: 2.00 pipes lf

KBCategory:

KBSubcategory: IsmExl5


PRB: Incorrect Catalog Stored Procedures Error Message

Article ID: Q96013

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The following error message may be displayed when you attempt to

attach a SQL table in Microsoft Access:

   [Microsoft][ODBC SQL Server Driver] The ODBC catalog stored

   procedures installed on your server <servername> are version

   xx.xxxx; version xx.xx.xxxx is required to ensure proper

   operation. Please contact your system administrator.

CAUSE

=====

To perform its functions, Microsoft Access requires certain

information from a back-end database. This information is provided by

a series of catalog stored procedures that reside on the back-end

database. You need to use the correct version of the catalog

procedures for the version of Microsoft Access and SQL Server that you

are running.

This error indicates that you have an incorrect version of the catalog

stored procedures installed.

RESOLUTION

==========

Reinstall the stored procedure file. Refer to the following paragraphs

to determine which script file to use with your version of Microsoft

Access and SQL Server.

Microsoft Access Version 1.0

----------------------------

If you run Microsoft Access version 1.0 with Microsoft or Sybase SQL

Server, use the correct script file from the table below:

   SQL Server             Catalog Stored Procedure

   And Version            Script File Requirements

   ------------------------------------------------------------------

   Microsoft SQL Server   Use the INSTCAT.SQL file from the Microsoft

   versions 1.x and 4.2   Access ODBC disk.

   Microsoft SQL Server   INSTCAT.SQL is not required, but some

   version 4.2a           Microsoft Access problems are resolved with

                          it that are not in the Microsoft SQL Server

                          4.2a stored procedures.

   Sybase SQL Server      Use the INSTCAT.SQL file from the Microsoft

   versions before 4.8    Access ODBC disk.

   Sybase SQL Server      Use the INSTCAT.48 file from the MSACCESS

   versions 4.8-4.9x      forum on CompuServe. Go to the ODBC/SQL

                          Server library, and download the SYBASE.ZIP

                          file.

Microsoft Access Versions 1.1 and 2.0

-------------------------------------

In Microsoft Access version 1.1, both the Sybase and Microsoft SQL

servers use the same INSTCAT.SQL file.

To install the catalog stored procedures, use the SQL Server ISQL

(Interactive SQL) tool. You can run the ISQL tool from the MS-DOS or

OS/2 command prompt.

IMPORTANT: Do not use the SAF utility provided with Microsoft SQL

Server. Microsoft SAF for MS-DOS and OS/2 is limited to 511 lines of

code in an SQL script.

The syntax to install INSTCAT.SQL using ISQL is:

   isql /U <sa loginname> /n /P <password> /S <SQL servername>

   /i <drive:\path\INSTCAT.SQL> /o <drive:\path\outputfilename>

NOTE: Enter the preceding two lines as one line at the command

prompt, and do not include the angle brackets < >.

The following are the command line parameters for the ISQL command:

   /U   Login name for the system administrator.

   /n   Eliminates line numbering and prompting for user input.

   /P   Password (case sensitive) used for the system administrator.

   /S   Name of the driver to set up.

   /i   Provides the drive and fully qualified path for INSTCAT.SQL.

   /o   Provides ISQL with an output file destination for results,

        including errors.

Example

-------

   isql /U sa /n /P skier /S DUMMY_SERVER /i D:\SQL\INSTCAT.SQL /o

   D:\SQL\OUTPUT.TXT

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: Input Mask Character (!) Does Not Work Correctly

Article ID: Q114880

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The exclamation point character (!) in an input mask does not cause the

input mask to fill from right to left as you expect. Instead, it fills from

left to right.

For example, the input mask

   !\(999") "000\-0000

fills characters from left to right, instead of from right to left.

CAUSE

=====

This behavior is caused by a design limitation in the way input mask

characters are validated.

STATUS

======

This behavior is by design. Changes to input mask character validation are

being reviewed, and will be considered for possible inclusion in a future

release of Microsoft Access.

MORE INFORMATION

================

You can work around this behavior to some extent by combining a more

generic input mask and a validation rule. For example, using the sample

input mask listed in the "Symptoms" section of this article, you have to

use the mouse or the keyboard to bypass the area code if you want to enter

a 7-digit phone number. If you use the following sample input mask and

validation rule instead, you can type digits anywhere in the mask, even

though the digits still fill from left to right:

   Input Mask:      !\(999") "999\-9999

   Validation Rule: Like "#######" Or Like "##########"

   Validation Text: You must enter a 7- or 10-digit phone number

NOTE: The input mask does not contain any required digits. The required

digits are handled by the validation rule.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 8 "Changing and

Customizing Tables," pages 140-141

Additional reference words: 2.00 validating masking

KBCategory:

KBSubcategory: GnlValid


PRB: Insert Object Dirties Record

Article ID: Q92675

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Placing the insertion point in a field with the data type OLE Object,

choosing Insert Object from the Edit menu, and then clicking the cancel

button in the Insert Object dialog box will "dirty" a record. A dirty

record is one that has been edited.

If the field is part of an existing record, the previous contents of

the field are not deleted or modified, but the record is rewritten

when you leave it.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps To Reproduce Behavior

---------------------------

1. Open a table that includes an OLE object field.

2. Place the insertion point in the OLE object field.

3. Select Insert Object from the Edit menu, then choose Cancel.

4. The record selector now indicates that the record is dirty by

   displaying the pencil indicator.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOle


PRB: Invalid Path Error Message Using UNC with 10+ Characters

Article ID: Q105514

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you attempt to use a universal naming convention (UNC) path in

Microsoft Access in which the server name is longer than 10 characters

or contains spaces, you get the following error message

   \\<servername>\<sharename> isn't a valid path

even though valid UNC server names can be up to 15 characters and can

contain spaces.

For example, the path

   SystemDB=\\s234567890\ANYSHARE\SYSTEM.MDA

works correctly, but the following UNC paths cause the above error

message to appear:

   SystemDB=\\s2345678901\ANYSHARE\SYSTEM.MDA

   SystemDB=\\s2345 7890\ANYSHARE\SYSTEM.MDA

CAUSE

=====

This problem is not caused directly by Microsoft Access, but rather by an

external host, such as Microsoft Windows for Workgroups, or by a network

problem. Microsoft Access does not parse UNC paths; it hands them off to

external processes.

RESOLUTION

==========

One way to work around this problem is to connect the server to a

logical drive before using Microsoft Access and then reference the

logical drive instead of the server.

For example, you want to use a server named \\MY SERVER\MYSHARE,

and you are using Microsoft LAN Manager. To reference this server,

type:

   NET USE F: \\MY SERVER\MYSHARE

In your MSACCESS.INI file, reference it as follows:

   SystemDB=F:\SYSTEM.MDA

Additional reference words: 1.00 1.10 2.00 WinIss attaching

KBCategory:

KBSubcategory: EvnOs


PRB: Invalid Reference to Field '<Value>' Using SetValue

Article ID: Q96580

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If the Expression argument of a SetValue macro action evaluates to a text

expression beginning with a letter, you may receive the following alert

message when a SetValue macro action attempts to set the value of a

control:

   !  Invalid reference to field '<value>'

CAUSE

=====

An Expression argument of a SetValue macro action that begins with a

leading equal sign (=) is understood to be a field name.

RESOLUTION

==========

Remove the leading equal sign in the Expression argument.

Steps to Reproduce Behavior

---------------------------

1. Create a macro named My Macro with one action as follows:

      Macro Name         Action

      -------------------------

      My Macro           SetValue

      My Macro Actions

      ----------------

      SetValue

         Item: Field0

         Expression: ="A023bbb"

2. Create a new unbound blank form.

3. Place a command button on the form by dragging the macro named My

   Macro from the Database window onto the form.

4. Create a text box on the form. Verify that the ControlName is

   Field0.

5. Switch to Form view.

6. Click the command button to run the macro.

   You will receive the following error message:

      Invalid reference to field 'A023bbb'

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 538-539

Additional reference words: 1.00 1.10 2.00 setvalue errmsg checkpage error

KBCategory:

KBSubcategory: McrArg


PRB: Invalid Use of Null Alert Assigning Null Control

Article ID: Q90802

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Default field values are set to Null. If you use the Eval()

function on a field without a value you will get the following

error message:

   Invalid Use of Null Alert

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a form (Form1) with a text box (Field0).

2. Switch to Form view.

3. Open a module.

4. Type the following line in the Immediate window:

      stForm$ = Eval("Forms!Form1!Field0").

   Results: Invalid Use of Null Alert.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


PRB: Irregular Characters in Attached dBASE IV Memo Field

Article ID: Q88647

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you have an attached dBASE IV table with a memo field, a strange

character resembling an "i" (ASCII 161) appears randomly throughout

the memo field when viewed in Microsoft Access.

CAUSE

=====

This problem is the result of the way dBASE IV handles its memo

fields and how this translates when you view the memo field in

Microsoft Access.

When you open a memo field in dBASE IV, you are presented with an

editor that is fixed at 65 characters per line and cannot be adjusted.

In order to format your memo data so that it fits comfortably in the

memo editor, dBASE IV inserts invisible characters that act as

carriage returns. These characters become an actual part of the data

in the .DBF file. Microsoft Access does not use these characters to

format the memo data because the size of a memo control is adjustable,

so they are ignored and consequently appear in the memo control on your

form.

RESOLUTION

==========

You can create an Access Basic procedure to remove these characters from

the memo field. The procedure should go through each record in the table

and copy the memo field, character by character, to a temporary holding

area, ignoring all instances of Chr(161). Then copy the corrected string

back into the memo field.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

dBASE IV is manufactured by a vendor independent of Microsoft; we make no

warranty, implied or otherwise, regarding this product's performance or

reliability.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmXbase


PRB: Join Is Broken by Value(s) in Fields '[Field Name]'

Article ID: Q96587

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you add or edit records in a form or query datasheet and you

attempt to commit the record by moving from the current record or by

closing the dynaset, the following error message is displayed:

   Join is broken by value(s) in fields '<field name>' (in Microsoft

   Access version 1.x)

   -or-

   There is no record in table '<table name>' with key matching field(s)

   '<field name>' (in Microsoft Access version 2.0)

In the sample messages above, <field name> identifies the foreign key and

<table> identifies the one-side table.

CAUSE

=====

You tried to enter or edit data through a query based on more than one

table. In a one-to-many relationship, you entered or edited data on

the "many" side, and a corresponding match based on the join field

does not exist on the "one" side.

STATUS

======

This behavior is by design.

RESOLUTION

==========

When you add or edit records in a query, if the relationship between

two tables is a one-to-many relationship, only enter values in the

linking field in the "many" table that have matches in the linking

field in the "one" table.

MORE INFORMATION

================

Microsoft Access knows that a given relationship is a one-to-many

relationship if the field on which the tables are linked or joined is

a primary key (or Indexed - No Duplicates) in one of the tables, but

not in the other table. (The linking field in the "many" table is also

known as the "foreign key.") If a field is updated on the "many" side

of a relationship and does not have a match on the "one" side of the

relationship, an "orphan" would be produced.

Steps to Reproduce Behavior

---------------------------

Follow these steps in the sample database NWIND.MDB:

1. Open the query named Order Information.

2. From the Records menu, choose GoTo, and then select New.

3. Input a new Order ID and Customer ID. Enter a value in the Customer

   ID field that does not exist in the Customers table.

4. Press DOWN ARROW to move to a new record. The following error message is

   displayed:

      Join is broken by value(s) in fields 'Customer ID'

REFERENCES

==========

Microsoft Access "User's Guide," versions 1.0 and 1.1, Chapter 3, "Setting

Relationships Between Tables"

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryJoin


PRB: Launching MS Access 2.0 Help Returns Error Message

Article ID: Q115575

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to launch the Microsoft Access version 2.0 Help file,

MSACC20.HLP, you receive the error message:

   Cannot Find MSACC20.HLP - Add/Install Help

CAUSE

=====

There is an invalid reference to the MSACC20.HLP file in the WINHELP.INI

file in your Windows directory.

RESOLUTION

==========

1. Make a backup copy of the WINHELP.INI file by copying the file

   to another name (such as WINHELP.BAK).

2. Open the WINHELP.INI file in any text editor (such as Windows Notepad)

   and remove any line that references the MSACC20.HLP file.

3. Save and then close the WINHELP.INI file.

4. Verify that the MSACC20.HLP file is in your Access directory.

Additional reference words: 2.00 errmsg

KBCategory:

KBSubcategory: DcmOthr


PRB: List Box Column Property Gets Incorrect Row Information

Article ID: Q109827

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you select a row from a multicolumn list box or combo box, controls

that reference the Column property of the list box or combo box retrieve

data from a different row in the list box or combo box.

CAUSE

=====

The list or combo box's BoundColumn property does not point to a field

with unique values.

RESOLUTION

==========

The list or combo box's BoundColumn property must point to a field that

contains unique values. If the BoundColumn property does not point to a

field with unique values, Microsoft Access will return information for

the first row with a matching BoundColumn value when you select a row in

the list box or combo box.

For example, the Type field in the sample table below does not contain

unique values. If the Type field is used for the BoundColumn property, a

text box referencing the second column will return Apple rather than

Grape when you select the third row.

   Type    Description

   -------------------

   Fruit   Apple

   Fruit   Orange

   Fruit   Grape

If you use the Description column for the BoundColumn property, the

problem will not occur, since the Description column contains unique

vaues.

Another way to resolve this problem would be to add a counter field to

the underlying table, and then use the counter field for the BoundColumn

property.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create the following table:

      Table: Table1

      --------------------------

      FieldName: Manufacturer

         DataType: Text

      FieldName: Stock Number

         DataType: Number

         FieldSize: Long Integer

         Indexed: Yes

      FieldName: Description

         DateType: Text

      Table Properties: Table1

      ------------------------

      PrimaryKey: Stock Number

2. View the table in Datasheet view. Add the following data to the

   table:

      Manufacturer   Stock Number   Description

      -----------------------------------------

      IB Co          1              Mouse

      IB Co          2              Printer

      IB Co          3              Hard Drive

      ComCo          4              PC

3. Create the following new, unbound form:

      Form: Test1

         ControlSource: <leave empty>

      List box: Manufacturer

         RowSourceType: Table/Query

         RowSource: Table1

         ColumnCount: 3

         BoundColumn: 1

         Width: 3

      Text box: Stock Number

         ControlSource: =[Manufacturer].Column(1)

      Text box: Description

         ControlSource: =[Manufacturer].Column(2)

4. View the form in Form view.

5. Select the first row in the list box. Note that the Stock Number

   and Description boxes correctly display "1" and "Mouse."

6. Select the third row in the list box. Note that the Stock Number and

   Description boxes still display the information from the first row.

7. Select the fourth row in the list box. The Stock Number and

   Description boxes will display the correct information for the

   fourth row.

If you change the BoundColumn property of the Manufacturer list box to 2

instead of 1, the text boxes on the form will display the correct

information for all the rows in the list box, since the second column

contains unique values.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 9, "Designing

Forms," pages 233-245

Microsoft Access "User's Guide," version 1.1, Chapter 9, "Designing

Forms," pages 237-249

Microsoft Access "User's Guide," version 2.0, Chapter 15, "Designing

Forms," pages 341-376

Additional reference words: 1.00 1.10 2.00 duplicate

KBCategory:

KBSubcategory: FmsCmbo


PRB: List Box Not Dimmed When Disabled

Article ID: Q90117

UifOthr


PRB: Locking First Record Also Locks Last Record

Article ID: Q109347

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you set the Default Record Locking option to Edited Record in the

Multiuser category of the Options dialog box, editing the first record may

lock both the first and the last record in the table.

CAUSE

=====

Some data from the first record may be stored in the last data page in

the table. The entire data page is locked, which locks both the first

and the last record.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access on two different computers and open the

   sample database NWIND.MDB.

2. On both computers, choose Options from the View menu.

3. On both computers, select Multiuser from the Category box.

4. On both computers, select Edited Record in the Default Record Locking

   box.

5. On one of the computers, open the Customers table. Edit the first record

   by adding enough characters to each field so that each field is the

   maximum allowed length. This will force Microsoft Access to store the

   data on the last data page.

6. On the other computer, open the Customers table, move to the last

   record, and try to edit the record.

Note that compacting your database periodically will keep the data in order

on the data pages, which should help prevent this problem from occurring.

Note also that if all the records in a table are locked when you choose the

Edited Record option it means that all the records fit on one data page,

and therefore if any record is locked, then all the records are locked.

REFERENCES

==========

For more information on record locking, query on the following words here

in the Microsoft Knowledge Base:

   record and locking

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: GnlMu


PRB: Macro Condition Evaluates True if Control Is Null

Article ID: Q96577

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A macro that conditionally checks the contents of a control on a

form always evaluates as True if the control is null.

RESOLUTION

==========

Include a StopMacro macro action with a condition to test the

control for null. If the control is null, the macro will stop. If

it is not null, the second macro action will occur. This will be

the action you want to occur if your condition is met.

MORE INFORMATION

================

If you do not test for the null condition, the macro will evaluate to

True.

Steps to Reproduce Behavior

---------------------------

1. Create a new unbound form named Form1.

2. Add a text box control to the form named Field0.

3. Create and save a new macro named Test.

      Macro Name    Condition           Action

      ----------------------------------------

      Test          [Field0] = "yes"    MsgBox

      MsgBox Arguments

      ----------------------------------------

      Message: The Answer is YES!

      Beep:  Yes

4. Switch back to Design view of Form1 and place a command button on

   the form. Set the OnPush property to the Test macro.

5. Switch to Form view and run the macro by choosing the command

   button. Note that Field0 is null. (The Msgbox should appear).

6. Type the word "NO" into Field0 and rerun the macro (no Msgbox will

   appear).

7. Type the word "YES" into the field and run the macro (Msgbox should

   appear).

   To correct this situation, change the Test macro so it includes the

   StopMacro action before the MsgBox action:

      Macro Name    Condition           Action

      ----------------------------------------

      Test          [Field0] Is null    StopMacro

                    [Field0] = "yes"    MsgBox

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: McrCond


PRB: Macro on Subform Control Executed by Main Form

Article ID: Q100150

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If a macro is attached to the OnEnter or OnExit property of the first

control in the tab order of a subform, the macro will run each time

you move from one record to another in the main form.

In addition, a macro attached to the OnEnter property of the first

control in the tab order of the subform will run when the main form is

opened, and a macro attached to the OnExit property of the first

control in the tab order of the subform will run when the main form is

closed.

CAUSE

=====

To cause a macro to run only when you are actually moving in and out

of the subform, a test condition with a flag can be used. A macro can

set a flag on the main form to indicate whether the subform was

entered by moving into the subform from the main form. The macro

attached to the subform's OnEnter and OnExit properties can check this

flag to see if you really did move into the subform and continue

running if appropriate. The following steps demonstrate how to set up

and test for this condition.

RESOLUTION

==========

1. Create the following macro called Subform Flag:

      Macro Name     Action

      -----------------------

      Set            SetValue

      UnSet          SetValue

      Subform Flag Actions

      -----------------------

      SetValue

         Item: [Subform Flag]

         Expression: True

      SetValue

         Item: [Subform Flag]

         Expression: False

2. For a form named MyForm, create an unbound text box on the main

   form with the following properties:

      Form: MyForm

      Text Box: Subform Flag

         Name: Subform Flag (in version 1.x, ControlName: Subform Flag)

         Visible: No

         Default Value: False

3. Select the subform control on the main form and change the

   following properties:

      Form: MyForm Subform:

         On Enter: Subform Flag.Set

         On Exit: Subform Flag.UnSet

4. Add the following macro action to the top of the macro that is

   attached to the OnEnter or OnExit property of the first control in

   the tab order of the subform. The macro will not perform any other

   actions if the subform flag is not set.

      Condition                       Action

      -----------------------------------------

      Parent![Subform Flag] = False   StopMacro

The macro attached to the OnEnter property of the first control

in the subform will not run if you enter the control from the main

form and the control is in the selected record on the subform (denoted

by a triangle in the record selector). As a result, the macro will not

run when you enter the subform by pressing TAB, or by clicking the

first control in the selected record on the subform. However, the

macro will run if you click this control on a different record in the

subform.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB and create the following macro called

   Test:

      MacroName     Action

      --------------------

      Test          MsgBox

      Test1 Actions

      --------------------

      MsgBox

         Message: Testing!

2. Open the "Orders Subform" and change the OnEnter and OnExit

   properties of the Property ID box to Test.

      Form: Orders Subform

         OnEnter: Test

         OnExit: Test

3. Save the "Orders Subform," open the Orders form, and move among the

   records. The message "Testing!" will appear twice for each record.

REFERENCES

==========

Microsoft Access "User's Guide," versions 1.0 and 1.1, Chapter 22, "Using

Macros with Forms"

Microsoft Access "User's Guide," version 2.0, Chapter 25, "Using Macros

with Forms"

Additional reference words: 1.00 1.10 2.00 Exit Enter

KBCategory:

KBSubcategory: FmsEvnt


PRB: Macro with Two SendKeys Actions Loops Infinitely

Article ID: Q103251

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run a macro that includes two SendKeys actions, the macro

enters an infinite loop and you must restart your computer to regain

control.

CAUSE

=====

When only one SendKeys action is used in a macro, the macro can be

stopped by pressing CTRL+BREAK and then choosing Halt. However, using

a second SendKeys action toggles the default, or non-Single Step,

macro mode so that the macro cannot be terminated without restarting

your computer.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

CAUTION: Save all work on your computer before you set up the example

below. You will have to restart your computer after you run the sample

macro.

1. Create a macro as follows:

      Macro Name       Action

      -------------------------

      Go Loop          SendKeys

                       SendKeys

      Go Loop Actions

      ------------------

      SendKeys

         Keystrokes: " "

         Wait: No

      SendKeys

         Keystrokes: " "

         Wait: No

2. Open a new form and place a command button on it.

3. Add the Go Loop macro to the command button's OnPush property.

4. Change to Form view, and then select the command button.

REFERENCES

==========

For more information on the SendKeys action, search for "SendKeys" using

the Help menu.

Additional reference words: 1.00 1.10 2.00 reboot hang

KBCategory:

KBSubcategory: McrActn


PRB: Make-Table Query Causes Existing Table to Be Deleted

Article ID: Q90112

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Running a make-table query that creates a table with the same name

as the table the query is based on deletes the table that the query

is based on.

CAUSE

=====

Microsoft Access deletes a table before creating a new table with

the same name.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Save an existing table as Author.

2. Create a make-table query based on Author and type "Author"

   (without the quotation marks) for the name of the table to be

   created.

3. Run the make-table query. A dialog box with the following warning

   appears:

      Existing Table 'Author' will be deleted before running the

      query. Continue anyway?

   If you choose the Yes button, a dialog box with the following error

   message will appear:

      Couldn't find input table or query 'Author'

   At this point, the table Author will no longer exist and the

   query will fail. You will not be able to retrieve the table, even

   by choosing the Undo command from the Edit menu.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 7, "Designing

Action Queries and Parameter Queries," page 164

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: QryMktbl


PRB: Make-Table Query Does Not Copy Field Descriptions

Article ID: Q104487

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A table created with a make-table query will not contain any field

descriptions from the table on which the query is based.

RESOLUTION

==========

If you want to create a new table that contains the field descriptions from

another table, you can use the Copy and Paste commands to create the new

table. The following steps demonstrate this method:

1. In the Tables list, select the table you want to copy.

2. From the Edit menu, choose Copy.

3. From the Edit menu, choose Paste.

4. Enter a name for the new table. Select either Structures Only or

   Structures And Data in the Paste Options box.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB. Create a new query based on the

   Categories table:

      Query: Copy Category Table

      --------------------------

      Type:     MakeTable

      Field:    Category ID

      Field:    Category Name

      Field:    Description

      Field:    Picture

      Type "Categories (MkTbl)" (without the quotation marks) as the new

      table name.

2. Run the query.

3. Open the Categories table in Design view and note the field

   descriptions. Then open the Categories (MkTbl) table in Design view and

   note that the field descriptions are absent.

Additional reference words: 1.00 1.10 2.00 maketable

KBCategory:

KBSubcategory: QryMktbl


PRB: Margins Do Not Relate to Printable Area

Article ID: Q90095

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you print or preview a report with the margins set to fall outside the

printable area defined by your printer driver, the information in the

report falling outside of the printable area will not be printed correctly.

Depending on the printer and driver being used, the output may be

truncated, shifted so it falls within the printable area, or flow onto

another page. Also, output from the second page to the end of the report

may vary from that of the first page. For example, the printer may shift

the output on those pages so the top and left sides of the report

correspond to the top and left sides of the printable area.

CAUSE

=====

Microsoft Access sets margins based on the page size selected, not on the

printable area of that page. Therefore, if you set your margins to have

output go beyond the printable area, the information that would be placed

in that area will not print correctly.

RESOLUTION

==========

Preview any output from Microsoft Access to make sure that no information

is truncated. If information is truncated, increase the margins by choosing

the Setup button and changing the margin settings.

For example, if your top margin is set to 0 and the information at the top

of the pages appears to be truncated, increase the top margin (for example,

to 0.5) and preview the information again. Continue increasing the margins

until the information is no longer truncated.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0, 1.1, and 2.0. We are researching this problem and will post new

information here in the Microsoft Knowledge Base as it becomes available.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptLayou


PRB: Minimizing Pop-Up and Modal Form Loses Application Focus

Article ID: Q103988

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you run the Minimize macro action on a form that has both the PopUp and

Modal properties set to Yes, the Microsoft Access window will cease to be

the active window, and the next application on the Microsoft Windows

desktop will become active instead.

CAUSE

=====

When a pop-up form is minimized, Windows tries to activate another pop-up

form in the active window. Since the form is also modal, the Microsoft

Access main window is disabled and cannot be activated. Windows then makes

the next available application's window active.

RESOLUTION

==========

Change the Modal property of the form to No. When the form is minimized,

the Microsoft Access window will be activated.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Open the Forms Switchboard form in Design view.

3. Change the form's Modal property to Yes.

4. Change the form's PopUp property to Yes.

5. Save and close the form.

6. Open the Forms Switchboard Buttons macro in Design view.

7. Add the Minimize macro action as the second command in the Categories

   macro name, after the OpenForm action.

8. Open the Forms Switchboard form, and click the Categories button.

The Categories form will be minimized and the next application on the

desktop will become the active window.

Additional reference words: 1.00 1.10 2.00 min

KBCategory:

KBSubcategory: FmsProp


PRB: Network Problems May Cause "Segment Load Failure" Error

Article ID: Q109730

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive a "Segment Load Failure" error message or another memory-

conflict error message.

CAUSE

=====

This type of error can occur if Microsoft Access is running on a network or

is accessing data on a network, and the network server stops functioning

correctly.

A segment load failure implies that there was a problem moving information

from secondary storage, such as a network server disk, to main memory. If a

network server is no longer functioning correctly, expected information may

no longer be available to Microsoft Access.

RESOLUTION

==========

The following suggestions may help you to diagnose the problem:

 - Make a backup of all critical data and run disk diagnostic software,

   such as the MS-DOS CHKDSK command, to check the integrity of the

   workstation and server disk drives.

 - If the workstation has a complete Microsoft Access installation, quit

   and then restart Microsoft Access on the workstation and see if it

   operates correctly without using the network for any services. If the

   problem continues with Microsoft Access operating in isolation, begin

   checking the workstation for memory conflicts.

 - If the database is being accessed off a network server, consider

   copying it to the local workstation to isolate whether the problem

   is workstation or server specific.

 - If the server is required, just start the server and the Microsoft

   Access workstation to test Microsoft Access. If the problem does not

   occur at this point, you can start and diagnose other workstations one

   by one.

REFERENCES

==========

For more information on how to diagnose segment load failures, query on the

following words here in the Microsoft Knowledge Base:

   segment and load and failure and troubleshoot

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IntpOthr


PRB: No AutoRepeat with GoToRecord/Next and DoMenuItem

Article ID: Q95645

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The AutoRepeat property for command buttons does not work in

conjunction with the GoToRecord/Next macro action for moving to

successive records on a form. In other words, if your form uses

command buttons instead of the record selector buttons to move

from record to record, the AutoRepeat property does not repeatedly

execute a macro that performs a GoToRecord/Next action.

Also, the AutoRepeat property fails under the same circumstances

when using the DoMenuItem/Form/Records/GoTo/Next macro action. To

re-execute the macro, you must click the command button again.

CAUSE

=====

This is correct behavior for these macro actions. Here are two

points that need clarification before the cause can be explained:

1. OnPush property: The macro under the OnPush property of a

   command button normally will not execute until you push and let up

   the command button with the mouse pointer in the Command

   Button's region. The exception is when the command button's

   AutoRepeat property is set to Yes. In this case, the macro under

   the OnPush property of the command button executes when the

   button is pushed and the mouse pointer is in the Command

   Button's region.

2. Focus: Several macro actions change the focus. For example,

   GoToControl, GoToRecord, OpenForm, OpenTable, and ApplyFilter all

   change the focus.

Therefore, if a command button's OnPush property macro changes

the focus to, for example, the next record, then the command

button has lost the focus. That is, when you click the command

button, the click does not apply to that command button anymore

because the focus changed. It's as if you had moved the mouse

pointer off the command button while pressing the mouse button,

as if the command button moved out from under the mouse pointer

right before you pressed the mouse button.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Start Microsoft Access.

 2. Open the sample NWIND.MDB database.

 3. Create a new macro with two actions (OpenTable and GoToRecord). Use

    the following as a guide to assign action arguments to each action:

       OpenTable

       ------------------------

       Table Name:   Categories

       View:         Datasheet

       Data Mode:    Edit

       GoToRecord

       ------------------------

       Object Type:  Table

       Object Name:  Categories

       Record:       Next

 4. Close, save, and name the macro.

 5. Open a new form and click the Blank Form button.

 6. Drag the macro you just created onto the blank form to create a

    command button.

 7. Set the AutoRepeat property of the command button to Yes. Notice

    the command button's OnPush property is set to the name of the

    macro.

 8. Change to Form view to browse the form. As a result, you should see

    a single command button on the form.

 9. Click the command button. Now you should see the Categories table.

10. Size the Categories table so that both the form and the table fit on

    the screen and you can see the VCR button on the table.

Each time you click the command button, the record selector moves to

the next record. When you click and hold down the command button, you

would expect Microsoft Access to scroll rapidly to the last record in

the table, but this does not happen. Instead, the record selector moves

to the next record only, regardless of the AutoRepeat property setting

of the command button.

However, if you place a macro that uses a different macro action such as

Beep on the form, the AutoRepeat action works as expected. This is because

Beep does not change the focus.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: McrActn


PRB: No Implicit Parameters on Crosstab Queries

Article ID: Q91710

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you create a crosstab query using an implicit parameter [XXX] in a

WHERE clause (criteria), Microsoft Access returns the following error

when you run the query:

   Can't bind name '[XXX]'

If you use an explicit parameter, the query works as expected.

CAUSE

=====

A crosstab query dynamically generates column names. Therefore,

Microsoft Access cannot tell whether [XXX] is referring to a parameter

or a column name until after the query is bound.

When you build a graph, Microsoft Access uses a crosstab to build the

data to graph. If the query is a parameter query, you have to define

the parameters explicitly as you would for a normal crosstab query.

RESOLUTION

==========

To avoid this error, define [XXX] as an explicit parameter by adding

it to the Query Parameters dialog box.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new crosstab query on the Order Details table.

3. Drag the fields Unit Price, Discount, and Order ID to the QBE grid,

   and set the values in the grid as follows:

      Crosstab Query: Query1

      ---------------------------------

      Field: Unit Price

         Total: Group By

         Crosstab: Row Heading

         Criteria: > [Enter an Amount:]

      Field: Discount

         Total: Group By

         Crosstab: Column Heading

      Field: Order ID

         Total: Count

         Crosstab: Value

4. Run the query. The following error message is displayed:

      Can't bind name '[Enter an Amount:]'.

5. Choose OK to return to query design, and then select Parameters

   from the Query menu.

6. Enter the following under Parameters:

      [Enter an Amount:]

7. Select Currency as the Data Type, and choose OK.

8. Run the query and type any amount (for example, type "2").

   The query executes.

REFERENCES

==========

For more information on parameter queries, search for "parameter query"

then "Creating a Parameter Query" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 can't checkpage

KBCategory:

KBSubcategory: QryCross


PRB: No Password Prompt Using Microsoft Access .MDB with ODBC

Article ID: Q112346

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You are not prompted for a user name and password as you expect when you

are using ODBC from an application such as Microsoft Query (which is

included with Microsoft Excel) to access data in a Microsoft Access

database.

CAUSE

=====

You have not specified a Microsoft Access SYSTEM.MDA file to be used with

the Microsoft Access ODBC data source. The SYSTEM.MDA file contains a list

of users, groups, and passwords.

If you do not specify a SYSTEM.MDA file, ODBC will open your Microsoft

Access database (.MDB) file without a password as a member of the Users

group, with the permissions of the Users group.

RESOLUTION

==========

Edit the Microsoft Access ODBC data source to use the appropriate Microsoft

Access SYSTEM.MDA file. Use the following steps to alter a Microsoft Access

ODBC data source to use a SYSTEM.MDA file:

1. Start Microsoft Windows Control Panel.

2. Double-click the ODBC icon.

3. In the Data Sources box, select the Microsoft Access data source

   you are using, and then choose the Setup button.

4. Choose the Options button.

5. In the System Database box, select the Database option button

   instead of the None option button.

6. Choose the Select Database button.

7. Find and select the appropriate SYSTEM.MDA file. This file will

   probably be in your Microsoft Access directory.

8. Choose the OK button.

MORE INFORMATION

================

If ODBC opens your Microsoft Access database without a password, this does

not mean that you have circumvented Microsoft Access security.

Microsoft Access employs user-level security on databases, not share-level

security. In user-level security, you grant permissions to users of your

database resources (such as tables and forms). In share-level security, you

password-protect your resources.

If ODBC opens your Microsoft Access database without a password, you will

log on to the database as a member of the Users group and will only have

permissions to objects in the database that are available to members of the

Users group.

If members of the Users group do not have permissions to edit data in a

table, you will not be able to edit that table using ODBC with no

SYSTEM.MDA file specified.

In user-level security, the combinations of users and their permissions

define database security. Information about users, groups, and passwords is

stored in a SYSTEM.MDA file. Information about who has permissions on

database objects is stored with each database in the Microsoft Access

database (.MDB) file.

Passwords are stored in a SYSTEM.MDA file, and are used only to prevent a

user from logging on to a database as another user who has different

permissions on database objects. Members of the Users group may not have

permissions to modify data in tables, but a user with a password may have

permissions to modify data in the tables.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 25, "Administering a

Database System," pages 612-624

Microsoft Access "User's Guide," version 1.1, Chapter 25, "Administering a

Database System," pages 616-633

For more information about security, search for "security: an overview," or

"security: basics" then view each of the topics using the Microsoft Access

Help menu.

For information on the highly recommended "SecurityWizard and White Paper"

Application Note, query on the following words here in the Microsoft

Knowledge Base:

   securitywizard and white and paper

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ScrtOthr


PRB: No Prompt for Second Parameter in Query

Article ID: Q90148

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access does not prompt you for the second parameter in a query,

even though it does prompt you for the first parameter.

CAUSE

=====

The parameter text in the criteria fields is identical for both parameters.

Each prompt for a user-entered parameter must contain a unique text string.

RESOLUTION

==========

Modify the text in the criteria field for one of your parameters.

Then Microsoft Access will be able to distinguish between the two

parameters.

MORE INFORMATION

================

The following sample query will cause the problem stated above:

   Field:    Product ID        Product Name

   Sort:

   Show:         X                  X

   Criteria: [Enter Value:]

   or:                         [Enter Value:]

Microsoft Access considers the two parameter prompts, [Enter Value:],

to be one prompt. Once the first is filled with the user's search

criteria, Microsoft Access thinks the second is filled as well.

The following is an example of a multiple-parameter query that prompts

for both values:

   Field:    Product ID            Product Name

   Sort:

   Show:         X                       X

   Criteria: [Enter Product ID:]

   or:                             [Enter Name:]

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryParm


PRB: Null Value Does Not Pass Validation Rule

Article ID: Q117542

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You cannot leave a field blank, or null, in a table's Datasheet view if the

field has a validation rule.

CAUSE

======

This behavior differs from that of Microsoft Access version 1.x. In

Microsoft Access 1.x, a null value is accepted for a field even if "or is

null" is not part of the validation rule.

RESOLUTION

==========

Include "or is null" as part of the validation rule for the field. For

example, a validation rule for a text field could be:

   "A" or "B" or is null

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create the following new table:

      Table: Table1

      ------------------------------

      Field Name: ID

         Data Type: Counter

      Field Name: Code

         Data Type: Text

         Validation Rule: "A" or "B"

   Save the table as Table1.

2. View the table in Datasheet view.

3. Select the Code field. Type "A" (without quotation marks) and press

   ENTER. Note that you can move to the next record.

4. Return to the first record. Select the Code field, delete the "A", then

   press ENTER. Note that you cannot move to the next record, since a null

   value is not allowed in the field.

REFERENCES

==========

For more information about using null values in a validation rule, search

for "ValidationRule" then "ValidationRule, ValidationText Properties" using

the Microsoft Access Help menu.

Additional reference words: 2.00

KBCategory:

KBSubcategory: TblFldp


PRB: Nulls Not Concatenated with "+" Operator

Article ID: Q90114

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When the & operator is used, text can be concatenated to either

side of a null. However, when this is done with the + operator,

a null is returned.

CAUSE

=====

The & operator treats nulls as empty strings. The + operator

propagates nulls.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a form called Form1.

2. Place a text box field called Field0 on this form.

3. Switch Form1 to Form view.

4. Add the following function to a module:

      Function Demonstrate ()

         Forms!Form1!Field0 = Null + "This is a string"

         Debug.Print Forms!Form1!Field0

         Forms!Form1!Field0 = Null & "This is a string"

         Debug.Print Forms!Form1!Field0

      End Function

5. In the Immediate window, type the following and press ENTER:

      ?Demonstrate()

   The Immediate window will now show the following results:

      ?Demonstrate()

      #NULL#

      This is a string

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Appendix C

Additional reference words: 1.00 1.10 2.00 expressions strings checkpage

KBCategory:

KBSubcategory: TblFldp


PRB: Objects Cannot Be User-Defined Data Type Elements

Article ID: Q96420

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when attempting to use

a Microsoft Access defined object data type as a user-defined data

type element:

   Expected: Integer or Long or Single or Double or Currency or String

   or Variant or Identifier.

CAUSE

=====

Objects predefined by Microsoft Access are not supported as user-defined

data type elements.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Microsoft Access defines eight object data types: Control, Database,

Dynaset, Form, QueryDef, Report, Snapshot, and Table. You can use the

Type statement in the Declarations section of a module to define your

own data type. The user-defined data type cannot be one of the eight

predefined data types.

Steps to Reproduce Behavior

---------------------------

1. Create a new module.

2. In the Declarations section, attempt to define a structure as

   follows:

      Type ControlInfo

        Ctl as Control

      End Type

3. From the Run menu, choose Compile All.

You will receive the above error message.

REFERENCES

==========

For more information, search for "Type Statement," then "Object Data

Types" using the Microsoft Access Help menu.

Microsoft Access "Introduction to Programming," version 1.0, Chapter 5,

"Variables, Constants, and Data Types," page 43

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmOthr


PRB: Office Manager 4.2 Will Not Load Microsoft Access 2.0

Article ID: Q113931

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

After you install the Microsoft Office Manager version 4.2, the button for

Microsoft Access generates the following error message:

   Cannot find 'MSACCESS.EXE'. Please start the application another

   way. While the application is running, click on the tool bar

   button or choose the menu command again.

RESOLUTION

==========

If Microsoft Access will not start properly after you follow the suggestion

to start Microsoft Access and then click the Office Manager button, contact

the Microsoft Office Product Support group to receive up-to-date

information about this issue. You can reach the Microsoft Office Product

Support group at (206) 635-7056.

There is also a Microsoft Office Setup section in the Microsoft Excel forum

on CompuServe where you can get answers to questions about this issue.

Additional reference words: 2.00

KBCategory:

KBSubcategory: EvnOs


PRB: OnChange Property Not Triggered with Combo Box Selection

Article ID: Q115126

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you use a macro or an event procedure in a combo box's OnChange

property, that macro or event procedure does not run when you select an

item from the combo box's drop-down list.

RESOLUTION

==========

Instead of using the macro or event procedure in the combo box's OnChange

property, use it in the BeforeUpdate or AfterUpdate property. The macro or

event procedure will then run when you select an item from the combo box's

drop-down list.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

A combo box's OnChange property is triggered only when the Text property

changes, either by typing directly in the combo box, or by changing the

Text property using a macro or Access Basic code. The OnChange property is

not triggered when you select an item from the drop-down list.

Steps to Reproduce Behavior

---------------------------

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

1. Open the sample database NWIND.MDB.

2. Create the following new macro, and then save the macro as Test

   Change:

      Test Change Actions

      -------------------

      MsgBox

         Message: This is a test of the OnChange property.

3. Open the Orders form in Design view.

4. Set the Employee ID combo box's OnChange property to:

      Test Change

5. View the form in Form view.

6. In the Employee ID combo box, select an employee from the drop-down

   list. Note that the Test Change macro does not run.

7. In the Employee ID combo box, type any text. Note that the Test Change

   macro runs.

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 8, "Events"

Microsoft Access "User's Guide," version 2.0, Chapter 25, "Using Macros

with Forms"

Additional reference words: 2.00

KBCategory:

KBSubcategory: PgmOthr


PRB: OnExit Macro Runs with AfterUpdate Macro in Option Group

Article ID: Q109317

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Both the macro in the AfterUpdate property and the macro in the OnExit

property of an option group will run when you update the option group if

the macro action in the AfterUpdate property is an ApplyFilter action.

RESOLUTION

==========

Do not use a macro in the OnExit property of an option group if the option

group's AfterUpdate property runs a macro that contains an ApplyFilter

action.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new form based on the Employees table. Add the Employee ID

   and Last Name fields to the form.

3. Create an option group on the form with two toggle buttons and the

   following properties:

      Option Group: Test

         AfterUpdate: Macro1

         OnExit: Macro2

      Option Button: Button1

         Option Value: 1

      Option Button: Button2

         Option Value: 2

4. Save the form as Form1.

5. Create the following two new macros:

      Macro Name   Condition                Action

      -------------------------------------------------

      Macro1       Forms![form1]![test]=1   ApplyFilter

                   Forms![form1]![test]=2   ApplyFilter

      Macro2                                MsgBox

      Macro1 Actions

      -------------------------

      ApplyFilter

         Where: [employee id]=5

      ApplyFilter

         Where: [employee id]=7

      Macro2 Actions

      ----------------

      MsgBox

         Message: Test

6. Toggle between the two option buttons. In Microsoft Access version

   1.x, both the ApplyFilter and MsgBox actions are run. In Microsoft

   Access version 2.0, the following error message is displayed:

      Field or record can't be saved while it's being validated.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: DcmNwd


PRB: Opening a Database Read-Only Forces Others to Read-Only

Article ID: Q92686

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you open a database as read-only, all other users attempting to

open the same database as Exclusive are forced to open it read-only

also. This applies to multiple copies of Microsoft Access running on

one workstation as well as the multiuser environment.

RESOLUTION

==========

To avoid opening the database in read-only mode, do not select

Exclusive when opening the second instance of the database.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open Microsoft Access and open the NWIND database with Read Only

   selected and Exclusive cleared.

2. Minimize the first instance of Microsoft Access and start a second

   instance of Microsoft Access.

3. In the second instance of Microsoft Access, open the NWIND database

   with Exclusive selected and Read Only cleared.

Result: the database opens as Read Only, even though the Read Only

flag was not selected.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: GnlMu


PRB: Operation Stops when Editing Attached SQL Tables

Article ID: Q96897

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access may return an inconsistent value for a floating

point field in an SQL table when it checks the value of the field

before editing and before updating. This can result in the error

message

   Data Has changed: Operation Stopped

when you are trying to update a record in an attached SQL table.

CAUSE

=====

The problem occurs if an SQL field data type is set to Float and

the table does not contain a TimeStamp field, or when an SQL

indexed field data type is set to either DateTime or Float.

RESOLUTION

==========

1. Remove the index from any fields with the DateTime or Float

   data types.

   To obtain information on any index within a SQL table, you can

   run the following system stored procedure within the System

   Administrator Facility (SAF):

      sp_helpindex <Table Name>

   To remove an index, use the following command:

      DROP INDEX <Table_Name.Index_Name>

   Note that you must be logged into the SQL Server as either the table

   owner or the System Administrator.

2. If other fields in the table have the Float data type, you must

   insert a TimeStamp field in the table. If a field with this

   data type is present, Microsoft Access returns a consistent value for

   fields of this data type and will use the value in this field to

   verify whether the record has been modified.

   This can be accomplished by performing the following command

   within SAF:

      ALTER TABLE <Table Name> ADD TimeStamp timestamp

   Note that you must be logged in as either the database

   owner or the System Administrator to run the above command.

Additional reference words: 1.00 1.10 2.00 SQL

KBCategory:

KBSubcategory: ObcOthr


PRB: Option Button Appears Fuzzy in Datasheet View

Article ID: Q93142

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you create a form and place an option button on the form, then

switch to Datasheet view, the outline of the option button will

appear fuzzy. This happens when the focus is on any option button

in Datasheet view.

RESOLUTION

==========

Move the focus to a field that does not contain an option button.

The option button will change to a normal appearance.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a new blank form.

2. From the toolbox, select the Option button and place it on the

   form.

3. Switch to Datasheet view.

4. Make sure the focus is on the button. Notice the outline of the

   button has a fuzzy appearance.

Additional reference words: 1.00 1.10 2.00 misc

KBCategory:

KBSubcategory: FmrColr


PRB: Out of Disk Space Error Makes Paradox Table Unusable

Article ID: Q92739

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are editing a Paradox table in Microsoft Access and run out of

disk space, the following error message appears:

   Out of Disk Space

You continue to receive the same error message, even after you free up

additional disk space.

RESOLUTION

==========

Use the following steps to correct this problem:

1. Delete the attachment to the remote Paradox table by selecting

   the table name in the table list and pressing the DEL key.

2. Rename both the table (xxx.DB) and its index (xxx.PX) to some

   other names.

3. Recreate the attachment, then try attaching to the remote Paradox

   table again.

Paradox is manufactured by Ansa Software, a Borland company, a vendor

independent of Microsoft; we make no warranty, implied or otherwise

regarding this product's performance or reliability.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: IsmPdox


PRB: Out Of Memory When Pasting Text Into Module

Article ID: Q92679

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

An "Out of Memory" message appears when you are pasting more than

64K of ASCII text from the Clipboard.

CAUSE

=====

The implementation of the Clipboard paste in Microsoft Access cannot

paste more than 64K of ASCII text. This message appears even if the

code translates into less than 64K of pseudocode.

RESOLUTION

==========

Paste the text into the module in more than one step. Each paste

must contain less than 64K of text.

Additional reference words: 1.00 1.10 2.00 WinIss copy errmsg

KBCategory:

KBSubcategory: EvnOs


PRB: Parameter Limit for Access Basic Functions in Validation

Article ID: Q105127

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You receive the error message "Expression Too Complex" when you are

creating a ValidationRule property for a table or control.

CAUSE

=====

You can pass a maximum of 28 parameters to an Access Basic function when

you call the function from the ValidationRule property of a table or

control. Attempts to pass more than 28 parameters will result in the error

message stated above.

RESOLUTION

==========

You can pass more than 28 parameters by concatenating parameters. Each

parameter will be separated by a character (for example, a semicolon).

After passing the individual parameters as one long parameter, you can

parse out the individual parameters by searching for the separator

character (the semicolon), using the InStr() and Mid() functions.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access. For more information on Access Basic, please refer

to the "Introduction to Programming" manual in Microsoft Access version

1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access

Basic" in version 2.0.

NOTE: In the following sample code, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating this code in

Access Basic.

Steps to Reproduce Behavior

---------------------------

1. Open a new module and enter the following:

      '*************************************************************

      'Declarations section of the module.

      '*************************************************************

      Option Explicit

      '===============================================================

      ' The following function CanPass28 will be accepted when entered

      ' into a validation rule

      '===============================================================

      Function CanPass28 (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, _

            p, q, r, s, t, u, v, w, x, y, z, a27, b28)

         Dim Parm28, Parm29                          'These 3 lines

         Parm28 = Mid(b28, 1, InStr(b28, ";") - 1)   'explained in

         Parm29 = Mid(b28, InStr(b28, ";") + 1)      'step 5.

      End Function

      '===============================================================

      'The following function CannotPass29 will give an error message

      ' when used in a validation rule

      '===============================================================

      Function CannotPass29 (a, b, c, d, e, f, g, h, i, j, k, l, m, n, _

            o, p, q, r, s, t, u, v, w, x, y, z, a27, b28, c29)

      End Function

2. Open a new form. Add a text box to the form.

3. Enter the following expression for the ValidationRule property of the

   text box, and then press ENTER:

      -1 = CannotPass29 (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, _

              17,18,19,20,21,22,23,24,25,26,27,28,29)

   The error message "Expression Too Complex" will occur.

4. Change the expression for the ValidationRule property to the following,

   and then press ENTER:

      -1 = CanPass28 (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, _

              17,18,19,20,21,22,23,24,25,26,27,28)

   No error message will occur.

5. Enter the following expression, which concatenates the last two

   parameters to one parameter, for the ValidationRule property. Press

   ENTER:

      -1 = CanPass28(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, _

              17,18,19,20,21,22,23,24,25,26,27,28&";"&29)

The last two parameters are separated inside the function by searching for

the semicolon with the following lines from the function created in step 1:

     Parm28 = Mid(b28, 1, InStr(b28, ";") - 1)

     Parm29 = Mid(b28, InStr(b28, ";") + 1)

Additional reference words: 1.00 1.10 2.00 ADK

KBCategory:

KBSubcategory: GnlValid


PRB: Paste Unavailable After Record Is Copied to Clipboard

Article ID: Q95323

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If two users are simultaneously modifying the same record in the same

table, the user who attempts to save the record last receives the

following error message:

   Data has changed; Operation Stopped

When you choose the OK button to close this message, you receive the

following error message:

   This record has been changed by another user since you started

   editing it. If you save the record you will overwrite the changes

   the other user made. Copying the changes to the Clipboard will let

   you look at the values the other user entered, and then paste your

   changes back in if you decide to make changes.

You are given the option to copy the changes the other user made to

the Clipboard and then view the contents in the Clipboard; however,

the Paste command is unavailable in Microsoft Access.

CAUSE

=====

Microsoft Access does not support pasting records when the focus is

in a control.

RESOLUTION

==========

You can choose Paste Append to append the record to the table; or, if

you select the record you want to paste to, you can then use the Paste

command (or CTRL+V).

STATUS

======

This behavior is by design.

Additional reference words: 1.00 1.10 2.00 errmsg

KBCategory:

KBSubcategory: GnlMu


PRB: Permissions Command Unavailable When Logged in as Guest

Article ID: Q115572

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you log into Microsoft Access as Guest (when Guest is assigned the

default permissions) and then create a database, you cannot view or change

permissions on any of the objects in the database.

CAUSE

=====

The Permissions command is always unavailable when you are logged in as

Guest, even if you give the Guest user permissions to view or change object

permissions.

This behavior occurs because the Guests group does not inherit read data

permission on the MSysUserList query in the SYSTEM.MDA file. To prevent

permission-related errors, the Permissions command is always disabled for

users logged in as Guest.

STATUS

======

This behavior is by design. Changes to this behavior are being reviewed and

will be considered for inclusion in a future release of Microsoft Access.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open any database.

2. Enable security (if it is not already enabled) by assigning a password

   to the Admin user. To do this, choose Change Password from the Security

   menu, and then enter a password for the Admin user (the Admin user is

   the default user).

3. Quit Microsoft Access and then restart it. Log in as Guest (no password

   required).

4. Create a new database.

5. Create a new table, and then create a query based on the table.

6. From the Security menu, try to choose Permissions. Note that the

   Permissions command is unavailable.

Additional reference words: 2.00 security greyed grayed

KBCategory:

KBSubcategory: ScrtPerm


PRB: Printing on Avery 5267 labels

Article ID: Q103171

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you print Avery 5267 labels, the text may appear to "creep" down

the page.

CAUSE

=====

Avery 5267 labels are not cut in precise .5-inch increments on the

page. Because the labels are slightly larger than .5 inch, if you

print in .5-inch increments, the text appears to creep down the page.

RESOLUTION

==========

When you are placing the controls in a report, allow room for the

label discrepancy. The following steps print three lines of text on

Avery 5267 labels. This example uses a function that concatenates the

fields for optimal use of space on each label.

1. From Print Setup, set the top and bottom margins to .5 inch and

   set the left and right margins to .25 inch. Press the More button and

   set Items Across to 4, Row Spacing to 0, and Column Spacing to 0.3

   inches. Under Item Size, select the Same As Detail option.

2. Make the width of the report 1.75 inches.

3. Set the Height property for the Detail section to .5 inch and set

   the CanGrow and CanShrink properties to No.

4. Locate one text box control and set the properties manually as

   follows:

   Control: Text Box

      Top:       .01

      Height:    .48

      CanGrow:   Yes

      CanShrink: Yes

      Font:      Arial

      FontSize:  8

      ControlSource:

          =AddressBlock([First],[Last],[Address],[City],[State],[Zip])

5. Create a new Access Basic module, and type the following code into

   it:

   NOTE: In the following sample code, an underscore (_) is used as a

   line-continuation character. Remove the underscore when re-creating

   this code in Access Basic.

   Option Explicit

   Function AddressBlock$ (First, Last, Address, City, State, Zip)

      Dim A1$, A2$, A3$, CR$

      CR$ = Chr(13) & Chr(10)  'Carriage return and line feed

      A1$ = IIf(ISB(First),"",First & " " & IIf(ISB(Last),"" ,Last _

      & CR$))

      A2$ = IIf(ISB(Address),"",Address & CR$)

      A3$ = City & ", " & State & " " & Zip

      AddressBlock = A1$ & A2$ & A3$    'Concatenate the strings.

   End Function

   Function ISB (V) As Integer

      If IsNull(V) or V = "" Then ISB = True Else ISB = False

   End Function

The spacing above creates a .01 reserve above and below the text

control. Variations of this layout may also print correctly.

NOTE: The Mailing Label ReportWizard creates two controls, each with

a height of .17, leaving a reserve below and above the text for label

adjustments.

To see another example, query on the following words in the Microsoft

Knowledge Base:

   white and space and canshrink and reports

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: RptLabel


PRB: Prompt to Save Libraries After Replace Operation

Article ID: Q114680

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You may be prompted to save libraries if you perform a global search and

replace operation using the Loaded Modules search option.

CAUSE

=====

Microsoft Access will replace text in library modules if the DebugLibraries

option is set to True in the [Options] section of the MSACC20.INI file.

This new option was added in Microsoft Access version 2.0 to make debugging

libraries easier. The option allows you to edit loaded library modules

along with user-created modules. The default for this option is False.

RESOLUTION

==========

If you have replaced text in a library accidentally, you can either

reinstall Microsoft Access, or decompress the library off your original

Microsoft Access disks.

If you need to replace text in multiple modules, first remove the

DebugLibraries option from the MSACC20.INI file and then restart Microsoft

Access. After the replacement is done, add the option back to the

MSACC20.INI file.

MORE INFORMATION

================

You can find the decompression program, DECOMP.EXE, on disk 1 of your

original Microsoft Access disks. Copy the DECOMP.EXE file to your hard disk

so that it will be available no matter what disk is in the floppy disk

drive.

The syntax for the DECOMP.EXE command is as follows:

   DECOMP.EXE <source filename> <destination filename>

For example, use the following command to decompress the WZLIB.MD_ file to

the Microsoft Access directory:

   DECOMP.EXE A:\WZLIB.MD_ C:\ACCESS\WZLIB.MDA

The following libraries ship with Microsoft Access 2.0:

   Library          File on disk

   -----------------------------

   WZBLDR.MDA       WZBLDR.MD_

   WZFRMRPT.MDA     WZFRMRPT.MD_

   WZLIB.MDA        WZLIB.MD_

   WZQUERY.MDA      WZQUERY.MD_

   WZTABLE.MDA      WZTABLE.MD_

REFERENCES

==========

Microsoft Access "Building Applications," version 2.0, Chapter 15

Additional reference words: 2.00 debuglibraries find

KBCategory:

KBSubcategory: PgmOthr


PRB: Query by Form Returns No Rows When All Rows Expected

Article ID: Q94027

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

While specifying criteria for a query in a previously designed form,

you leave one of the fields empty because you want all the records,

not just the ones that match a certain value. But instead of getting

all the records, as you expected, you get none at all.

CAUSE

=====

Queries that contain empty criteria fields may return unexpected

results because an empty criteria field results in the following

condition in the WHERE clause:

   Like Null

This condition is always false because any operation that includes a

null value returns a null result.

Queries can reference form fields through implicit parameters--

making a query by form. For example, an application developer might

put the following criteria on the CustomerName field:

   Like Forms!CriteriaDialog!CustomerName

Here CriteriaDialog is a form that holds the criteria fields. Someone

using the application might omit a customer name entry in the

CriteriaDialog form in the hopes of seeing all the rows. However, the

query actually returns no rows because of the null reference in the

resulting WHERE clause.

RESOLUTION

==========

Application developers can work around this potential problem by

adding the following function to a module:

   Function CNulls (v As Variant, subs As Variant) As Variant

      If (IsNull(v)) Then

         CNulls = subs

      Else

         CNulls = v

      End If

   End Function

The CNulls() function converts null values to a given value.

Essentially, if the first argument to the function is null, the second

argument is returned. Otherwise, the first argument is returned

unchanged.

After you add the function to a module, change the criteria to read

like this:

   Like CNulls( Forms!CriteriaDialog!CustomerName, "*"  )

Now, if the user does not supply a customer name, the CNulls() function

will return the asterisk, and the condition will return all rows that

contain data.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryOthr


PRB: Query Information Lost Switching to SQL-Specific Query

Article ID: Q111777

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you switch a query from a normal query type (Select, Delete, Append,

and so on) to a SQL-specific query type (Union, Pass-Through, or Data

Definition), you lose all the existing information, such as added tables or

expressions, in the query.

If you add information to a SQL-specific query and then switch the query to

a normal query type, you will lose any SQL information in the query.

CAUSE

=====

When you switch from a normal Query window to a SQL-specific Query window,

Microsoft Access clears the Query Design window. Microsoft Access also

clears the Query Design window when you switch from a SQL-specific Query

window to a normal Query window.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open the Catalog query in Design view. Note the added tables and the

   information in the query grid.

3. From the Query menu, choose SQL Specific, then choose any of the

   three SQL-specific query types shown.

4. Type the SQL command SELECT in the Query window.

5. From the Query menu, choose Select. Note that the original query

   information is gone.

6. From the Query menu, choose SQL Specific, and then choose the

   query type you chose in step 3. Note that the SELECT statement is

   gone.

7. Close the query without saving the changes you made.

Additional reference words: 2.00 Queries

KBCategory:

KBSubcategory: QryOthr


PRB: Raised and Sunken Check Box and Option Button Controls

Article ID: Q96896

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

In VGA resolution (640 X 480) raised check boxes and option buttons are

indistinguishable from sunken check boxes and option buttons on both forms

and reports.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

You can specify three different appearances for controls on your forms

and reports: Normal, Raised, and Sunken. Check box controls and option

button controls allow you to specify these different appearances, but

raised and sunken are displayed identically.

Steps to Reproduce Behavior

---------------------------

1. Create a blank unbound form in VGA resolution.

2. In Design view add three check box controls to the form.

3. Add three option button controls to the form.

4. Choose the Palette button and make one of the check boxes and one

   of the option buttons sunken. Leave one of each normal. Make one of

   each raised.

5. Switch to Form view. Compare the raised controls to the sunken

   controls.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 12, "Using Special

Design Effects on Forms and Reports"

Microsoft Access "User's Guide," version 1.0, page 306

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: FmrColr


PRB: Record Sort Order Is Different Than Expected

Article ID: Q105978

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you view data in a datasheet, combo box, or list box, the record order

is different than you expect. For example, text fields may appear out of

alphabetical order or numeric fields may appear out of sequence.

CAUSE

=====

Microsoft Access has two default sort orders, insertion order and primary

key order. These sort orders are used at different times, causing records

to appear to be sorted differently than you expect.

RESOLUTION

==========

If you want to see the insertion order for a table with a primary key

field, remove the primary key from the table. For more information on

removing a primary key, search for "primary key" then "Deleting the Primary

Key" using the Microsoft Access Help menu.

If you want to store records in a different order than insertion order,

build a new table with a custom sort. To do this, use a make-table query

with a specified sort order. For more information on make-table queries,

see the Microsoft Access "User's Guide," Chapter 7.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Insertion order is the order in which records are entered and stored in a

table. This order may not be in alphabetical or numeric sequence, since

records are often entered in a random order.

Primary key order is based on the field or fields in a primary key. This

order has no effect on the way records are stored in a table; the records

are still stored in insertion order. Primary key order changes only the way

the records are displayed.

If the underlying table for a table, form, subform, or query datasheet has

no primary key, the data will be displayed in insertion order. If the table

has a primary key, the data will be displayed in primary key order.

There are two exceptions to this rule. For query datasheets, insertion

order will be used for a query that has specific criteria but no specific

sort order, even if the underlying table has a primary key. For combo boxes

and list boxes, insertion order is used even if the underlying table has a

primary key.

Steps to Reproduce Behavior

---------------------------

The following four examples demonstrate the two default record orders and

the two exceptions described above. Note that all the examples use the

sample database NWIND.MDB.

Viewing Records in Insertion Order:

1. Make a copy of the Categories table and save the copy as Categories2.

2. Open the Categories2 table in Datasheet view.

3. Add the following record:

      Category ID:  APPZ

      Category Name:  Appetizers

      Description:  <leave blank>

      Picture:  <leave blank>

Note the record order in the Category ID field. BEVR is the first record

and APPZ is the last. This is the order in which the records were added to

the table.

Viewing Records in Primary Key Order:

1. Create a new query based on the Categories2 table as follows:

      Field name: Category ID

      Sort: <leave blank>

      Show: True

      Criteria: <leave blank>

2. From the Query menu, choose Run.

Note that the query datasheet is sorted alphabetically by Category ID,

which is the primary key field.

Viewing Records in Insertion Order Despite a Primary Key:

1. Create a new query based on the Categories2 table as follows:

      Field name: Category ID

      Sort: <leave blank>

      Show: True

      Criteria: a* or s*

2. From the Query menu, choose Run.

The following records will be displayed:

   Category ID

   -----------

   SEAF

   APPZ

Note that SEAF appears before APPZ even though Category ID is a primary key

field. Microsoft Access is using insertion order because the query includes

specific criteria but no specific sort order.

Viewing Combo Box Items in Insertion Order:

1. Create the following new form:

      Form: Test1

         ControlSource: Unbound

2. Add the following combo box to the Test1 form:

      Combo box: Field1

         ControlSource: Unbound

         RowSourceType: Table/Query

         RowSource: Categories2

         ColumnCount: 2

         ColumnWidth: 1 in; 1 in

3. View the form in Form view.

4. View the items listed in the combo box.

Note that the items are displayed in the combo box in insertion order, even

though the underlying table has a primary key field.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: TblPriky


PRB: RecordCount Property Incorrect Using OpenTable Method

Article ID: Q117167

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The RecordCount property of a table may be incorrect.

CAUSE

=====

If you open a table, begin a transaction, add a new record, and then roll

back the transaction, the record count returned on the table may be

incorrect because the previous value of the RecordCount property is not

restored. This behavior can occur when you use the OpenTable method, or

when you use the DB_OPEN_TABLE Type property setting with the OpenRecordset

method on a TableDef object using data access objects (DAO).

RESOLUTION

==========

To retrieve the correct record count, create a dynaset based on the table,

use the MoveLast method to move to the last record in the dynaset, and

print the dynaset's RecordCount property. The following example

demonstrates how to do this:

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open a new module and enter the following sample code.

   NOTE: In the following sample code, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this code in Access Basic.

      ' ****************************************************************

      ' Declarations section of the module

      ' ****************************************************************

      Option Compare Database

      Option Explicit

      ' ****************************************************************

      ' The RightCount() function creates a dynaset based on the

      ' Employees table, prints the table's record count, starts a new

      ' transaction, adds a record, rolls back the transaction, and then

      ' prints the dynaset's record count.

      ' ****************************************************************

      Function RightCount ()

         Dim db As Database

         Dim MyDyna As Dynaset

         Set db = CurrentDB()

         Set MyDyna = db.CreateDynaset("Employees")

         MyDyna.MoveLast

         Debug.Print "BEFORE Transaction: Employee Record Count = " & _

                                        MyDyna.recordcount

         BeginTrans

             MyDyna.AddNew

             MyDyna![Last Name] = "Doe"

             MyDyna![First Name] = "John"

             MyDyna.Update

         Rollback

         MyDyna.Close

         Set MyDyna = db.CreateDynaset("Employees")

         MyDyna.MoveLast

         Debug.Print "AFTER Transaction: Employee Record Count = " & _

                                        MyDyna.recordcount

         MyDyna.Close

      End Function

3. From the View menu, choose Immediate Window.

4. In the Immediate window, type the following line and then press ENTER:

      ?RightCount()

   Compare the record count returned after the transaction is rolled back

   with the actual number of records in the table and note that they are

   the same.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

When you use the OpenTable method, or the DB_OPEN_TABLE Type property

setting with the OpenRecordset method, the base table is opened directly.

The RecordCount property retrieved from the table is only an approximate

value, and is not always accurate. When a transaction is rolled back, the

previous value of the RecordCount property is not restored.

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open a new module and enter the following sample code.

   NOTE: In the following sample code, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this code in Access Basic.

      ' ****************************************************************

      ' Declarations section of the module

      ' ****************************************************************

      Option Compare Database

      Option Explicit

      ' ****************************************************************

      ' The WrongCount() function opens the Employees table, prints the

      ' record count, starts a new transaction, adds a record, rolls

      ' back the transaction, and then prints the table's record count.

      ' ****************************************************************

      Function WrongCount ()

         Dim db As Database

         Dim MyTable As Table

         Set db = CurrentDB()

         Set MyTable = db.OpenTable("Employees")

         MyTable.MoveLast

         Debug.Print "BEFORE: Employee Record Count = " & _

                                       MyTable.RecordCount

         BeginTrans

             MyTable.AddNew

             MyTable![Last Name] = "Doe"

             MyTable![First Name] = "John"

             MyTable.Update

         Rollback

         MyTable.Close

         Set MyTable = db.OpenTable("Employees")

         MyTable.MoveLast

         Debug.Print "AFTER: Employee Record Count = " & _

                                       MyTable.RecordCount

         MyTable.Close

      End Function

3. From the View menu, choose Immediate Window.

4. Type the following line in the Immediate window, and then press ENTER:

      ?WrongCount()

   Compare the record count returned after the transaction is rolled back

   with the actual number of records in the table and note that they are

   different. The record count that is returned after the transaction is

   rolled back is not correct.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: PgmObj


PRB: RecordCount Property Returns Incorrect Number of Records

Article ID: Q105976

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The RecordCount property, when used with a dynaset or snapshot,

returns a recordset containing an incorrect number of records.

CAUSE

=====

For dynasets and snapshots, Microsoft Access does not automatically

return the number of records that exist in the recordset. It returns

the number of records accessed.

RESOLUTION

==========

To determine the exact number of records in a dynaset or snapshot, use

the MoveLast method before checking the RecordCount property.

MORE INFORMATION

================

This article assumes that you are familiar with Access Basic and with

creating Microsoft Access applications using the programming tools provided

with Microsoft Access.

The following Access Basic function, MyWrongRecordCount(), returns the

number 1 for the Customers table in the sample database NWIND.MDB

because only one record has been accessed. The MyRightRecordCount()

function uses the MoveLast method first to access all records in the

dynaset and then to return the RecordCount value.

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new module.

3. Add the following line of code to the Declarations section:

      Option Explicit

4. Create the following functions:

      '===========================================================

      ' The following function, MyWrongRecordCount(), demonstrates

      ' the incorrect way to use the RecordCount property to count

      ' records in a dynaset.

      '===========================================================

      Function MyWrongRecordCount ()

         Dim MyDB As Database, MyDyna As Dynaset

         Set MyDB = CurrentDB()

         Set MyDyna = MyDB.CreateDynaset("Customers")

         MyWrongRecordCount = MyDyna.RecordCount

         MyDyna.Close

      End Function

      '===========================================================

      ' The following function, MyRightRecordCount(), demonstrates

      ' the correct way to use the RecordCount property to count

      ' records in a dynaset.

      '===========================================================

      Function MyRightRecordCount ()

         Dim MyDB As Database, MyDyna As Dynaset

         Set MyDB = CurrentDB()

         Set MyDyna = MyDB.CreateDynaset("Customers")

         MyDyna.MoveLast

         MyRightRecordCount = MyDyna.RecordCount

         MyDyna.Close

      End Function

5. From the View menu, choose Immediate Window.

6. In the Immediate window, type the following and then press ENTER:

      ?MyWrongRecordCount()

   Note that the function returns 1.

7. In the Immediate window, type the following and then press ENTER:

      ?MyRightRecordCount()

   Note that the function returns the correct number of records in

   the Customers table.

REFERENCES

==========

Microsoft Access "Language Reference," versions 1.0 and 1.1, page 390

For more information on the RecordCount property, search for "RecordCount"

then "RecordCount Property" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 record count move last

KBCategory:

KBSubcategory: PgmObj


PRB: Removing User Admin from Admins Group Cannot Be Reversed

Article ID: Q92827

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you start Microsoft Access as the Admin user (which occurs by

default) and then remove the user Admin from the Admins group, you

will not be able to go back and make the user Admin a member of the

Admins group during this session.

CAUSE

=====

As soon as you remove the user Admin from the Admins group, this

change is written to the Microsoft Access system tables. At this

point, the Admin user no longer has permission to add anyone to the

Admins group, including itself.

RESOLUTION

==========

To add the user Admin back to the group Admins, you must log on as

another user who is in the Admins group.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Change the password for the user Admin from blank to some nonblank

   password. (NOTE: This will allow you to bring up the Log On dialog

   box at the start of the next session.)

2. IMPORTANT: Create a new user and add this user to the Admins group.

   (There must always be at least one user in the group Admins.

   Remember that you are currently logged in as the user Admin.)

3. Remove the user Admin from the Admins group.

4. Try to add the user Admin back to the Admins group. You will

   receive the error:

      No permission for 'Admin'

    If you leave the Security menu and return to change the settings, you

    will receive the error:

        'No Permission for MSysGroups'

5. Quit Microsoft Access and restart it.

   The Log On dialog box will appear because of the change you made in

   step 1.

6. Log on as the user that you created in step 2.

7. Add the user Admin back to the Admins group.

  NOTE: To disable the Log On dialog box, you must change the Admin

  password back to an empty string (do not enter any information in

  the New Password or Verify fields).

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 25, "Administering a

Database System"

For more information on the Admin user, search on "Admin account" and

"password" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ScrtOthr


PRB: Report or Form Bound to a Table Locks the Table

Article ID: Q92687

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You may receive the following message when you try to open a table

in Design view:

   Can't open table '<table name>' for modifications. Open it read-only?

This occurs when you attempt to open a table in Design view and the table

is the record source for a form or report, and one of the following

conditions is also true:

1. A report is open in Print Preview or a form is open in Form

   view that has the same record source, or is based on a query

   with the same record source.

2. A form is opened in Form view first and then switched to Design

   view.

3. A report is opened in Design view, then switched to Print Preview

   and back to Design view. (You cannot switch to Design view if you opened

   the report in Print Preview first.) This message does not occur when

   opening the form or report in Design view first (without ever

   switching to Form view or Print Preview), and then opening the table

   in Design view.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

You must close the Form or Report window to be able to open the table

in Design view to allow changes.

REFERENCES

==========

For more information, search for "error messages: reference" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 locking

KBCategory:

KBSubcategory: TblOthr


PRB: Rounding Errors Importing/Exporting dBASE IV Values

Article ID: Q96905

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Some floating-point values (single and double precision) have rounding

errors when exported to or imported from a dBASE IV database. For

example, if the floating-point number .0807 is exported from a

Microsoft Access database to a dBASE IV database and then imported

back to Microsoft Access, after the import the value reads .08069.

CAUSE

=====

This problem is caused by the floating-point number being converted

from IEEE floating-point numeric format (used by Microsoft Access and

several other Microsoft products) to ASCII character values required

by dBASE IV. The Microsoft Access dBASE ISAM converts IEEE floating-

point values to ASCII, and conversion of binary fractions to decimal

is inherently inexact.

Typically, such rounding errors are not noticeable or relevant because

they occur at digits far to the right of the decimal point and are not

displayed. However, sometimes the rounding error may appear in the

visible portion of the number.

STATUS

======

This behavior is by design.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmXbase


PRB: Rounding Errors Using Floating-Point Numbers

Article ID: Q111781

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you calculate using floating-point numbers, the result is not always

what you expect. For example, if you use the CInt() (convert to integer)

function in the calculation

   CInt(3.555 * 100)

you get 356 as the result, as you expect. However, the calculation

   CInt(4.555 * 100)

results in 455, instead of 456 as you expect.

CAUSE

=====

Errors similar to the example above occur in any programming language that

uses floating-point numbers. This is because decimal fractions do not

always have exact binary equivalents, which can result in rounding errors.

RESOLUTION

==========

There are several methods you can use to avoid rounding errors when you are

using floating-point numbers:

 - If you are using Single numbers, convert them to Doubles and use

   formatting to hide the extra digits. If there are any rounding errors,

   they will occur at the end of the numbers where they will not affect

   the visible data.

 - Use the Currency data type. If you use currency values of four decimal

   places or less, rounding errors will not occur since these values are

   actually scaled integers rather than floating-point numbers. In Access

   Basic code, use the at sign (@) character to use a Currency data type.

   For example, the calculation

      CInt(4.555@ * 100)

   results in a value of 456.

 - Break the calculation into two or more steps. When you list a

   calculation in one long line, Access Basic stores the intermediate

   values internally. For example, in the calculation

      CInt(4.555 * 100)

   the value 455.5 is temporarily stored and used in the CInt()

   function. If you break the calculation into the two steps

      x = 4.555 * 100

      CInt(x)

   you avoid this internal storage and thus avoid the floating-point

   rounding error.

Additional reference words: 2.00 AB Roundoff

KBCategory:

KBSubcategory: PgmOthr


PRB: SCSI Drives Can Generate Corrupt Error Loading Database

Article ID: Q100159

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are loading a Microsoft Access database file from a SCSI

drive, you receive the following error message:

   <filename> is corrupted or is not a database file. Attempt to

   repair?

Attempts to repair the database do not solve the problem.

CAUSE

=====

There is probably nothing wrong with the database file. The actual

problem is that Microsoft Windows version 3.1 is having trouble

accessing the SCSI drive.

RESOLUTION

==========

Add the following line to the CONFIG.SYS file on your drive. If you

already have a line in your CONFIG.SYS file that references

SMARTDRV.EXE, modify it to match the following line. After adding or

modifying this line, restart your computer.

   DEVICE=C:\WINDOWS\SMARTDRV.EXE /double_buffer

NOTE: If the computer is running MS-DOS 6.0 or a later version, use

C:\DOS instead of C:\WINDOWS to load the newest version of SMARTDRV.EXE.

MORE INFORMATION

================

Microsoft Windows 3.1 requires the double_buffer switch in the

SMARTDRV.EXE line to start in 386 enhanced mode on most SCSI drives.

On a computer where Windows is not located on the SCSI drive, it is

possible that Windows has started in 386 enhanced mode but that the

double buffer is not in use.

REFERENCES

==========

Microsoft Windows "User's Guide," version 3.1, Chapter 14

Additional reference words: 1.00 1.10 2.00 WinIss

KBCategory:

KBSubcategory: EvnOs


PRB: Seek Method Is Faster Than Find Method

Article ID: Q98806

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are using Access Basic to find a record in an indexed field,

the Seek method may be faster than the Find method, especially in a

large table.

CAUSE

=====

This behavior is by design.

RESOLUTION

==========

Use the Seek method on indexed fields to optimize your search speed.

MORE INFORMATION

================

When you perform a Seek, you are opening a table directly and moving

to the record based on an index value. When you create a dynaset and

perform a Find, you are checking the value of the field in every

record until you find a match.

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new module and enter the following two functions:

      '*********************************************

      'Declarations section of the module.

      '*********************************************

      Option Explicit

      '=============================================

      'The following function uses the Seek method.

      'It quickly returns the Customer ID where the

      '   PrimaryKey field = 11070.

      '=============================================

      Function Faster ()

         Dim db As Database, tbl As Table

         Set db = CurrentDB()

         Set tbl = db.OpenTable("Orders")

         tbl.Index = "PrimaryKey"

         tbl.Seek "=", 11070

         Debug.Print tbl("customer id")

         tbl.Close

      End Function

      '=============================================

      'The following function uses the Find method.

      'It is slightly slower in returning the Customer

      '   ID where the PrimaryKey field = 11070.

      '=============================================

      Function Slower()

         Dim Criteria As String, MyDB As Database, Myset As Dynaset

         Set MyDB = CurrentDB()

         Set Myset = MyDB.CreateDynaset("Orders")

         Criteria = "[Order id] =" & 11070

         Myset.FindNext Criteria

         Debug.Print Myset("Customer id")

      End Function

3. From the View menu, choose Immediate Window.

4. In the Immediate window, type

      ?Faster()

    and press ENTER. Then type

      ?Slower()

    and press ENTER.

The Faster() function, which uses Seek, is slightly faster than the

Slower() function, which uses FindNext.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 187-188 and

426-427

Additional reference words: 1.00 1.10 2.00 seeking finding

KBCategory:

KBSubcategory: PgmObj


PRB: SendKeys Macro Action Does Not Work on Toggle Keys

Article ID: Q101125

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A SendKeys macro action will not work correctly on the toggle keys

CAPS LOCK or SCROLL LOCK. You may see the CAPS LOCK or SCROLL LOCK

lights flash on the keyboard, but the lights will not remain on and

the keys will not be correctly activated after the SendKeys action is

completed. Note that SendKeys also will not work correctly with the

ALT+PRINT SCREEN key combination.

CAUSE

=====

SendKeys keystrokes are sent to applications at a high level.

Microsoft Windows traps toggle keys and the PRINT SCREEN key at a

lower level, keeping them from your application.

RESOLUTION

==========

There is a workaround for the CAPS LOCK problem. To force input in a

field into uppercase, set the control's Format property to ">". The

UCase() function can also be used to force entries in a field to

uppercase.

Although a SendKeys macro action cannot toggle keys, a Windows API

SetKeyboardState() function call can toggle keys. The following

example demonstrates how to use the Windows API SetKeyboardState()

function:

   Declare Sub SetKeyboardState Lib "User" (lpKeyState As Any)

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

The following SendKeys action will not toggle the CAPS LOCK key to on:

   MacroName       Action

   ----------------------

   Macro1          SendKeys

   Macro1 Actions

   --------------------------

   SendKeys

      Keystrokes:  {CAPSLOCK}

      Wait:        NO

REFERENCES

==========

Microsoft Access "Language Reference," pages 432 and 485

Additional reference words: 1.00 1.10 2.00 send key num

KBCategory:

KBSubcategory: McrOthr


PRB: SendKeys Macro Does Not Run

Article ID: Q96579

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A macro including a SendKeys macro action does not run the SendKeys

action.

CAUSE

=====

If the Wait argument for the SendKeys action is not set to Yes, the

macro action is run after some delay. Depending upon the following

macro action, the keystrokes that are sent may not be valid. If the

keystrokes are not valid, the SendKeys action appears not to have

been run.

RESOLUTION

==========

Set the Wait argument for the SendKeys action to Yes.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a macro named TestMacro.

      Macro Name         Action

      ---------------------------

      TestMacro          SendKeys

                         MsgBox

      TestMacro Actions

      ---------------------------

      SendKeys

         Keystrokes: %FX

         Wait: No

      MsgBox

         Message:  "HELLO WORLD"

2. Save the macro.

3. Run TestMacro.

   The first macro action should exit Microsoft Access. However, the

   Wait argument is set to No and the message box is activated before

   the SendKeys action is run. When the keystrokes are processed, they

   are not valid and you will hear beeping instead. If the Wait

   argument had been set to Yes, the SendKeys action would have been

   completed before moving to the next action, thus exiting Microsoft

   Access.

Additional reference words: 1.00 1.10 2.00 key strokes

KBCategory:

KBSubcategory: McrActn


PRB: SetWarnings Action Works Only While Macro Is Running

Article ID: Q105644

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you turn off system messages with a SetWarnings macro action, system

messages will be off only while that macro or set of macro actions is

running.

CAUSE

=====

Microsoft Access turns the display of system messages back on when the

macro containing the SetWarnings action is finished.

STATUS

======

This behavior is by design.

REFERENCES

==========

For more information on the SetWarnings action, search for "SetWarnings"

then "SetWarnings Action" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 set warning echo

KBCategory:

KBSubcategory: McrActn


PRB: Shortcut Menus Cannot Be Disabled In Microsoft Access

Article ID: Q113930

UifOthr


PRB: Size To Fit Form Command Not Available

Article ID: Q109450

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are viewing a form in Form view, the Size To Fit Form command on

the Window menu is unavailable.

CAUSE

=====

This behavior occurs if the form is maximized. When a form is maximized,

its size is tied to the size of the Microsoft Access window. If the Size To

Fit Form command were available at this time, you would be altering the

size of the Microsoft Access program window, rather than the

size of your form.

RESOLUTION

==========

Restore the Form window to its non-maximized size. The Size To Fit Form

command will be available.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Open the Customers form in Form view.

3. Maximize the Customers form.

4. Open the Window menu. Note that the Size To Fit Form command is

   not available.

REFERENCES

==========

For more information on sizing forms, search for "sizing forms" then "Size

to Fit Form Command (Window Menu)" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00 grey sizetofit sizetofitform

KBCategory:

KBSubcategory: FmsOthr


PRB: Stacker 3.0 CHECK.EXE Reports Database Files as Corrupt

Article ID: Q96995

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Running the Stacker version 3.0 CHECK.EXE program with the /=D and /F

switches often results in erroneous reports that Microsoft Access .MDB

files are corrupt and should be deleted. The /=D and /F switches are

meant only for development and debugging purposes and can incorrectly

identify files as corrupt.

RESOLUTION

==========

Do not run the CHECK.EXE program with the /=D switch. If you do run

CHECK.EXE with the /=D switch, choose No when you are prompted to

delete corrupt files.

MORE INFORMATION

================

STAC Electronics has created a document explaining the "lost sector

groups" reported by CHECK /=D. This file is called TEC042.DOC on

CompuServe and the STAC BBS, and document #3003 on STAC FAX, STAC

Electronics's automated fax response service.

Stacker is manufactured by STAC Electronics, a vendor independent of

Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

arguments options

Additional reference words: 1.00 1.10 2.00 WinIss third-party flags

parameters

KBCategory:

KBSubcategory: EvnOs


PRB: Stored procedure 'PROCEDURE' not found -- Error Message

Article ID: Q95061

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

----------------------------------------------------------------------

SYMPTOMS

========

You receive the error message:

   Stored procedure 'PROCEDURE' not found

The 'PROCEDURE' noted in the error message is the name of a  stored

procedure that cannot be found but is necessary to gain access to the

SQL Server.

CAUSE

=====

The SQL Server you are attempting to access is not set up correctly.

It is missing the required stored procedures.

RESOLUTION

==========

To correct this situation, install the necessary stored procedures on

the SQL Server by using the INSTCAT.SQL SQL script file supplied with

the Microsoft Access disk set.

MORE INFORMATION

================

Run INSTCAT.SQL to configure Microsoft SQL Server for use with ODBC,

the open database connectivity protocol used by Microsoft Access to

attach SQL Server tables. INSTCAT.SQL is the SQL script file that

ships with with ODBC. You need to run it to set up the stored

procedures that provide catalog information used by ODBC.

To install the catalog stored procedures using INSTCAT.SQL, run

INSTCAT.SQL using the SQL Server facility ISQL (Interactive SQL) from

the MS-DOS command line.

Following is the syntax for this procedure. Note that you need to

enter the two lines as one continuous line, and do not include the

angle braces <> in the command:

   ISQL /U <sa login name> /n /P <password> /S <SQL server name>

   /i <drive:\path\INSTCAT.SQL> /o <drive:\path\output file name>

   Following is a description for each switch:

   /U    Gives the system administrator's login name

   /n    Eliminates line numbering and prompting for user input.

   /P    Gives the system administrator's Password -- case sensitive

   /S    Gives the name of the server to set up.

   /i    Gives the drive and fully qualified path for INSTCAT.SQL

   /o    Provides the output file destination for results of the

         process including errors.

Here is a sample ISQL command line:

   ISQL /U sa /n /P SA_Password /S SQL_SERVER /i d:\SQL\INSTCAT.SQL

   /o d:\SQL\output.txt

After running INSTCAT.SQL, run the RECONFIGURE command against the

MASTER database by using the SQL Administration Facility (SAF) from an

MS-DOS client or the server, or run the SQL Administrator program

from a Microsoft Windows client.

Other Possible Causes for this Error Message

--------------------------------------------

It is possible that other situations can indirectly cause this error

message. Use the following steps to troubleshoot the problem:

1. Use File Manager to search for multiple, corrupted, or outdated

   copies of these files:

      ODBC.DLL - dated on or after 10-16-92 containing 44736 bytes

      DBNMP3.DLL - dated on or after 9-15-92 containing 8241 bytes

      SQLSRVR.DLL - dated on or after 10-16-92 containing 135792 bytes

      NETAPI.DLL - depends on the network being used

      COMMDLG.DLL - dated on or after 10-25-92 containing 89248 bytes

      NOTE: The sizes and dates referenced are correct if the files are

      installed by Microsoft Access version 1.0.

2. Make sure the files listed above are in appropriate locations. All

   the files except NETAPI.DLL are usually installed in the Windows

   System directory. The NETAPI.DLL file is a network specific driver

   that is usually located in the network's program directory, which

   should be in the path.

3. Use another application, such as Q+E, SAF, or PowerBuilder, on the

   same machine to attempt to attach the same data source. If you

   cannot access the data source from another application, there is

   probably a problem with the network. That is there may be a problem

   with the NETAPI.DLL file or a problem with the SQL database server,

   not with Microsoft Access or ODBC.

4. Attempt to attach another data source such as another SQL server.

   If you are successful, the original server may be down or you may

   need to reconfigure the entry for that server by using the ODBC

   Administration Utility.

5. Attempt to attach to the same data source from another machine. If

   you cannot gain access to the SQL database server from another machine,

   there could be a network wide problem or the server may be down or not

   communicating.

6. Try increasing your ODBC timeout settings in the ODBC section of

   the MSACCESS.INI file.

7. Check with the system administrator to see if the SQL database server

   is up, available for transactions, and operating correctly.

8. Reinstall ODBC after restarting the server and renaming the ODBC.DLL,

   DBNMP3.DLL, and SQLSRVR.DLL files.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Appendix D, "Setting up

Microsoft Access on a Network," pages 660-662

Microsoft SQL Server "Administrator's Guide," version 4.2, pages 205-

212

Additional reference words: 1.00 1.10 2.00 ODBC tshoot errsg

KBCategory:

KBSubcategory: ObcOthr


PRB: Subform Control's OnExit Event Not Activated

Article ID: Q109369

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A macro attached to the OnExit property of a control on a subform does not

run when the control is exited by selecting a control on the main form with

the mouse. The macro runs only if you select another control in the

subform.

CAUSE

=====

To activate the OnExit event of a control on a subform, you must select

another control on the subform.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new macro that uses the Msgbox action to display any text.

   Save the macro as Test.

3. Open the Categories Subform form in Design view.

4. Attach the Test macro to the Product Name control's OnExit property.

   Save and then close the form.

5. Open the Categories form in Form view. Select the Product Name field

   in the subform. Press ENTER and a message box with the text you entered

   in the macro in step 2 will appear.

6. Select the Product Name field again. Click anywhere in the main

   form. Note that the message box does not appear.

REFERENCES

==========

For more information about the OnEnter and OnExit properties, search for

"OnEnter" or "OnExit" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsProp


PRB: Subform Not Updated

Article ID: Q92676

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

As you scroll through records in the main form, your subform is not

updated. The records on the main form and the subform are not

synchronized.

CAUSE

=====

Your subform is not linked to the main form.

RESOLUTION

==========

You should use the LinkMasterFields and LinkChildFields form

properties to link your main form and subform automatically. You may

manually update the subform by pressing the F9 (recalculate) key.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Recalculation occurs automatically for controls that reference other

fields on the same form, or fields in subforms. Recalculation does not

occur automatically for subform controls that only reference fields on

the main (master) form, or in other subforms.

This is because subforms notify the master form of any changes, but

the master form does not notify the subforms of changes. Nor do

subforms on the same main form notify one another of any changes.

REFERENCES

==========

For more information, search for "Link: main form and subform" then

"function keys" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: FmsSubf


PRB: Subreport or Subform Data Missing from "Output To" Result

Article ID: Q112752

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Information in subforms and subreports is missing from files created

with the Output To command in Microsoft Access version 2.0.

CAUSE

=====

The Output To command does not support subforms and subreports.

RESOLUTION

==========

To output forms or reports containing subforms or subreports, open the

subform or subreport as a separate form or report and use the Output To

command to print that form or report independently.

If you must have the subform or subreport print with the main form or

report, you can direct the output to a text file using the Windows Generic

print driver attached to the FILE port.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open the Sales Summaries report in Design view.

3. Verify that there are two subreports in the detail section.

4. From the File menu, choose Output To. Select MS-DOS Text (*.txt) as

   the file type and then choose OK.

5. Choose OK.

6. Choose OK when you get the message "The Output To command will not

   process any subreports or subforms contained in your report.

   Proceed anyway?"

7. Open the text file created by the Output To command. It contains only:

      Sales Summaries

      15-Mar-94

      Employee Sales:

      Category Sales:

REFERENCES

==========

For a complete list of the functionality of each file type created by the

Output To command, search for "Output To" using the Microsoft Access Help

menu.

For more information about how to output Microsoft Access forms and reports

to text files, query on the following words here in the Microsoft Knowledge

Base:

   print and file and generic

Additional reference words: 2.00 OutputTo

KBCategory:

KBSubcategory: IntpOthr


PRB: System Error When Sharing Database on LAN Man/Workgroups

Article ID: Q100160

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you try to save a Microsoft Access database larger than 2000 bytes

(approximately 2 MB) on a Microsoft LAN Manager server with a boot

drive that uses the file allocation table (FAT) format, the following

error message appears:

   System error... Network error on drive <x>

This error occurs only on Microsoft Windows for Workgroups

workstations if you attempt to open a database already in use by a

Microsoft LAN Manager workstation or another Windows for Workgroups

workstation.

CAUSE

=====

The Microsoft LAN Manager server responds incorrectly to a request by

Windows for Workgroups to share the file. The server responds with a

message that is too long for Windows for Workgroups to process

correctly, resulting in an error from the NetBIOS.

RESOLUTION

==========

The following are two ways to work around this problem:

 - Change the format of the Microsoft LAN Manager server boot drive

   from FAT to high-performance file system (HPFS), then place the

   Microsoft Access database you want to share on the boot drive.

   -or-

 - Move the database to a Windows for Workgroups server.

Additional reference words: 1.00 1.10 2.00 W4W FAT HPFS NetBIOS boot drive

KBCategory:

KBSubcategory: GnlOthr


PRB: Type Conversion Failure when Importing Excel Data

Article ID: Q109376

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

 - Microsoft Excel for Windows, version 4.x

---------------------------------------------------------------------

SYMPTOMS

========

When you are importing a Microsoft Excel spreadsheet to a new table in a

Microsoft Access database, you receive the error message "Type Conversion

Failure."

CAUSE

=====

When you import a Microsoft Excel spreadsheet to a new table, Microsoft

Access checks the first row of the spreadsheet to determine the field

types for the new table. If the first row of the spreadsheet contains a

numeric value in a column that allows alphabetic and numeric characters,

Microsoft Access will define the field type in the table for that column

as numeric. If there are alphabetic characters in other rows in this

column in the spreadsheet, the error message stated above will occur.

RESOLUTION

==========

To work around this behavior, insert an extra row of data as the first

row in the spreadsheet. Insert alphabetic characters in any columns that

are defined as alphanumeric columns. Enter numeric characters in any

columns that are defined as numeric columns. Once you have imported the

spreadsheet into Microsoft Access, delete the extra row of data from the

spreadsheet and the table.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Export the Employees table as a Microsoft Excel spreadsheet named

   EMPLOYEE.XLS.

3. Open EMPLOYEE.XLS in Microsoft Excel.

4. Go to the first row of the Postal Code column. Type 98122 (without

   quotation marks) and press ENTER.

5. Close the spreadsheet and save your changes.

6. In Microsoft Access, import the spreadsheet as a new table. Make sure

   to select the First Row Contains Field Names check box in the Import

   Spreadsheet Options dialog box.

7. After the import is complete, an Import Errors table will appear in

   the Database window.

8. Open the Import Errors table. Note the "Type Conversion Failure" error

   for all postal codes that contain alphabetic characters.

REFERENCES

==========

For more information on setting the field type when you are importing

files into Microsoft Access, query on the following words here in the

Microsoft Knowledge Base:

   import and files and first and line

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmExl4


PRB: Unable to Change Permissions (Security)

Article ID: Q93718

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to open an object or change permissions for an account,

you receive one of the following error messages:

   You can't view this object's permissions.

   -or-

   No permission for <object name>.

CAUSE

=====

Only the database creator, or a member of the Admins group, has full

permissions to all database objects. This person is also the only user

who can assign security permissions.

RESOLUTION

==========

Contact your database administrator. If you are the database

administrator, check to make sure you are logged in as a user who is a

member of the Admins group. If you still have the original user Admin,

make sure it is a member of the Admins group and try again.

STATUS

======

This behavior is by design.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 25, "Administering a

Database System," pages 609-629

Microsoft Access "User's Guide," version 2.0, Chapter 14

For more information search for "Error Messages: Reference" using the

Microsoft Access Help menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ScrtOthr


PRB: Unable to Import Portion of Fixed-Width Text Files

Article ID: Q94417

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

You cannot import any portion of a fixed-width text file.

CAUSE

=====

Each record in a fixed-width text file must be separated from the next by a

carriage return and line feed, and all the records must contain the same

number of characters. The text file you are trying to import does not meet

these criteria.

RESOLUTION

==========

Modify the text file to ensure that all records meet these requirements:

 - Each record is on a different line.

 - Each record contains the same number of characters.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Microsoft Access cannot import fixed-width text records that are not

delimited by a carriage return or line feed.

Mainframe users may be familiar with long strings of data where the first x

number of characters are the first record, the next x number of characters

are the second record, and so on. In order to import these records into

Microsoft Access, you must ensure that each record is on its own line with

a carriage return and line feed at the end of each record.

For example, consider the following string of characters:

   lastnamefirstnameagelastnamefirstnameagelastnamefirstnameage

You cannot import these records into Microsoft Access without modification.

If you try to import the above string as a fixed-width text file, you will

either create an empty table or you will be unsuccessful and may need to

repair your database.

To modify the file, use Access Basic and follow these steps:

1. Read in the file in Binary mode with a fixed-length string that is the

   same length as the record.

2. Write each string to a new file that is open for sequential output.

3. Repeat steps 1 and 2 until you reach the end of file.

Microsoft Access can import the following records:

   lastnamefirstnameage

   lastnamefirstnameage

   lastnamefirstnameage

To import a file containing records like these, follow these steps:

1. From the File menu, choose Imp/Exp Setup.

2. Change the Text Delimiter from " to {none}.

3. Enter the following settings for Field Information:

      Field Name   Data Type   Start   Width

      --------------------------------------

      Last         Text        1       8

      First        Text        9       9

      Age          Number      18      3

4. Choose OK, and save this specification as TEST.

5. From the File menu, choose Import.

6. Select Text (Fixed-Width), then choose OK.

7. Select the text file you want to import, then choose Import.

8. In the Import Text Options dialog box, select the TEST specification.

   Choose OK.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 4, "Importing,

Exporting, and Attaching," pages 75-81

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: IsmTxtfx


PRB: UndoCurrentRecord In BeforeUpdate Property Causes Error

Article ID: Q97525

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTONS

========

If you create a macro that contains a DoMenuItem action that chooses

Undo Current Record from the Edit menu, and you run the macro from a

form's BeforeUpdate property, Microsoft Access generates the following

message when you edit data in the form:

   Command not available: UndoCurrentRecord.

However, if you select the Edit menu, Undo Current Record is available

and works properly.

CAUSE

=====

The Undo Current Record command is not available for use with a macro

run from a form's BeforeUpdate property.

RESOLUTION

==========

In your macro, enter CancelEvent as the first action, then follow that with

the SendKeys action to send an ESC key. (This has the same effect as

choosing the Undo Current Field command from the Edit menu.)

MORE INFORMATION

================

Page 48 of the Microsoft Access "Language Reference," versions 1.0 and 1.1,

discusses uses for this type of macro in the BeforeUpdate property, and

indicates that calling Undo Current Record works correctly in such a macro.

This is not the case. Calling Undo Current Record causes the error message

above and should not be used.

REFERENCES

==========

Microsoft Access "Language Reference," versions 1.0 and 1.1, "BeforeUpdate,

AfterUpdate Properties," pages 47-48

Additional reference words: 1.00 1.10 2.00 errmsg docerr

KBCategory:

KBSubcategory: McrActn


PRB: Unexpected Cursor Behavior in Text Box with Input Mask

Article ID: Q114507

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you click in a text box that has a defined InputMask property, the

insertion point remains where it was in the text box when you clicked the

mouse button, instead of moving to the beginning of the text box.

RESOLUTION

==========

Press F2 to place the cursor at the beginning of the text box, or use the

TAB key to navigate to the text box instead of clicking in the text box.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

An input mask uses predefined place holders in the text box. If you tab to

the text box, the insertion point is placed at the beginning of the input

mask. If you enter the text box by clicking in it, the insertion point

remains where it was when you clicked the mouse button.

You can make the insertion point move to the beginning of the text box by

automatically pressing F2 when a text box is entered. To do this, create a

macro with the following action and call it from the text box's OnEnter

property:

   SendKeys

      Keystrokes: {F2}

      Wait: No

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 24, "Macro Basics,"

and Chapter 26, "Using Macros with Forms"

Additional reference words: 2.00

KBCategory:

KBSubcategory: FmsProp


PRB: Unexpected Results with Make-Table or Append Query

Article ID: Q90879

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Using a make-table (SQL Select...Into) or an append (SQL Insert...Into)

query with criteria that have no matching records causes an empty table to

be created. In Microsoft Access version 1.x, if the empty table contains a

counter field, the first record added to the table will have a counter

value of 1. In Microsoft Access version 2.0, the first record added will

have a counter value of 2.

CAUSE

=====

This behavior is by design.

REFERENCES

==========

For more information about make-table or SELECT INTO queries, search for

"make-table query" or "SELECT INTO (SQL)" using the Microsoft Access Help

menu.

For more information about append or INSERT INTO queries, search for

"append queries" or "INSERT INTO (SQL)" using the Microsoft Access Help

menu.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: QryMktbl


PRB: Union Queries Do Not Inherit Properties of Base Table

Article ID: Q113875

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

A union query does not inherit the properties of the tables or queries

that the union query is based on.

CAUSE

=====

When you run a union query, the fields are displayed with the default

formats for the data types specified in the first table in the query.

RESOLUTION

==========

To work around this problem, create a select query based on the union

query, and then apply formatting in the select query.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Open the sample database NWIND.MDB

 2. Open the Orders table in Design view.

 3. Change the format of the Order Date field to Long Date.

 4. Save and then close the Orders table.

 5. In the Database window, select the Orders table. Then, choose

    Copy from the Edit menu.

 6. From the Edit menu, choose Paste. In the Table Name box, type "Orders2"

    (without quotation marks). Make sure that the Structure And Data option

    button is selected, and then choose OK.

 7. Create a new, unbound query.

 8. From the Query menu, choose SQL Specific, then choose Union.

 9. In the Union Query window, enter the following SQL statement:

    NOTE: In the following sample SQL statement, an underscore (_) is used

    as a line-continuation character. Remove the underscore when re-

    creating this statement.

       SELECT [Ship Name], [Order Date] FROM Orders UNION ALL SELECT _

       [Ship Name], [Order Date] FROM Orders2;

10. Run the query by choosing the Datasheet View button on the toolbar.

    Note that the format for the Order Date field is Short Date, which

    is the default format for Date/Time fields.

To create a formatted select query based on the union query, follow these

steps:

11. Save the query as Union Without Format.

12. Create a new query based on the Union Without Format query.

13. Drag the Ship Name field from the field list to the query grid.

14. Enter the following expression in the second Field cell:

       Format([Order Date],"mmmm dd, yyyy")

15. Run the query by choosing the Run button on the toolbar. Note the

    format for the Order Date field.

REFERENCES

==========

For more information about union queries, search for "union query" using

the Microsoft Access Help menu.

Microsoft Access "User's Guide," version 2.0, Chapter 12, "Advanced

Queries"

Additional reference words: 2.00

KBCategory:

KBSubcategory: QryOthr


PRB: Unknown Reference or Function in Validation Expression

Article ID: Q113298

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to save a table that has a field name, control name, or user-

defined function in a validation rule or default value, you receive the

error message:

   Unknown or invalid reference '<field>' in validation

   expression or default value in table '<Table>'.

   -or-

   Unknown function '<function>' in validation expression or

   default value in '<Table>'.

CAUSE

=====

Validation rules are enforced by the Microsoft Access Jet database engine

in Microsoft Access version 2.0. There are some rules allowed in Microsoft

Access versions 1.0 and 1.1 that are not allowed at the field level in

Microsoft Access 2.0. In version 2.0, validation rules at the field level

cannot refer to other fields (whether in the current table or another

table), controls on a form, or user-defined functions.

RESOLUTION

==========

To get the validation rule you want, create the rule at the table level

instead of the field level. Note that validation rules on a form can refer

to other controls on the form.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and either create a new database or open one

   of your choosing.

2. Create a new table.

3. Add two text fields named ABC and DEF to the table.

3. Set the ValidationRule property of the DEF control to:

      <[ABC]

4. Save the table (do not define a primary key). You will receive one of

   the error messages stated above.

Additional reference words: 2.00 Tables

KBCategory:

KBSubcategory: TblDsign


PRB: Update Query Based on Totals Query Fails

Article ID: Q116142

---------------------------------------------------------------------

 The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you run an update query, you receive the following error message:

   Operation must use an updatable query.

CAUSE

=====

This error message occurs when the values in the query's Update To row are

fields in either a crosstab query or a select query or subquery that

contains totals or aggregate functions. The error message indicates that

the records in the totaling query cannot be updated.

RESOLUTION

==========

There are two methods of working around this behavior. The first method

uses a temporary, or intermediate, table to hold the results of the

totaling query. The second method uses a domain function instead of a

totaling query.

Method 1: Using a Temporary Table

---------------------------------

This method stores the results of the totaling query in an intermediate

table, which is then used in the update query. The following example

demonstrates this method.

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open the Products table in Design view.

3. Add a new field called Sales So Far to the table. Give the field a

   Currency data type. Save and then close the table.

4. Create a new query based on the Order Details table. Add the following

   fields to the query:

      Field: Product ID

         Total: Group By

      Field: SumPerProduct: [Unit Price]*[Quantity]

         Total: Sum

   NOTE: To see the Total field, click the Totals button on the toolbar, or

   choose Totals from the View menu.

   From the Query menu, choose Make Table. In the Make New Table box,

   type "SalesSoFar Test" (without quotation marks). Save the query as

   Query1, and then run the query.

5. Create a new query based on the SalesSoFar Test and the Products tables.

6. Add the Sales So Far field (from the Products table) to the query grid.

7. From the Query menu, choose Update.

8. In the Update To field in the Sales So Far column, enter the following

   line:

      [SumPerProduct]

9. Run the query. You will receive a message stating "77 row(s) will be

   updated." Choose OK. The SumPerProduct information will be written to

   the Sales So Far field in the Products table.

Method 2: Using a Domain Function to Calculate the Update To Values

-------------------------------------------------------------------

This method uses a domain function instead of a totaling query and does not

require the use of an intermediate table. This method may take longer than

the first method if the table being totaled is large. The following example

demonstrates this method.

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open the Products table in Design view.

3. Add a new field called Sales So Far to the table. Give the field a

   Currency data type. Save and then close the table.

4. Create a new query based on the Products table, and then choose

   Update from the Query menu. Add the following field to the query.

   NOTE: In the following sample field, an underscore (_) at the end of a

   line is used as a line-continuation character. Remove the underscore

   from the end of the line when re-creating this field.

      Field: Sales So Far

         Update To: DSum("[Quantity]*[Unit Price]","Order _

                    Details","[Product ID]=" & [Product ID])

5. Run the query. You will receive a message stating "77 row(s) will be

   updated." Choose OK. The information will be written to the Products

   table.

STATUS

======

This behavior is a design limitation. Changes to this behavior are being

reviewed and will be considered for inclusion in a future release of

Microsoft Access.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

CAUTION: Following the steps in this example will modify the sample

database NWIND.MDB. You may want to back up the NWIND.MDB file, or perform

these steps on a copy of the NWIND database.

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Open the Products table in Design view.

3. Add a new field called Sales So Far to the table. Give the field a

   Currency data type. Save and then close the table.

4. Create a new query based on the Order Details table. Add the following

   fields to the query, and then save the query as Query1:

      Field: Product ID

         Total: Group By

      Field: SumPerProduct: [Unit Price]*[Quantity]

         Total: Sum

   NOTE: To see the Total field, click the Totals button on the toolbar, or

   choose Totals from the View menu.

   This query creates a list of all the products sold (grouped by the

   Product ID), and the total dollar amount from those sales.

5. Create a new query based on Query1 and the Products table.

6. Add the Sales So Far field (from the Products table) to the query grid.

7. From the Query menu, choose Update.

8. In the Update to field in the Sales So Far column, enter the following

   line:

      [SumPerProduct]

9. Run the query. You will receive the error message stated above.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 13, "Changing Data

with Action Queries," pages 311-312

For additional information about using domain functions, please see the

following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q103403

   TITLE     : INF: Custom Domain Functions Similar to DFirst() and DLast()

   ARTICLE-ID: Q108098

   TITLE     : INF: DLookup() Usage, Examples, and Troubleshooting Tips

Additional reference words: 1.00 1.10 2.00 querying updating errmsg

KBCategory:

KBSubcategory: QryUpdat


PRB: Update Query on More than One Table Gives Inaccurate Data

Article ID: Q103990

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

An update query that attempts to update more than one table may yield

inaccurate results.

RESOLUTION

==========

This behavior is by design. You cannot update more than one table in

an update query.

MORE INFORMATION

================

If an update query in Microsoft Access is used to update two (or more)

tables on the "many" side of a relationship, the resulting updated

fields will be multiples of the updated value. Each value will be

updated one time for each updated record in the corresponding table.

Steps to Reproduce Behavior

---------------------------

1. Create the following three tables:

      Table: Vendors

      -----------------

      FieldName: Name

         DataType: Text

      Table: New Parts

      --------------------

      FieldName: Item

         DataType: Text

      FieldName: Vendor

         DataType: Text

      FieldName: Cost

         DataType: Number

      Table: Rebuilt Parts

      --------------------

      FieldName: Item

         DataType: Text

      FieldName: Vendor

         DataType: Text

      FieldName: Cost

         DataType: Number

2. Add the following two records to the Vendors table:

      Name

      ----

      Bob

      Jill

3. Enter the following three records to the New Parts table:

      Item      Vendor       Cost

     -----------------------------

     fender      Bob        100.00

     hood        Jill        50.00

     trunk       Bob        100.00

4. Enter the following four records in the Rebuilt Parts table:

     Item       Vendor      Cost

     ----------------------------

     Pump        Bob        10.00

     Fan         Jill       45.00

     Pulley      Bob        20.00

     Piston      Bob        30.00

5. Create the following query based on the three tables that you

   created above:

      Query:  Example Query

      ---------------------------------------------------

      Type: Update Query

      Join: [New Parts].[Vendor] <-> [Vendors].[Name]

      Join: [Rebuilt Parts].[Vendor] <-> [Vendors].[Name]

      Field: Name

         Table: Vendors

         Criteria: "Bob"

      Field: Cost

         Table: New Parts

         Update To: [New Parts].[Cost] * 2.0

      Field: Cost

         Table: Rebuilt Parts

         Update To: [Rebuilt Parts].[Cost] * 2.0

6. Run the query, then save and close it.

7. Open the Rebuilt Parts table.

   Note that the costs for items listing Bob as the vendor have been

   updated to four times their original values, rather than to two

   times, as specified in the update query. Each updated record in the

   Rebuilt Parts table has been updated once for each updated record

   in the New Parts table.

8. Open the New Parts table.

   Note that the costs for items listing Bob as the vendor have been

   updated to eight times their original values, rather than to two

   times, as specified in the update query. Each updated record in the

   New Parts table has been updated once for each updated record in

   the Rebuilt Parts table.

This effect is called a cross product, in which the values in Table B

are updated one time for each item meeting the same criteria in Table

A.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 174-178

Additional reference words: 1.00 1.10 2.00 action

KBCategory:

KBSubcategory: QryMktbl


PRB: User Needs Read/Write Privileges for WORKDIR Directory

Article ID: Q117912

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you start Microsoft Access on a network workstation, you receive the

following error messages:

   Could not open SYSTEM.MDA

   -and-

   Can't find SYSTEM.MDA

Or, you receive the following compile error messages while Microsoft Access

is loading the add-ins:

   Compile time error

   -and-

   Tried to load module with duplicate procedure name

CAUSE

=====

Microsoft Access was installed on a network server with the WORKDIR

directory set to Read Only.

RESOLUTION

==========

Make sure that all Microsoft Access users have at least Read and Write

privileges for the WORKDIR directory.

MORE INFORMATION

================

When you start Microsoft Access on a network workstation, you need to have

write privileges for the following .MDA files in the WORKDIR directory on

the server: SYSTEM.MDA, UTILITY.MDA, and WIZARD.MDA.

To verify that the problem you are having is due to incorrect privileges

for the WORKDIR directory, follow these steps:

1. Set the attributes for the WORKDIR directory (not just the individual

   files) to Read/Write.

2. Use a supervisory-level login to start Microsoft Access on the

   workstation.

REFERENCES

==========

For more information about network installations, see the "Network

Installations" topic in the ACREADME.HLP file (in the ACCESS directory).

Additional reference words: 2.00

KBCategory:

KBSubcategory: IntpOthr


PRB: User with Full Permissions Cannot Change a Query

Article ID: Q95328

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

After changing a query definition, you try to save the query but cannot,

even though you have full permissions on the query and are a member of the

Admins group.

CAUSE

=====

Queries have a property called Run With Owner's Permissions. You can see

it in the Query Properties dialog box. If it is selected, only the owner

of the query can save it. Allowing someone else to make changes would

be a security violation.

RESOLUTION

==========

Nobody other than the query owner (the person who created it) can save

the query as long as this property is set. To allow anyone with Modify

Definition permissions to save changes to a query, you need to clear

the Run With Owner's Permissions check box.

REFERENCES

==========

Microsoft Access "User's Guide," version 2.0, Chapter 14

Microsoft Access "User's Guide," version 1.0, Chapter 25, "Administering a

Database System," pages 625-629

Additional reference words: 1.00 1.10 2.00 permissions adk checkpage

KBCategory:

KBSubcategory: ScrtOthr


PRB: Using "MSACCESS" in DDE Initiate with Run-Time App

Article ID: Q101372

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Applications can initiate a dynamic data exchange (DDE) conversation

with a run-time application developed with Microsoft Access by specifying

"MSACCESS," rather than the .MDB file, as the application name.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

To communicate with a run-time application using DDE, it is strongly

recommended that you use the name of the .MDB file, not "MSACCESS,"

as the application name when you are initiating a DDE conversation.

The run-time version of Microsoft Access responds to both Microsoft Access

and the name of the .MDB file as the application name.

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. In the Database window, choose the Macro button and select Sample

   AutoExec from the list.

3. From the File menu, choose Rename. In the Macro Name box, type

   "AutoExec" (without quotation marks) and press ENTER.

4. Quit Microsoft Access.

5. In Windows Program Manager, choose Run from the File menu.

6. Type the following and press ENTER:

      C:\<ACCESS>\MSARN100.EXE NWIND.MDB

   where <ACCESS> is your Microsoft Access program directory.

7. Start Microsoft Access again and create a new database, or open a

   database other than NWIND.MDB.

8. Create or open a module and add the following Access Basic

   function:

      Option Explicit

      Function DDEWithNWIND ()

         Dim chan

         chan = DDEInitiate("MSACCESS", "NWIND;TABLE Employees")

         MsgBox DDERequest(chan, "FirstRow")

         DDETerminate chan

      End Function

9. From the View menu, choose Immediate Window. Type the following and

   press ENTER:

      ? DDEWithNWIND()

   A message containing the first record from the Employees table in

   NWIND.MDB is displayed.

NOTE: The run-time application responds correctly to the DDEInitiate()

statement that reads:

   chan = DDEInitiate("NWIND", "NWIND;TABLE Employees")

Additional reference words: 1.10 2.00 ADK

KBCategory:

KBSubcategory: DcmNwd


PRB: Val() Function Returns "Invalid Use of Null" Message

Article ID: Q90722

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

If you create a function that uses the Access Basic function Val() and

evaluates a null field on a form, the following error message is

generated:

      Invalid Use of Null

RESOLUTION

==========

The Val() function is giving an expression evaluation error when NULL

fields are encountered.

The Val() function returns the numeric value of a string of

characters.

STATUS

======

This behavior is by design.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, page 489

Additional reference words: 1.00 1.10 2.00 null error checkpage

KBCategory:

KBSubcategory: PgmOthr


PRB: Validation Rules Evaluate Expressions in Unexpected Ways

Article ID: Q104972

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access evaluates expressions with logical operators differently

than you expect. For example, entering zero in a field with the validation

rule "=true and not true" produces the error message:

   The value you entered is prohibited by the validation rule set for

   this field.

CAUSE

=====

Microsoft Access evaluates expressions in parts, and compares each part to

the value in the field being validated. The expression "=true and not true"

is evaluated as:

   Field=True AND Field<>True

This results in the error message stated above if you enter zero in the

field because the validation fails.

RESOLUTION

==========

Use parentheses in the expression to change the way it is evaluated. The

correct syntax for the example above is:

   =(True AND NOT True)

Microsoft Access will interpret this expression as:

   Field=(True AND NOT True)

Zero is an acceptable value for a field with the above validation rule.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open a new, blank form in Design view.

2. Add a text box with the following validation rule to the form:

      Text box: Field1

         Validation rule: =True and not True

3. View the form in Form view.

4. Enter a zero in the text box and then press ENTER. An error message will

   occur.

Additional reference words: 1.00 1.10 2.00 Boolean bitwise math

KBCategory:

KBSubcategory: GnlValid


PRB: Wait Argument in SendKeys May Not Stop Macro Processing

Article ID: Q95449

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When a macro calls the SendKeys action with the Wait parameter set

to Yes, the macro will continue before the program that processed

the keystrokes has finished performing the action that it was

called to do.

RESOLUTION

==========

To work around this issue, have the macro call an Access Basic

function or procedure that checks to see if the other application

is finished. To correct the situation described above, you can do

the following:

   Macro Action

   ------------

   RunApp                - Start Microsoft Excel

   SendKeys              - Start the macro

   RunCode               - Call a module that continues checking until

                           the file exists

   TransferSpreadsheet   - Import the spreadsheet

MORE INFORMATION

================

For example, suppose you want to create a macro that will call Microsoft

Excel to make a file and then process that file once Microsoft Excel has

created it. The Microsoft Access macro calls RunApp to start Microsoft

Excel, then calls SendKeys to start a Microsoft Excel macro with the Wait

parameter set to Yes. Microsoft Access will wait until the key strokes are

processed, then continue if the Microsoft Excel macro has not finished

creating the file. Microsoft Access will not wait for Microsoft Excel, and

will fail when it tries to use the file.

The SendKeys action in Microsoft Access has two arguments: the first

argument indicates which keystrokes to send; the second argument causes

Microsoft Access to pause until the keystrokes are processed.

The description of the Wait argument on page 432 of the Microsoft Access

"Language Reference" manual is misleading. If Wait is Yes, Microsoft Access

will only wait until the keystrokes are processed. It will not wait until

the application that the keystrokes were sent to is finished.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 433-435

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: McrArg


PRB: White Lines or Missing Data When Printing Reports

Article ID: Q103180

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The following problems can occur when you are printing from Microsoft

Access using the Canon BJC800 or BJ10E printer drivers:

 - Horizontal white lines appear on the report.

 - Portions of the text are not printed.

 - You can only print the report using a lower resolution than normal.

 - You can only print color reports in monochrome.

 - You can only print the report one page at a time, rather than

   printing the whole document at once.

NOTE: These problems can occur with other printer drivers also.

CAUSE

=====

These problems are due to an interaction between the way Microsoft

Windows sends data to the printer, and the amount of time the printer

needs to interpret the data. Microsoft Access treats lines or borders

as a bitmap or large graphic, and the printer needs more time to

interpret the data.

RESOLUTION

==========

Change the default settings for the printer in the Microsoft Windows

Control Panel. Choose the Printers icon in the Control Panel, and then

choose Connect. Make the following entries in the Timeouts (seconds)

box:

   Option                 Setting

   ------------------------------

   Device Not Selected    15

   Transmission Retry     90

The default setting for Device Not Selected is 15, and Transmission

Retry is 45. These settings may need to be increased even further, to

30 and 120 or higher for printing complex graphics images, or for

printing over a network.

Additional reference words: 1.00 1.10 2.00 PtrIss whitespace

KBCategory:

KBSubcategory: PtrProb


PRB: Workstation Setup Option Not Available with DEC Pathworks

Article ID: Q116064

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The Workstation Installation option is not available when you are trying to

set up a workstation after setting up a DEC Pathworks server using the

SETUP /A command.

RESOLUTION

==========

To solve this problem, place a semicolon (;) at the beginning of the

following line in the [MS Setup (ACME) Table File] section of your WIN.INI

file:

   MSACCESS.EXEv2.00.0010.0USA=C:\ACCESS\SETUP\setup.stf

MORE INFORMATION

================

When you try to set up a network installation of Microsoft Access to a DEC

Pathworks workstation that already has Microsoft Access installed locally,

the local Setup always runs, even though you are connected to a server and

running Setup from a shared network directory.

Steps to Reproduce Behavior

---------------------------

1. Install Microsoft Access locally on a DEC Pathworks workstation.

2. From the workstation, install Microsoft Access to a DEC Pathworks server

   using the SETUP /A command.

3. Connect to the server from the workstation and run Setup from the

   server. Instead of the Setup screen that you expect, the installation

   maintenance program screen appears.

REFERENCES

==========

For more information, see the "Network Installations" section of the

ACREADME.HLP file.

Additional reference words: 2.00

KBCategory:

KBSubcategory: StpNet


PRB: Zoom Box Does Not Appear When SHIFT+F2 Is Pressed

Article ID: Q103175

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Pressing SHIFT+F2 does not bring up a zoom box. In Microsoft Access,

pressing SHIFT+F2 should display the expression zoom box for easy

viewing and editing of expressions.

CAUSE

=====

Possible causes for this problem include:

 - Low system resources within Microsoft Windows.

 - A damaged .LDB file.

 - Syntax errors in any of the modules in the database.

RESOLUTION

==========

Low System Resources

--------------------

To free up system resources, close as many running applications as

possible. Note that some applications and drivers return fewer

resources to Microsoft Windows when they close than they originally

requested. Over time, this behavior can cause a low system resources

situation. In these cases you may need to restart Microsoft Windows in

order to refresh system resources.

To check Microsoft Windows system resources while running Microsoft

Access, press CTRL+ESC, and then select Program Manager from the Task

List dialog box. From the Help menu, choose About Program Manager. The

About Program Manager dialog box will display the amount of available

system resources.

Damaged .LDB File

-----------------

Microsoft Access may generate an .LDB file for a database. The .LDB

file maintains lock information about the database. Occasionally, this

file becomes damaged and causes problems that include preventing the

zoom box from appearing. If you suspect the .LDB file of being

damaged, close the database, and then delete the associated .LDB file.

The .LDB file will be named <DBName>.LDB, where <DBName> is the same

name as the database. Microsoft Access will create a new .LDB file for

the database if necessary.

Syntax Errors in Modules

------------------------

The zoom box is a Microsoft Access form, coded in Access Basic.

Microsoft Access will not run any code if the compiler contains syntax

errors. If you suspect that a module may contain syntax errors, try

compiling the code in a Microsoft Access module to find the errors. In

Microsoft Access version 2.0, you will receive the error message

   Access Basic Compile Error.  View Error in Context?

when you try to bring up the zoom box.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: ExrOthr


WX0994: Form and Report Questions and Answers

Article ID: Q114809

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

The "Form and Report Questions and Answers" (WX0994) Application Note

contains questions and answers about Microsoft Access version 2.0 forms and

reports.

You can obtain this Application Note from the following sources:

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note"

section at the end of this article.

THE TEXT OF WX0994

==================

======================================================================

  Microsoft(R) Product Support Services Application Note (Text File)

             WX0994: FORM AND REPORT QUESTIONS AND ANSWERS

======================================================================

                                                   Revision Date: 3/94

                                                      No Disk Included

The following information applies to Microsoft Access(R) version 2.0.

-----------------------------------------------------------------------

| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY     |

| ACCOMPANY THIS DOCUMENT (collectively referred to as an Application |

| Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER      |

| EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED      |

| WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR       |

| PURPOSE. The user assumes the entire risk as to the accuracy and    |

| the use of this Application Note. This Application Note may be      |

| copied and distributed subject to the following conditions:  1) All |

| text must be copied without modification and all pages must be      |

| included;  2) If software is included, all files on the disk(s)     |

| must be copied without modification (the MS-DOS(R)  utility         |

| diskcopy is appropriate for this purpose);  3) All components of    |

| this Application Note must be distributed together;  and  4) This   |

| Application Note may not be distributed for profit.                 |

|                                                                     |

| Copyright (C) 1994 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

|---------------------------------------------------------------------|

1.  Q. Why is the data sorted in my query but not in my report?

    A. Reports create their own internal queries to present the data.

       If you want to have the data in your report presented in a

       particular order, you must explicitly set the sort order in the

       Sorting And Grouping dialog box. To do this, open the report in

       Design view, then choose Sorting And Grouping from the View

       menu.

2.  Q. How can I keep a group of records together on a report?

    A. The new KeepTogether property for groups in Microsoft Access

       version 2.0 gives you the ability to keep groups of like

       information together. This property is available in the Sorting

       And Grouping dialog box for reports. Using this property, you

       can keep an entire group together (including the group header,

       all records, and the group footer), or keep the group header

       with the first record.

       For more information about sorting and grouping, please see the

       Microsoft Access "User's Guide," version 2.0, Chapter 22,

       "Sorting and Grouping Data."

3.  Q. Why is every other page of my report blank, and how can I

       correct this problem?

    A. This problem occurs when the total width of your report exceeds

       the width of the paper specified in the Print Setup dialog box.

       For example, blank pages print if your report form is 8 inches

       wide and your left and right margins are 1 inch wide for a

       total width of 10 inches, and if the paper size specified in

       the Print Setup dialog box is only 8.5 inches wide.

       Using this example, if controls (such as text boxes) extend

       beyond 8.5 inches, the controls are printed on a second page.

       Otherwise, you receive a warning message stating that some

       pages may be blank. Blank pages generated after the warning are

       not counted in the total pages of your report.

       For additional information about preventing blank pages, you

       can order item number Q95920 by selecting the FastTips

       Technical Library option from the FastTips Main Menu.

4.  Q. What is an event procedure? Can I still call an Access

       Basic function from my form or report?

    A. Event procedures are Access Basic functions that respond to

       events (such as a mouse click) that occur on forms and reports.

       Event procedures are stored in form or report modules attached

       to the form or report, and are incorporated into the form or

       report's design structure. You can also call an Access Basic

       function stored in a separate module from an event property.

       For more information about event procedures, order the fax or

       mail copy of this script.

        - Event procedures are private procedures--only the form or

          report to which an event procedure is connected can call or

          use that event procedure. If you want another form or report

          to use the same procedure, make the procedure a global

          function by storing it in a module. Functions stored in

          modules are available to all forms and reports.

        - Since event procedures are private, or locally scoped, you

          can use the Me property to refer to the form or report,

          rather than using the full syntax (such as Forms![form

          name]...) to refer to the form or report.

        - Form and report modules are loaded only when the form or

          report is open. If you want to compile the procedure or

          search in the module, you must first open the form or

          report.

       To call an Access Basic function from a property, enter the

       following in the property:

          =MyFunctionName()

       NOTE: The equal sign and parentheses are required.

       To create an event procedure, choose the Build button in the

       property sheet, choose the Code Builder, and write the code for

       that event. When you complete and close the code, you will see

       [Event Procedure] displayed in the property sheet, which

       indicates that the event has code written for it.

       For more information about writing and using event procedures,

       see the Microsoft Access "Building Applications" manual,

       version 2.0, Chapter 3, "Introduction to Access Basic," and

       Chapter 5, "Access Basic Fundamentals."

5.  Q. How can I print a page number that includes the full

       number of pages in the report on each page of a report?

    A. You can use the Page and the Pages properties to create a "Page

       X of Y" expression. The following example, used as a text box's

       ControlSource property, will print a "Page X of Y" page number

       on each page of the report:

          ="Page " & Page & " of " & Pages

6.  Q. Why do I get the message "#Error" in some controls on my

       form or report? How do I reference a control on a subform or

       subreport?

    A. Microsoft Access displays the "#Error" message in a field or

       text box when it cannot find necessary information, execute an

       expression, or store a value within the field's defined limits.

       "#Error" is not the only possible error message for these

       conditions. For additional information about troubleshooting

       "#Error" messages, you can order item number Q112103 by

       selecting the FastTips Technical Library option from the

       FastTips Main Menu.

7.  Q. Do form validation rules override table validation rules?

       When are the validation rules on a form evaluated?

    A. In Microsoft Access 2.0, table validation rules are always

       enforced, no matter how you add or edit data. Form validation

       rules do not override table validation rules, but can be used

       in addition to table validation rules.

       When you enter or edit data in a form and then move the

       insertion point to a different field or record, the form

       validation rule is evaluated first. If the data passes this

       validation test, the table validation is evaluated. Therefore,

       you can use form validation to refine table validation.

       Since validation rules are evaluated only when data is added or

       edited, you may want to use the new Required property to force

       users to enter a value. The Required property prevents users

       from tabbing out of and not changing a field.

       For additional information about the Required property, search

       for "Required" then "Required Property" using the Microsoft

       Access Help menu.

8.  Q. When is it appropriate to use an exclamation point (!)

       versus a period (.) for identifying objects and properties in

       an expression?

    A. Use an exclamation point before anything you specifically name,

       such as the name of a form or a control on a form, and use a

       period before anything Microsoft Access names, such as a

       property.

       In Microsoft Access version 1.x, you can use a period to

       reference a field name, such as "MyTable.Name" to refer to the

       Name field in the table MyTable. If, however, you use this same

       expression in Microsoft Access 2.0, you refer to the Name

       property, rather than the field called Name. To prevent this,

       use "MyTable!Name" in Microsoft Access 2.0.

9.  Q. How do I turn off the ControlWizards?

    A. ControlWizards help you create list boxes, combo boxes, option

       groups, and command buttons. Once you are comfortable working

       with these controls, you may want to turn off the

       ControlWizards instead of having to cancel them each time you

       add one of these controls. To turn off the ControlWizards,

       either choose ControlWizards from the View menu to clear the

       check mark, or choose the ControlWizards button in the toolbox

       to toggle the button off.

10. Q. How can I check for duplicate records immediately after I

       enter a value in a primary key field?

    A. Normally, Microsoft Access does not check the values in primary

       key fields for duplicates until you move to the next record. If

       you want to check for duplicate values immediately after

       entering a value in a primary key field, use a macro in the

       field's AfterUpdate property. The macro should use the

       DLookup() function to check for duplicates and then display an

       appropriate message.

       For additional information about checking for duplicate primary

       keys, you can order item number Q102527 by selecting the

       FastTips Technical Library option from the FastTips Main Menu.

---------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

===============================

 - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call

   24 hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can

   have this Application Note mailed or faxed to you by calling

   Microsoft Product Support Services Monday through Friday, 6:00 A.M.

   to 6:00 P.M. Pacific time at (206) 635-7050. If you are outside the

   United States, contact the Microsoft subsidiary for your area. To

   locate your subsidiary, call Microsoft International Customer

   Service at (206) 936-8661.

Additional reference words: 2.00 appnote

KBCategory:

KBSubcategory: Fstqa


WX0995: Table and Query Questions and Answers

Article ID: Q114810

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

The "Table and Query Questions and Answers" (WX0995) Application Note

contains questions and answers about Microsoft Access version 2.0 tables

and queries.

You can obtain this Application Note from the following sources:

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note"

section at the end of this article.

THE TEXT OF WX0995

==================

======================================================================

  Microsoft(R) Product Support Services Application Note (Text File)

             WX0995: TABLE AND QUERY QUESTIONS AND ANSWERS

======================================================================

                                                   Revision Date: 3/94

                                                      No Disk Included

The following information applies to Microsoft Access(R) version 2.0.

-----------------------------------------------------------------------

| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY     |

| ACCOMPANY THIS DOCUMENT (collectively referred to as an Application |

| Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER      |

| EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED      |

| WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR       |

| PURPOSE. The user assumes the entire risk as to the accuracy and    |

| the use of this Application Note. This Application Note may be      |

| copied and distributed subject to the following conditions:  1) All |

| text must be copied without modification and all pages must be      |

| included;  2) If software is included, all files on the disk(s)     |

| must be copied without modification (the MS-DOS(R)  utility         |

| diskcopy is appropriate for this purpose);  3) All components of    |

| this Application Note must be distributed together;  and  4) This   |

| Application Note may not be distributed for profit.                 |

|                                                                     |

| Copyright (C) 1994 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

|---------------------------------------------------------------------|

1.  Q. How have queries changed in Microsoft Access version 2.0?

    A. Queries are now more flexible and are easier to create. The new

       QueryWizards--Crosstab, Find Duplicates, Find Unmatched, and

       Archive--help you quickly create complex queries for managing

       your data.

       There are also three new SQL-specific queries. These are union

       queries, data-definition queries (queries that create, change,

       or delete tables and indexes in Microsoft Access databases),

       and SQL pass-through queries (queries that pass SQL statements

       directly to a SQL database, providing improved connectivity in

       client-server relationships).

       In addition, improvements in updating in multiple-table queries

       and the addition of TopValues queries and subqueries give you

       greater query functionality.

2.  Q. When I add two tables to my query that do not have a

       defined relationship, Microsoft Access automatically joins

       them. Can I prevent this from happening?

    A. Microsoft Access 2.0 automatically joins two tables in a query

       if the tables meet the following criteria:

        - There is no relationship defined between the tables.

        - Each table contains at least one field whose name and data

          type matches the name and data type of a field in the other

          table.

        - One of the tables has a primary key defined on the matching

          field.

       Only one AutoJoin is automatically created between two tables.

       Even if there is more than one join possible between the two

       tables, a join is created only between the first fields that

       meet the above criteria. If you add three tables that meet the

       above criteria to a query, three joins are created--one for

       each table pair.

       You cannot turn this functionality off. You must either delete

       the join line after it is created or manually define a

       relationship between the two tables.

3.  Q. How does the new Relationships window work? What does it

       mean when I am prompted to save the layout?

    A. The new Relationships window gives you a graphical display of

       the tables in your database and their relationships to each

       other. You can customize the Relationships window and view as

       many or as few tables as you want. You can also create or

       change table relationships in this view. For more details about

       the Relationships window, order the fax or mail copy of this

       script.

        - To create a relationship, drag the related field from the

          primary table to the related table. Microsoft Access will

          then display the Relationships dialog box. When you choose

          OK, the relationship is created and saved.

        - Removing (deleting) a table from the Relationships window

          does not delete the table or any of its relationships from

          the database; it simply hides that particular table from

          view.

        - To delete a relationship, select the join line and press the

          DEL key.

        - To make sure that you are seeing all the defined

          relationships in your database, choose Show All from the

          Relationships menu.

        - When you close the Relationships window, you are prompted to

          save the window's layout.  Choosing Yes or No does not

          affect whether your relationships are saved, but only the

          positions of the visible tables in the Relationships window.

        - To show only the relationships for a specific table, use the

          following three steps:

          1. From the Edit menu, choose Clear Layout, and then choose

             OK when you are prompted. Note that this clears the

             layout only and does not delete existing relationships.

          2. From the Relationships menu, choose Add Table. In the

             Table/Query box, select the table whose relationships you

             want to see, and then choose Add. Choose Close.

          3. From the Relationships menu, choose Show Direct.

             NOTE: If you do not clear the layout before choosing Show

             Direct, the relationships for the table you selected will

             be displayed in addition to any other relationships that

             are already being displayed.

4.  Q. Why can I update more fields in my query than I could in

       Microsoft Access version 1.x?

    A. In Microsoft Access 2.0, when a query includes fields from more

       than one related table, you can update data on both sides of

       the join. This means that in a query that combines data from

       two tables, you can update data from both of the tables in the

       query.

       If you want to prevent users from updating fields in a multiple-

       table query, create a form based on the query and then set the

       Locked property for the fields you do not want users to update.

       For more information about updating queries, search for

       "queries: updating underlying tables" and then view both of the

       related topics using the Microsoft Access Help menu.

5.  Q. How have validation rules and default values changed?

    A. In Microsoft Access 2.0, validation rules are always enforced,

       no matter how you add or edit data. Because default values and

       validation rules are always enforced, the following items are

       not valid in default values or field-level validation rules:

        - References to fields or controls. Instead, use record

          validation rules when you are comparing two or more fields.

          For more information about record validation rules, search

          for "validation: rules and text" then "Validating Data in a

          Table" using the Microsoft Access Help menu.

        - User-defined functions.

        - Microsoft Access domain functions.

        - Aggregate functions.

        - CurrentUser() or Eval() functions.

6.  Q. Why can't I set referential integrity?

    A. Referential integrity is a set of rules that preserves the

       defined relationships between tables when you enter or delete

       records. If you enforce referential integrity, you cannot add a

       record to a related table when there is no associated record in

       the primary table, change a value in a primary table that would

       result in an orphan record in a related table, or delete a

       record from a primary table when there is a matching related

       record.

       If you select the Cascade Update Related Fields or Cascade

       Delete Related Records option for a relationship, Microsoft

       Access will change or delete related records to ensure that the

       referential integrity rules are enforced when you change or

       delete records.

       There are several possible reasons why you can't enforce

       referential integrity when you are defining a relationship. For

       additional information, you can order item number Q112111 by

       selecting the FastTips Technical Library option from the

       FastTips Main Menu.

7.  Q. How can I optimize my queries?

    A. Microsoft Access 2.0 uses Rushmore, a data-access technology

       that permits sets of records to be queried very efficiently.

       Here is a summary of query performance tips:

        - Index the fields used in sorts and criteria.

        - Index the fields used in joins in both tables.

        - Use multiple-field indexes on fields where there are

          multiple-column joins between the tables.

        - If a table has a single-field primary key, do not add a

          separate index to the primary key field. If a table has a

          multiple-field primary key, it may help to have a separate

          index on each field.

        - Use outer joins only when necessary--outer joins limit the

          options for the query optimizer.

       For more information about query performance, search for

       "Rushmore technology" then "Optimizing Queries with Rushmore

       Technology" using the Microsoft Access Help menu. Or, you can

       order item number Q112112 by selecting the FastTips Technical

       Library option from the FastTips Main Menu.

8.  Q. Why do I see a number instead of "(counter)" for my

       counter field?

    A. Microsoft Access 2.0 enters a counter value when you start to

       edit a new record. In Microsoft Access 1.x, this value was

       entered after you saved the record.

       Since this value is now provided earlier, if you start editing

       a new record and then cancel the record, the counter value is

       still used, even though no record is stored with the value. For

       example, when you add a new record to a table containing two

       records, the counter value is 3. If you cancel this new record

       and then later add another new record, the counter value is 4

       for the new record.

       Counter values are not reused when you delete records. For

       example, if in a table of 15 records you delete the last three

       records and then add a new record, the counter value for the

       new record is 16. To reset the next available counter value,

       compact the database. After the database is compacted, the next

       available counter is set to one higher than the last counter

       value in the table.

       For additional information about counters, you can order item

       number Q112160 by selecting the FastTips Technical Library

       option from the FastTips Main Menu.

9.  Q. While I was creating a query, when I switched from a

       Select query to a SQL Specific query, the SQL statement

       disappeared. When I switched back to a Select query, my query

       disappeared. Where did my query go?

    A. When you switch to a SQL Specific query, the SQL statement from

       the existing query is deleted. If you want to start with a

       Select query to help create the SQL statement for a SQL

       Specific query (to save some typing) use the following six

       steps:

       1. Create the Select query.

       2. From the View menu, choose SQL.

       3. Select the entire SQL statement, except for the ending

          semicolon.

       4. Copy the selected text to the Clipboard by pressing CTRL+C,

          or by choosing Copy from the Edit menu.

       5. From the Query menu, choose SQL Specific, then choose a

          query type.

       6. Paste the query text into the Query window by pressing

          CTRL+V, or by choosing Paste from the Edit menu.

10. Q. How do I remove the underline characters in my input

       masks?

    A. An input mask consists of up to three parts, separated by

       semicolons. The first part specifies the input mask itself, the

       second part specifies whether Microsoft Access stores the

       literal display characters in the table when you enter data,

       and the third part specifies the character that Microsoft

       Access displays in the input mask for spaces.

       If you omit the third part, Microsoft Access uses an underline

       character for the input mask. For example, in the Customers

       table in the sample database NWIND.MDB, the input mask on the

       Customer ID field is:

          >LLLLL

       When you enter data in a new record, five underlines are

       displayed in the field. You can replace these underlines with

       spaces by using the following for the input mask:

          >LLLLL;;" "

       For more information about input masks, search for "input mask"

       then "Adding an Input Mask" using the Microsoft Access Help

       menu.

---------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

===============================

 - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call

   24 hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can

   have this Application Note mailed or faxed to you by calling

   Microsoft Product Support Services Monday through Friday, 6:00 A.M.

   to 6:00 P.M. Pacific time at (206) 635-7050. If you are outside the

   United States, contact the Microsoft subsidiary for your area. To

   locate your subsidiary, call Microsoft International Customer

   Service at (206) 936-8661.

Additional reference words: 2.00 appnote

KBCategory:

KBSubcategory: Fstqa


WX0996: Setup and Conversion Questions and Answers

Article ID: Q114811

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

The "Setup and Conversion Questions and Answers" (WX0996) Application Note

contains questions and answers about Microsoft Access version 2.0 Setup and

conversions.

You can obtain this Application Note from the following sources:

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note"

section at the end of this article.

THE TEXT OF WX0996

==================

======================================================================

  Microsoft(R) Product Support Services Application Note (Text File)

          WX0996: SETUP AND CONVERSION QUESTIONS AND ANSWERS

======================================================================

                                                   Revision Date: 3/94

                                                      No Disk Included

The following information applies to Microsoft Access(R) version 2.0.

-----------------------------------------------------------------------

| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY     |

| ACCOMPANY THIS DOCUMENT (collectively referred to as an Application |

| Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER      |

| EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED      |

| WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR       |

| PURPOSE. The user assumes the entire risk as to the accuracy and    |

| the use of this Application Note. This Application Note may be      |

| copied and distributed subject to the following conditions:  1) All |

| text must be copied without modification and all pages must be      |

| included;  2) If software is included, all files on the disk(s)     |

| must be copied without modification (the MS-DOS(R)  utility         |

| diskcopy is appropriate for this purpose);  3) All components of    |

| this Application Note must be distributed together;  and  4) This   |

| Application Note may not be distributed for profit.                 |

|                                                                     |

| Copyright (C) 1994 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

|---------------------------------------------------------------------|

1.  Q. Is there an easy way for me to remove all or part of

       Microsoft Access from my computer?

    A. Microsoft Access Setup now has a maintenance mode for adding or

       removing Microsoft Access components. After you originally

       install Microsoft Access, Setup automatically runs in

       maintenance mode. To remove the entire Microsoft Access program

       from your hard disk, start Setup and then choose the Remove All

       button. Setup will remove the Microsoft Access program and the

       associated icons in Program Manager, but will not remove the

       Microsoft Access directory, the Program Manager group, user-

       created  .MDB and .LDB files, or shared .DLL files in the

       WINDOWS\SYSTEM directory.

       To change specific components, choose the Add/Remove button in

       Setup. Select the check box for any component you want to add,

       or clear the check box for any component you want to remove.

       Setup prompts you to verify the components you are removing. If

       a selected component is already installed, Setup does not

       reinstall it. To reinstall a component, you must first remove

       the component and then install it. An example is available in

       the fax or mail copy of this script.

       For example, to reinstall the sample database NWIND.MDB, use

       the following 10 steps:

          1.  Start Microsoft Access Setup.

          2.  Choose Add/Remove.

          3.  In the Options box, select Sample Apps, and then choose

              Change Option.

          4.  Clear the Northwind Traders check box, and then

              choose OK.

          5.  Choose Continue, and then choose Yes when you are

              prompted to confirm that you want to remove the component.

          6.  Start Setup again after it finishes.

          7.  Choose Add/Remove.

          8.  In the Options box, choose Sample Apps, and then choose

              Change Option.

          9.  Select the Northwind Traders check box, and then

              choose OK.

         10.  Choose Continue.

2.  Q. Why does the Microsoft Access Setup program not complete

       successfully?

    A. There are several things that may prevent the Microsoft Access

       Setup program from completing successfully. Four

       troubleshooting tips are available in the fax or mail copy of

       this script.

       1. Make sure you have enough free disk space. Disk-compression

          utilities, such as DoubleSpace, make your hard disk seem

          larger than it actually is by compressing the files on the

          disk. However, if you set the DoubleSpace compression ratio

          for your hard disk to 16 to 1, you might see 160 MB of free

          space where there is actually only 10 MB of space available.

       2. Make sure that your problem is not due to a bad installation

          disk by copying the disk to an empty directory on your hard

          disk. If the disk can be copied with no errors, then the

          disk is not bad. If you do receive an error message when you

          are copying the disk, obtain a replacement disk by calling

          Microsoft Sales Information Center at (800) 426-9400.

       3. Make sure that the PATH statement in your AUTOEXEC.BAT file

          includes the complete path to your Windows directory,

          including the drive letter. For example, if your Windows

          directory is named WINDOWS and is on drive C, your PATH

          statement must include:

             path=c:\windows;c:\dos

          IMPORTANT: If you change the PATH statement, you must

          restart your computer before the change takes effect.

       4. In your CONFIG.SYS and AUTOEXEC.BAT files, include only the

          devices or drivers necessary to run Windows and your

          computer. Remove any third-party memory managers and virus-

          checking software. In Windows, close all other applications,

          including virus-checking software and screen savers, before

          you run Microsoft Access Setup.

       For additional information about configuring your CONFIG.SYS

       and AUTOEXEC.BAT files and troubleshooting Setup problems, you

       can order item number Q96109 by selecting the FastTips

       Technical Library option from the FastTips Main Menu.

3.  Q. Can I install Microsoft Access 2.0 over my current

       installation of Microsoft Access version 1.x?

    A. Microsoft Access 2.0 is designed to install over Microsoft

       Access 1.x files. However, to avoid any potential naming

       conflicts among database files, you may want to install

       Microsoft Access 2.0 in a new directory, or at least back up

       your existing database files before running Setup. Install

       Microsoft Access 2.0 in a different directory if you want to

       retain your previous version of Microsoft Access.

       If you plan to create or modify databases that are compatible

       with Microsoft Access 1.x, you should install Microsoft Access

       2.0 in a different directory. Once you convert a version 1.x

       database to version 2.0, you will not be able to open that

       database in version 1.x again. Microsoft Access 2.0 can open

       version 1.x databases and modify the data, but will not allow

       you to create new objects or modify existing objects. To do

       this, you must convert the database to version 2.0.

4.  Q. How do I set up Microsoft Access 2.0 for shared use on a

       network?

    A. Network installation is a two-step process. First, install

       Microsoft Access on the network file server by running the

       administrator Setup command SETUP /A from the Setup disk. Next,

       set up each workstation by running Setup from the network file

       server. Note that there is no SETUP /N command to set up

       workstations as there was in Microsoft Access version 1.x.

       When you are setting up the workstations, you can choose to

       install Microsoft Access on each workstation's hard disk, or to

       set up the workstations to run Microsoft Access from the file

       server. If your network supports the universal naming

       convention (UNC), it is best to start the workstation Setup

       using the UNC path.  Doing this eliminates possible future

       problems with incorrect network drive letter references. In

       addition, you can create custom scripts to set up workstations

       "silently," or without input from the users.

       For detailed network installation instructions, see the

       ACREADME.HLP file that is shipped with Microsoft Access.

5.  Q. My validation rules worked correctly in Microsoft Access

       version 1.x, but when I convert my version 1.x database to

       version 2.0, I receive an error message and a Convert Error

       table is created. Why is this?

    A. In Microsoft Access 2.0, validation rules are enforced whenever

       you add or edit data. Because validation rules are always

       enforced, the following items are not valid in default values

       or field-level validation rules:

        - References to fields or controls.

        - User-defined functions.

        - Microsoft Access domain functions.

        - Aggregate functions.

        - CurrentUser() or Eval() functions.

       For additional information about validation rules, you can

       order item number Q<srx940128000575> by selecting the FastTips

       Technical Library option from the FastTips Main Menu.

6.  Q. Are there any changes that I should be aware of when I

       convert my database from version 1.x to version 2.0?

    A. Microsoft Access 2.0 contains many changes and new features.

       For specific information about these items, refer to:

        - Microsoft Access "User's Guide", version 2.0, "What's New

          in Version 2.0" section

        - Microsoft Access "User's Guide", version 2.0, Chapter 1,

          "Setting Up Microsoft Access"

        - Microsoft Access "Building Applications", version 2.0,

          Appendix C

        - The ACREADME.HLP file that is shipped with Microsoft Access

7.  Q. Why am I unable to create new objects when I open my

       Microsoft Access version 1.x database in Microsoft Access 2.0?

    A. When you open a Microsoft Access version 1.x database in

       Microsoft Access 2.0, you can add or modify data, but you

       cannot create new objects or modify the design of existing

       objects.

       To create new objects or modify the design of existing objects,

       you must first convert your version 1.x database to version

       2.0. To do this, make sure that there are no databases open in

       Microsoft Access, then choose Convert from the File menu. You

       will be prompted for the name of the database to convert and a

       new name for the converted database. Note that if you convert

       your database to version 2.0, it cannot be opened again in

       version 1.x.

       For additional information about database conversion, see the

       Microsoft Access "User's Guide," version 2.0, Chapter 1,

       "Setting Up Microsoft Access."

8.  Q. Can Microsoft Access version 1.x read a version 2.0

       database?

    A. Microsoft Access 1.x cannot read a version 2.0 database. Also,

       you cannot convert a Microsoft Access 2.0 database to version

       1.x format. You can export your version 2.0 tables to a 1.x

       database, but because of all the new features in version 2.0,

       you cannot convert any other objects. Therefore, be sure to

       keep 1.x versions of your databases until you have upgraded all

       of your users to version 2.0.

       For more information about using version 1.x databases in

       version 2.0, see the Microsoft Access "User's Guide", version

       2.0, Chapter 1, "Setting Up Microsoft Access."

9.  Q. How much hard disk space is required to install Microsoft

       Access 2.0?

    A. The Microsoft Access Setup program has three installation

       options, each having different disk space requirements. The

       space needed for each option is listed below:

        - Typical. For a Typical installation, you need approximately

          19 MB of disk space (15 MB in the Microsoft Access

          directory, plus 4 MB in the Windows directory).

          NOTE: The Typical installation installs all of the Microsoft

          Access components except for Open Database Connectivity

          (ODBC). To install ODBC, you must choose the Complete/Custom

          option.

        - Complete/Custom. For a Complete installation, you need

          approximately 20 MB of disk space (15 MB in the Microsoft

          Access directory, plus 5 MB in the Windows directory).

        - Laptop/Minimum. For a Laptop/Minimum installation, you need

          approximately 5 MB of disk space (4.5 MB in the Microsoft

          Access directory, plus 0.5 MB in the Windows directory).

---------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

===============================

 - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call

   24 hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can

   have this Application Note mailed or faxed to you by calling

   Microsoft Product Support Services Monday through Friday, 6:00 A.M.

   to 6:00 P.M. Pacific time at (206) 635-7050. If you are outside the

   United States, contact the Microsoft subsidiary for your area. To

   locate your subsidiary, call Microsoft International Customer

   Service at (206) 936-8661.

Additional reference words: 2.00 appnote

KBCategory:

KBSubcategory: Fstqa


WX0997: Interoperability Questions and Answers

Article ID: Q114812

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

The "Interoperability Questions and Answers" (WX0997) Application Note

contains questions and answers about Microsoft Access version 2.0

interoperability.

You can obtain this Application Note from the following sources:

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note"

section at the end of this article.

THE TEXT OF WX0997

==================

======================================================================

  Microsoft(R) Product Support Services Application Note (Text File)

            WX0997: INTEROPERABILITY QUESTIONS AND ANSWERS

======================================================================

                                                   Revision Date: 3/94

                                                      No Disk Included

The following information applies to Microsoft Access(R) version 2.0.

-----------------------------------------------------------------------

| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY     |

| ACCOMPANY THIS DOCUMENT (collectively referred to as an Application |

| Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER      |

| EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED      |

| WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR       |

| PURPOSE. The user assumes the entire risk as to the accuracy and    |

| the use of this Application Note. This Application Note may be      |

| copied and distributed subject to the following conditions:  1) All |

| text must be copied without modification and all pages must be      |

| included;  2) If software is included, all files on the disk(s)     |

| must be copied without modification (the MS-DOS(R)  utility         |

| diskcopy is appropriate for this purpose);  3) All components of    |

| this Application Note must be distributed together;  and  4) This   |

| Application Note may not be distributed for profit.                 |

|                                                                     |

| Copyright (C) 1994 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

|---------------------------------------------------------------------|

1.  Q. How do I send Microsoft Access database objects to other

       software applications?

    A. There are three commands on the File menu and two toolbar

       buttons that send database objects to other applications.

        - The Export command exports data only from a table or query.

          To export the layout, use the Output To command.

        - The Print Definition command creates a report about an

          object's structure.

        - The Output To command exports data to a file, preserving the

          layout. You enter the output format and name of the file to

          create. To view the file, start the appropriate application.

        - The Publish It With MS Word and Analyze It With MS Excel

          buttons save the file to the current directory and start

          Microsoft Excel or Word. For information about adding these

          buttons to your toolbar, search for "customizing toolbars"

          then "Adding or Removing Buttons on Toolbars" using the

          Microsoft Access Help menu.

2.  Q. How can Visual Basic access Microsoft Access version 2.0

       databases?

    A. A mapping layer has been created so that Visual Basic version

       3.0 can communicate with Microsoft Access 2.0 databases. This

       mapping layer works with both Microsoft Access version 1.1 and

       2.0 databases. The mapping layer will be available in the

       Microsoft Access Developer's Toolkit (ADT), and in the

       Microsoft Office Developer's Kit (ODK).

       For additional information about using Microsoft Access 2.0

       databases with Visual Basic, you can order item number Q112104

       by selecting the FastTips Technical Library option from the

       FastTips Main Menu.

3.  Q. Has the ability to use my Microsoft Access data in a

       Microsoft Word for Windows mail merge changed in version 2.0?

    A. Using Microsoft Access data for a Word for Windows mail merge

       is easier in version 2.0. The new Microsoft Word Mail Merge

       Wizard helps you create a dynamic data exchange (DDE) link

       between Microsoft Access and Microsoft Word version 6.0 for

       Windows. To use the Microsoft Word Mail Merge Wizard, use

       either of the following methods:

        - Select your table or query in the Database window, and then

          choose the Merge It button on the toolbar.

        - Create a new report based on your table or query. Choose the

          ReportWizards button, then choose Microsoft Word Mail Merge

          in the ReportWizards dialog box.

       For more information about using Microsoft Access data in a

       Word for Windows merge, search for "Word for Windows" then

       "Merging Microsoft Access Data with a Word for Windows

       Document" using the Microsoft Access Help menu.

4.  Q. Do I need to change anything so that Microsoft Word

       version 6.0 for Windows or Microsoft Excel version 5.0 can use

       my Microsoft Access 2.0 databases?

    A. To use Microsoft Access version 2.0 databases with Word 6.0 for

       Windows and Microsoft Excel 5.0, you need the Microsoft Access

       2.0 ODBC driver for Microsoft Office. For additional information

       about this driver, you can order item number Q112062 by

       selecting the FastTips Technical Library option from the

       FastTips Main Menu.

5.  Q. How can I obtain the Oracle ODBC driver?

    A. Microsoft Access 2.0 supplies an ODBC driver for connecting to

       SQL Server, but does not supply a driver for connecting to

       Oracle 6. Customer research showed that few people used the

       Oracle driver we shipped with Microsoft Access version 1.1.

       However, if you have the Microsoft Access 1.1 Oracle driver,

       you can use it with your Microsoft Access 2.0 applications.

       For additional information about obtaining the Oracle ODBC

       driver, you can order item number Q112105 by selecting the

       FastTips Technical Library option from the FastTips Main Menu.

6.  Q. How can I execute a stored procedure using an SQL pass-

       through query?

    A. You can use SQL pass-through queries to send commands directly

       to an ODBC database server (such as Microsoft SQL Server). You

       must send the commands using the syntax required by the

       particular server. With pass-through queries, you work directly

       with the tables on the remote server instead of attaching them.

       For an example of running a SQL Server stored procedure, order

       the fax or mail copy of this script.

       For example, to run the stored procedure sp_configure, which

       returns SQL Server configuration information, use the following

       steps:

       1. Create a new query.

       2. From the Query menu, choose SQL Specific, then choose Pass-

          Through.

       3. In the SQL Pass-Through Query window, type the following:

             sp_configure

       When you run the query, you will be prompted for the ODBC data

       source. The configuration information for the SQL Server will

       be returned.

       For more information about the syntax of SQL pass-through

       queries, please consult the documentation for your server.

7.  Q. When I attach a SQL Server table, I cannot edit any of the

       data, although I have rights to edit the data. Why is this and

       how can I edit the data?

    A. When you attach any table with ODBC, the table must have a

       unique index before Microsoft Access can update the data. In

       Microsoft Access 2.0, you can create a temporary unique primary

       index on the attached table using a data definition query

       (DDL). This temporary index will not be created on the server,

       but will allow you to update the data in Microsoft Access. The

       following is a DDL query to create a temporary primary index:

          CREATE UNIQUE INDEX index1 On <tablename>(<uniqueIDfieldname>)

       For more information about DDL queries, search for "Data

       Definition" then "Data Definition Command" using the Microsoft

       Access Help menu.

8.  Q. How do I link a Microsoft Access table to a Microsoft

       Excel spreadsheet using dynamic data exchange (DDE)?

    A. The easiest way is to use DDE to create a paste link between

       Microsoft Access and Microsoft Excel. To do this, use the

       following steps:

       1. In the Microsoft Access Database window, select the table

          you want to link to Microsoft Excel.

       2. From the Microsoft Access Edit menu, choose Copy.

       3. From the Microsoft Excel Edit menu, choose Paste Special.

       4. Select the Paste Link option button, then select either Text

          (unformatted) or CSV (formatted). Choose OK.

       The Microsoft Excel formula resulting from the Paste Link

       command will be similar to:

          {=MSAccess|'<DATABASENAME>.MDB;Table <Tablename>'!All}

       For more information about linking Microsoft Access data to

       data in other applications, see the Microsoft Access "User's

       Guide," version 2.0, Chapter 19, "Using Pictures, Graphs, and

       Other Objects."

9.  Q. Has dynamic data exchange (DDE) changed in Microsoft

       Access version 2.0?

    A. DDE functionality has not changed from Microsoft Access version

       1.1 to 2.0. No new DDE commands were added.

       For additional DDE information and examples, you can order item

       number Q89586 by selecting the FastTips Technical Library

       option from the FastTips Main Menu.

       For more information about DDE, search for "DDE server" then

       view each of the topics using the Microsoft Access Help menu.

---------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

===============================

 - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call

   24 hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can

   have this Application Note mailed or faxed to you by calling

   Microsoft Product Support Services Monday through Friday, 6:00 A.M.

   to 6:00 P.M. Pacific time at (206) 635-7050. If you are outside the

   United States, contact the Microsoft subsidiary for your area. To

   locate your subsidiary, call Microsoft International Customer

   Service at (206) 936-8661.

Additional reference words: 2.00 appnote

KBCategory:

KBSubcategory: Fstqa


WX0998: Macro and Module Questions and Answers

Article ID: Q114813

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 2.0

---------------------------------------------------------------------

The "Macro and Module Questions and Answers" (WX0998) Application Note

contains questions and answers about Microsoft Access version 2.0 macros

and modules.

You can obtain this Application Note from the following sources:

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note"

section at the end of this article.

THE TEXT OF WX0998

==================

======================================================================

  Microsoft(R) Product Support Services Application Note (Text File)

            WX0998: MACRO AND MODULE QUESTIONS AND ANSWERS

======================================================================

                                                   Revision Date: 3/94

                                                      No Disk Included

The following information applies to Microsoft Access(R) version 2.0.

-----------------------------------------------------------------------

| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY     |

| ACCOMPANY THIS DOCUMENT (collectively referred to as an Application |

| Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER      |

| EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED      |

| WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR       |

| PURPOSE. The user assumes the entire risk as to the accuracy and    |

| the use of this Application Note. This Application Note may be      |

| copied and distributed subject to the following conditions:  1) All |

| text must be copied without modification and all pages must be      |

| included;  2) If software is included, all files on the disk(s)     |

| must be copied without modification (the MS-DOS(R)  utility         |

| diskcopy is appropriate for this purpose);  3) All components of    |

| this Application Note must be distributed together;  and  4) This   |

| Application Note may not be distributed for profit.                 |

|                                                                     |

| Copyright (C) 1994 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

|---------------------------------------------------------------------|

1.  Q. What is DAO?

    A. Data access objects (DAO) and collections provide a framework

       for using code to create and manipulate components of your

       database system. Objects and collections have properties that

       describe the characteristics of database components and

       methods. DAO provides the functionality of the dynasets,

       Snapshots, and QueryDef objects you used in version 1.x, while

       giving you more structure and features. All collections use the

       same syntax.

       For more information about DAO, please refer to the following:

        - Search for "data access objects" then "Data Access Objects

          and Collections" using the Microsoft Access Help menu.

        - Search for "converting databases to version 2.0" then

          "Converting Macros and Code from Version 1.x to 2.0" using

          the Microsoft Access Help menu.

        - See Microsoft Access "Building Applications," Chapter 7,

          "Objects and Collections."

        - See Microsoft Access "Building Applications," Chapter 11,

          "Working with Sets of Records."

2.  Q. How can I use data access objects (DAO)?

    A. You can use DAO methods to create or modify different parts of

       your database, including TableDef objects, security,

       relationships, and so on. Three common tasks that you can

       accomplish with DAO are:

        - Indexing an existing field in a table.

        - Assigning permissions to a user.

        - Adding a user to a group.

       For additional information about indexing an existing field in

       a table, you can order item number Q112107 by selecting the

       FastTips Technical Library option from the FastTips Main Menu.

       For additional information about assigning permissions to a

       user, you can order item number Q112106 by selecting the

       FastTips Technical Library option from the FastTips Main Menu.

       For additional information about adding a user to a group, you

       can order item number Q112063 by selecting the FastTips

       Technical Library option from the FastTips Main Menu.

3.  Q. How do I create an SQL pass-through query using Access

       Basic?

    A. Use the CreateQueryDef method to create an SQL pass-through

       query using Access Basic. Set the properties of your QueryDef

       as follows:

        - ConnectString: This sets the ODBC connection string, and

          must be at least "ODBC;". If the connection string does not

          include at least "ODBC;" the query is not an SQL pass-through

          query and you will receive a syntax error message. If you do

          not include the data source name, you will be prompted for

          it when you run the query. For more information about

          connection strings, search for "ODBC connection string" then

          "ODBCConnectString Property" using the Microsoft Access Help

          menu.

        - SQL statement: This is the SQL statement that is passed to

          the server. For additional information about the syntax of

          the SQL statement, please refer to your server's

          documentation.

       For additional information and an example of an SQL pass-

       through query, you can order item number Q112108 by selecting

       the FastTips Technical Library option from the FastTips Main

       Menu.

4.  Q. How do I determine if the record being edited is a new

       record?

    A. In Microsoft Access version 1.x, the counter field is null

       until the record is saved. So, to check for a new record, you

       would check to see if the counter field is null. In Microsoft

       Access version 2.0, the counter field is updated as soon as you

       begin inserting a new record. However, the OldValue property

       for the counter will still be null. You can use the following

       expression to determine whether the record being edited is a

       new record:

          IsNull([<counterfieldname>].OldValue)

       For additional information about checking for new records in

       Microsoft Access 2.0, you can order item number Q112109 by

       selecting the FastTips Technical Library option from the

       FastTips Main Menu.

5.  Q. Why doesn't my version 1.x Access Basic code work

       correctly in Microsoft Access 2.0?

    A. Microsoft Access 2.0 introduces many changes and new features

       to Access Basic. When you convert your database from version

       1.x to 2.0, your Access Basic code is not automatically

       converted. Because of the changes and new features, you must

       modify your code for it to work correctly in version 2.0. Some

       of the changed items include the SendKeys and DoMenuItem

       actions, and field name references. For more details about

       these changes, order the fax or mail copy of this script.

        - The SendKeys action: Some menus in Microsoft Access 2.0 have

          changed. One of the common uses for the SendKeys action,

          hiding and showing the toolbar, has been replaced with the

          new ShowToolbar action. To access the options in the Options

          dialog box (such as Show Status Bar),  use the new SetOption

          and GetOption methods with the Application object. For more

          information about the SetOption method, search for

          "SetOption" then "GetOption, SetOption Methods" using the

          Microsoft Access Help menu.

        - The DoMenuItem action: Because some menus have changed,

          there is now a fifth argument, <Version>, that you must

          supply when you use the DoMenuItem action in Access Basic.

          For more information about the DoMenuItem action, search for

          "DoMenuItem" then "DoMenuItem Action" using the Microsoft

          Access Help menu. You can also order item number Q112065

          by selecting the FastTips Technical Library option from the

          FastTips Main Menu.

        - Using a period to reference field names: In Microsoft Access

          1.x, you can reference fields using a period before the

          field name. For example, you can use "MyTable.Name" to refer

          to the Name field in the MyTable table. If you use the same

          expression in Microsoft Access 2.0, you reference the Name

          property instead of the field called Name. Use

          "MyTable!Name" to refer to the Name field in Microsoft

          Access 2.0.

       For more information about other changes and new features in

       Access Basic, search for "converting databases to version 2.0"

       then "Converting Macros and Code from Version 1.x to 2.0" using

       the Microsoft Access Help menu.

6.  Q. Why doesn't a new table created using data access objects

       (DAO) show in the Database window?

    A. Database changes made using DAO are not automatically

       synchronized with the Database window in order to avoid

       affecting system performance. To view changes made using DAO,

       refresh the Database window by choosing a different object

       button, and then choose the object button for the object type

       you were working with. You can automate this refresh method in

       your code by using two SelectObject actions.

       When you make a change without using DAO, it is not reflected

       in the corresponding DAO object unless you call the Refresh

       method on the collection containing that object. For example,

       if you delete a table in the Database window, use the following

       expression to remove the table from the TableDefs collection:

          <MyDatabase>.TableDefs.Refresh

7.  Q. How do I include a variable in the WHERE clause of my SQL

       statement?

    A. The syntax for including a variable in the WHERE clause of an

       SQL statement depends on the variable's data type. Numeric

       variables do not require delimiters, string variables should be

       enclosed in single quotation marks, and date variables should

       be enclosed in number signs (#). Concatenate the variable and

       the appropriate delimiter, if required, as shown in the three

       examples available in the fax or mail copy of this script.

       For a numeric variable, use the following syntax:

          <myq>.sql = "select * from <table> where

          [<field>]=" & <mynum> & ";"

       For a string variable, use the following syntax:

          <myq>.sql = "select * from <table> where

          [<field>]='" & <mytext> & "';"

       For a date variable, use the following syntax:

          <myq>.sql = "select * from <table> where

          [<field>]=#" & <mydate> & "#;"

       For additional information about concatenating variables, you

       can order item number Q96576 by selecting the FastTips

       Technical Library option from the FastTips Main Menu.

8.  Q. Will the macros I created in Microsoft Access version 1.x

       work in version 2.0?

    A. Macro syntax has not changed from version 1.x to 2.0, so macros

       created in version 1.x should work correctly. However, if your

       macros use the SendKeys action, you may need to make some

       changes to reflect the menu changes and new features in

       Microsoft Access 2.0.

9.  Q. Can I call a function stored in my form module from a

       regular module?

    A. Functions stored in form or report modules are private to that

       module's form or report, and can only be called from that

       module's form or report. If you want to use the function in a

       different form, report, or global function, make it a global

       function by storing it in a regular module.

       For more information about writing and using event procedures,

       see Microsoft Access "Building Applications," Chapter 3,

       "Introducing Access Basic," and Chapter 5, "Access Basic

       Fundamentals."

10. Q. How do I edit a library? Do I have to unload the library

       first as in Microsoft Access version 1.x?

    A. Debugging libraries in Microsoft Access version 1.x requires

       you to unload the library and restart Microsoft Access each

       time you find an error in the library. In Microsoft Access 2.0,

       you can debug libraries without unloading the library and

       restarting Microsoft Access.

       To debug or edit a library in Microsoft Access 2.0, add the

       following line to the [Options] section of the MSACC20.INI

       file:

          DebugLibraries=True

       Once you have added this line to the MSACC20.INI file and

       restarted Microsoft Access, you can edit the functions in your

       library. If this line is not in your MSACC20.INI file, or is

       set to False, you will not be able to edit your library.

---------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

===============================

 - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call

   24 hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can

   have this Application Note mailed or faxed to you by calling

   Microsoft Product Support Services Monday through Friday, 6:00 A.M.

   to 6:00 P.M. Pacific time at (206) 635-7050. If you are outside the

   United States, contact the Microsoft subsidiary for your area. To

   locate your subsidiary, call Microsoft International Customer

   Service at (206) 936-8661.

Additional reference words: 2.00 appnote

KBCategory:

KBSubcategory: Fstqa


WX0999: MS Access Dev. Toolkit Questions & Answers

Article ID: Q115622

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Developer's Toolkit version 2.0

---------------------------------------------------------------------

The "Microsoft Access Developer's Toolkit Questions and Answers" (WX0999)

Application Note contains questions and answers about the Microsoft Access

Developer's Toolkit version 2.0.

You can obtain this Application Note from the following sources:

 - Microsoft FastTips Technical Library

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note"

section at the end of this article.

THE TEXT OF WX0999

==================

======================================================================

  Microsoft(R) Product Support Services Application Note (Text File)

WX0999: MICROSOFT ACCESS(R) DEVELOPER'S TOOLKIT QUESTIONS AND ANSWERS

======================================================================

                               Revision Date: 5/94

                                  No Disk Included

-----------------------------------------------------------------------

| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY     |

| ACCOMPANY THIS DOCUMENT (collectively referred to as an Application |

| Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER      |

| EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED      |

| WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR       |

| PURPOSE. The user assumes the entire risk as to the accuracy and    |

| the use of this Application Note. This Application Note may be      |

| copied and distributed subject to the following conditions:  1) All |

| text must be copied without modification and all pages must be      |

| included;  2) If software is included, all files on the disk(s)     |

| must be copied without modification (the MS-DOS(R)  utility         |

| diskcopy is appropriate for this purpose);  3) All components of    |

| this Application Note must be distributed together;  and  4) This   |

| Application Note may not be distributed for profit.                 |

|                                                                     |

| Copyright (C) 1994 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

|---------------------------------------------------------------------|

1.  Q. Can I include the OLE custom controls that come with the

       Microsoft Access Developer's Toolkit (ADT) with my application?

    A. You can include the three OLE custom controls that come with

       the ADT (the Calendar, Scroll Bar, and Data Outline controls)

       with your application, royalty-free.

2.  Q. How can I create my own OLE custom controls?

    A. You can create your own OLE custom controls using the Custom

       Controls Development Toolkit add-on to Microsoft Visual C++

       that is scheduled for release in summer 1994.

3.  Q. What is the best way to distribute updates of my application?

    A. To make updating your application easy, begin by creating your

       application as two databases. One database (DATA.MDB) is for

       storing the application's data, and the other database

       (PROGRAM.MDB) is for storing the application's queries, forms,

       reports, macros, and modules. To distribute updates of your

       application, simply distribute a new PROGRAM.MDB database. You

       can use this method to update the application without

       disturbing your users' data.

       All the objects in the PROGRAM.MDB database should be based on

       attached tables from the DATA.MDB database. Note that when you

       create a database with attached tables, the path to the

       attached tables is stored in the database. If the path to the

       attached tables becomes invalid, an error message will occur

       when the database is opened. For information about verifying

       attachments, open the Solutions sample application

       (SOLUTION.MDB). In the Select A Category Of Examples box,

       select Use Multiple Databases, then in the Select An Example

       box, select Attach Tables At Startup.

4.  Q. How can I prevent users from seeing the code in my application?

    A. You can control what users of your application see by taking

       the following precautions:

        - Use form and report modules.

        - Use forms and macros to control users' movements within your

          application.

        - Secure all the objects in your database.

        - Encrypt your database.

5.  Q. How do I distribute the ODBC SQL Server driver with my

       application?

    A. To enable your run-time application to connect to a SQL Server

       database using ODBC, select ODBC With SQL Server Driver in the

       Available Options box in the Setup Wizard.

6.  Q. How do I include my own SYSTEM.MDA file with my application?

    A. To include your own SYSTEM.MDA file, add your SYSTEM.MDA file

       in the Files To Include box in the Setup Wizard. Setup will not

       overwrite a file named SYSTEM.MDA.

       NOTE: If you do not provide a SYSTEM.MDA file with your run-

       time application, Setup will create a new one.

7.  Q. Why can't I access my Calendar control's Font and Color

       properties?

    A. The OC1016.DLL file was not automatically registered in the

       Microsoft Windows REG.DAT file when you installed the ADT. The

       OC1016.DLL file must be registered in the REG.DAT file in order

       for you to access the Calendar control's Font and Color

       properties.

       For information about how to register the OC1016.DLL file in

       the REG.DAT file, you can order item number Q115125 by

       selecting the FastTips Technical Library option from the

       FastTips Main Menu.

8.  Q. Can I add my own bulletin boards to Setup? Can I change the

       Setup bitmap to something else?

    A. You cannot currently add your own bulletin boards to, or modify

       the bitmap for, custom Setup programs. If you want this

       level of control in creating your custom Setup program, you may

       want to consider using a third-party tool. Note, however, that

       third-party tools cannot be used to modify an existing custom

       Setup program developed with the ADT.

9.  Q. Can I distribute the Microsoft Access Wizards with my application?

    A. You cannot distribute the Microsoft Access Wizards. However,

       you can create and distribute your own Wizards. The ADT

       includes commented Wizard code as a learning aid for creating

       your own Wizards.

10. Q. Can I use custom toolbars in my run-time application?  If so, how?

    A. You can use custom toolbars in your run-time application. To do

       so, use the ShowToolbar macro action in your application to

       display the custom toolbars. Note that by default, no toolbars

       (built-in or custom) are displayed in run-time applications.

       You must use the ShowToolbar action to display any toolbar in

       your application.

       For information about how to create custom toolbars, search for

       "custom toolbars" then "Creating Custom Toolbars" using the

       Microsoft Access Help menu.

---------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

===============================

 - You can have this Application Note mailed or faxed to you from the

   automated Microsoft FastTips Technical Library, which you can call

   24 hours a day, 7 days a week at (800) 936-4100. NOTE: The FastTips

   Technical Library is available only to customers within the U.S. and

   Canada.

 - If you are unable to access the source(s) listed above, you can

   have this Application Note mailed or faxed to you by calling

   Microsoft Product Support Services Monday through Friday, 6:00 A.M.

   to 6:00 P.M. Pacific time at (206) 635-7050. If you are outside the

   United States, contact the Microsoft subsidiary for your area. To

   locate your subsidiary, call Microsoft International Customer

   Service at (206) 936-8661.

Additional reference words: 2.00 appnote

KBCategory:

KBSubcategory: Fstqa


AAA: More Information on the Knowledge Base (KB) Help File

Article ID: Q199990

The KB Help file is a snapshot of the knowledge base articles written

by Product Support Engineers to help support Microsoft Access

customers. You can find information on how to find KB articles in

the topic How to Use the KB Help file.

More recent KB articles can be found on Internet, CompuServe,

and GENIE. Once you log onto one of these services with your

account information, follow these steps to find the KB:

 - On Internet, look in DESKAPPS\ACCESS\KB\README.TXT

 - On CompuServe, type "GO MSKB"

 - On GEnie, type "M 505"

OTHER SOURCES OF MICROSOFT SUPPORT INFORMATION

Microsoft offers Electronic Information Services as an alternative

to person-to-person support. All US and Canadian Microsoft customers

have access 24-hours-a-day, seven-days-a-week to a range of free or

low-cost service options including:

Microsoft FastTips

Toll-free, automated information about key Microsoft products. Access

technical articles (including common questions and answers) via voice,

fax, and U.S. mail. The four categories are:

FastTips for Desktop Applications          (800)-936-4100

FastTips for Personal Operating Systems    (800)-936-4200

FastTips for Development Products          (800)-936-4300

FastTips for Advanced Systems              (800)-936-4400

Microsoft Knowledge Base

This is the primary Microsoft product information source--a database

of more than 25,000 detailed articles containing technical information,

bug lists, fix lists and more.  Access via CompuServe, the Internet, and GEnie.

Microsoft Download Service

Direct access to Microsoft Download Library (MSDL) via modem

through the Microsoft BBS service at (206) 936-6735. Connect

information: 1200, 2400, or 9600 baud, no parity, 8 data bits,

and 1 stop.

Microsoft Forums on CompuServe

Microsoft facilitates a variety of interactive dialog forums for its

worldwide community of customers. Access by typing: GO MICROSOFT.

CompuServe connect charges apply.

(To establish an information service account, contact

CompuServe directly at (800) 848-8199.)

Microsoft Information Network

TechNet

Part of the support professionals program, the TechNet CD contains

resource kits, customer solution profiles, case studies, and tips and

techniques for integration. For TechNet subscriptions call (800)

344-2121 ext. 035.

Microsoft Developers' Network (MSDN)

Level 1 CD is a Development Library of comprehensive development information

for Win16 and Win32 APIs. Level 2 CD contains all software needed to develop

Windows-based applications. For Microsoft Developers Network subscriptions

call (800) 759-5474.

The Internet

Access the Microsoft Software Library and the Microsoft Knowledge Base

by anonymous ftp. The Microsoft Internet FTP archive host supports anonymous login.

The name of the server is FTP.MICROSOFT.COM; the IP address is 198.105.232.1.


AAA: Microsoft Access Knowledge Base Survey

Article ID: Q199991

               Microsoft Access Knowledge Base Survey

To better meet your needs, please give us your feedback on the

Microsoft Access Knowledge Base (KB) Help file. We appreciate

your input.

How did you receive this KB Help file?

   ____ ftp.microsoft.com (Internet), softlib directory

   ____ CompuServe user forums or MSL

   ____ MSDL

   ____ FastTips

   ____ Mailed from PSS

   ____ From a local network or BBS, coworker, or friend

Did you find a resolution to your problem in the KB Help file?

   Yes / No

Is the topic "How to Query in the Knowledge Base (KB) Help File" useful?

   Yes / No

Of the topics listed in Q119526, "INF: Microsoft Access KB Categories

and Subcategories," which 10 do you query on the most?

    1. ________________          6. ________________

    2. ________________          7. ________________

    3. ________________          8. ________________

    4. ________________          9. ________________

    5. ________________         10. ________________

How would you improve the topic "How to Query in the Knowledge Base

(KB) Help File"?

   __________________________________________________________________

   __________________________________________________________________

How do you prefer to receive your KB information?

   ____ A KB Help file with the most popular articles (like this one)

   ____ A KB Help file with all articles

   ____ Several KB Help files, each with articles from a major category

   ____ Individual articles, such as those available in the KB on

        Internet and CompuServe

   ____ Other _______________________________________________________

Where do you normally get your technical information?

Please rank each source from 1-8:

   ____ KB Help file

   ____ KB on ftp.microsoft.com or CompuServe

   ____ MSDN or TechNet CDs

   ____ CompuServe Technical Support Forums

   ____ Calling Microsoft FastTips 800 number

   ____ Calling Microsoft Product Support (PSS)

   ____ Calling PSS and receiving technical items by fax/mail/both

   ____ Other _______________________________________________________

Do you have a modem?  Yes / No

May we follow up this survey with a phone call or email if we

need additional information? Yes / No

Name _________________________________________________________

Address, email name, or Internet address

______________________________________________________________

Phone _______________________________

Occupation ___________________________________________________

Type of business/industry ___________________________________________

Microsoft products you use __________________________________________

To submit this survey, please print the Help topic and fax your

responses to Microsft Access KB Survey, (206) 704-4412.

NOTE: we are unable to respond to technical support questions at this

phone number.