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


 Access 1.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 1.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 1.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: "Fieldname" Is Not an Index in This Table

 INF: "Form Is Read Only" Error Message

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

 INF: "Invalid Path" Error Message on Network Installation

 INF: "Unexpected Error 1031" Using the SecurityWizard

 INF: Access Basic and Macros Questions & Answers

 INF: Access Basic Error-Handling Supplemental Information

 INF: Access Workstation Setup (/N) Instructions Are Confusing

 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

 INF: Aligning User-Defined Formats in Text Fields

 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: Attaching to FoxPro Data in Microsoft Access

 INF: Base Combo Box on Parameter Query to Filter Values

 INF: Btrieve 6.0 Data Type Does Not Work with Microsoft Access

 INF: Calculated Fields Must Be Shown to Perform Calculations

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

 INF: Cannot Create Relationships with Attached Tables

 INF: Case Sensitivity in Queries Differs with Attached Tables

 INF: Changing Area Codes Based on a Telephone Number Prefix

 INF: Changing the Relationship Between Two Existing Tables

 INF: Changing the RowSource of a ListBox/ComboBox at Runtime

 INF: Checking for Last or First Record in a Macro

 INF: ComboBox On Toolbar Do Not Use Window Background Color

 INF: Commonly Asked Questions About MS Access Version 1.0

 INF: Comparison of Visual Basic 3.0 and Microsoft Access 1.1

 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: Consecutively Numbering Pages for Two or More Reports

 INF: Contents of Solutions Pack Referral List File MSASPL.EXE

 INF: Controlling Design Mode at Run Time to Change Properties

 INF: Conversion of Oracle Data Types to Microsoft Access

 INF: Converting Julian Dates with Access Basic

 INF: Copying Columns In Microsoft Access

 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: CreateControl() and CreateReportControl() Functions

 INF: Creating a Crosstab Query with Multiple Value Fields

 INF: Creating and Converting Version 1.0 and 1.1 Databases

 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 Result Equivalent to SQL UNION Operator Result

 INF: Criteria Parameters Require Concatenated References

 INF: Currency is Significant to Four Digits

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

 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: Database Structure Questions & Answers

 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: Delete Command Available if Counter Field Selected

 INF: DeleteControl, DeleteReportControl, and CreateGroupLevel

 INF: Deleting Duplicate Records from Two Tables

 INF: Description of Btrieve

 INF: Description of Btrieve Section of WIN.INI File

 INF: Description of Btrieve/Xtrieve .DDF files

 INF: Description of CreateForm() and CreateReport() Functions

 INF: Description of HotSpot Editor and HotSpot Types

 INF: Description of PrtMip Property

 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: Displaying Totals for Each Row in Crosstab Queries

 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: Double-click Also Executes OnPush Twice

 INF: Eliminating White Space in Reports with CanShrink and AB

 INF: Enforcing Transactions on Attached SQL Server Tables

 INF: Error in Object Permissions Table

 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 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: Filenames/Version Numbers, ODBC Files for MS Access V1.1

 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: Five Parameters to Set in ISAM Section of MSACCESS.INI

 INF: Flexible Formatting of Phone Numbers

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

 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: Forms Questions & Answers

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

 INF: Function to Delete Table Without Using DoMenuItem

 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: Graphing Current Sales Compared with Accumulated Sales

 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 1.x Uses SQL Server Connections

 INF: How Microsoft Access Deletes Objects from a Database

 INF: How MS Access Handles Logins to Attached SQL Tables

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

 INF: How NWIND.MDB Employee Field Photographs Were Created

 INF: How to Activate an Application with Class Name

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

 INF: How to Add Items to the Help Menu

 INF: How to Add the ACC-KB.HLP File to the Help Menu

 INF: How to Avoid Abandoned Group Headers in Reports

 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 Read-Only Properties at Run Time

 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 "Top 10" Report

 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 Dynamic Crosstab Report

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

 INF: How to Create a Graph Without a Title

 INF: How to Create a Multiuser Custom Counter

 INF: How to Create a Parameter In() Statement

 INF: How to Create a Password Text Box

 INF: How to Create a Running Sum on a Form

 INF: How to Create a Table with Access Basic Code

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

 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 Database Is Open Exclusively

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

 INF: How To Determine if a Record Is Being Edited

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

 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 (1.x)

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

 INF: How to Disable the Menu Bar When Previewing a Report

 INF: How to Display Immediate Window Without Module Window

 INF: How to Display Intervals Greater Than 24 Hours

 INF: How to Display Yes/No Choices in a Combo Box or List Box

 INF: How to Dynamically Create a Filter

 INF: How to Edit Library Databases

 INF: How to Execute Macro Actions Using DDE

 INF: How to Export the Results of a Query

 INF: How to Fill a Combo Box with Table Names (1.x)

 INF: How to Fill an Array Using Access Basic

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

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

 INF: How to Find a Record Using a Bound Control

 INF: How to Find Access Basic Error Codes

 INF: How to Find Attached Table's Database Name

 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 Find Which Groups a User Belongs To

 INF: How to Float Windows on Other Windows

 INF: How to Force a Cascading Delete

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

 INF: How to Get a List of Object Names in Microsoft Access

 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 SQL Pass-Through Functionality Using Q+E

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

 INF: How to Give Users the Ability to Change Passwords

 INF: How to Group Column Headings in a Crosstab Query

 INF: How to Hide the Database Window at Startup

 INF: How to Implement a Timer

 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 List the Related Tables in a Database in Version 1.x

 INF: How to List Users in a Given Group

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

 INF: How to Make the Analyzer Include Field Descriptions

 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 Mark Records with Unmatched or Invalid Values

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

 INF: How to Modify Toolbars

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

 INF: How to Open UTILITY.MDA

 INF: How to Order Data in a Graph

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

 INF: How to Pass Information to Microsoft Access Using DDE

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

 INF: How to Position Microsoft Access on the Screen

 INF: How to Prevent Users from Adding New Records to a Form

 INF: How to Prevent Workstation Setup from Installing Locally

 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 Book Style Page Numbers

 INF: How to Print Duplicate Mailing Labels for Each Record

 INF: How to Print Multiple Labels in Varying Numbers

 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 Print Total Number of Pages on Each Page of Report

 INF: How to Query an Oracle Table Without Attaching It

 INF: How to Query for Duplicate Records

 INF: How to Query SQL Server Tables Without Attaching

 INF: How to Quickly Delete Multiple Tables

 INF: How to Remove Attached Tables with a Macro

 INF: How to Remove Relationships

 INF: How to Remove the Caption Bar from a Form

 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 Requery a Combo Box on Subform

 INF: How to Retrieve Information from the Clipboard

 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 Run Wizards or Open the WIZARD.MDA File

 INF: How to Search for Characters or Strings in Records

 INF: How to Search the CompuServe Knowledge Base

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

 INF: How to Send Information to the Clipboard

 INF: How to Simulate Changing RecordSource Property of Report

 INF: How to Skip Used Mailing Labels and Print Duplicates

 INF: How to Sort on Different Fields Dynamically

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

 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 Update a Table Based on Values in a Second Table

 INF: How to Use a Main/Subform with Attached SQL Server Tables

 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 Custom Colors in Microsoft Access

 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 Get, WritePrivateProfileString

 INF: How to Use Graphic Images as Wallpaper for Forms

 INF: How to Use Microsoft Access Database in Visual Basic

 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 ColumnWidth Property

 INF: How to Use the CTL3D.DLL in Your MS Access Database

 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 PrtDevNames Property on Reports

 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 DataEase Data Files

 INF: Importing Fixed-Width Text Files

 INF: Importing Word Print Merge Data Files to Microsoft Access

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

 INF: Improved Print Merge Feature in Microsoft Access 1.1

 INF: Incrementing the Numeric Portion of a String

 INF: Installation Process for the Companion Disk

 INF: Installing Microsoft Access on a Diskless Workstation

 INF: INSTCAT.SQL file for MS Access 1.0 Available on MSL

 INF: Interoperability Questions & Answers

 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: 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: 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 1.0 Disk Contents (3.5 inch, 1.44 MB)

 INF: Microsoft Access ADK Legal Agreement

 INF: Microsoft Access and Untested Networks

 INF: Microsoft Access Companion Disk Contents (3.5 in. 1.44MB)

 INF: Microsoft Access Does Not Use Record Numbers

 INF: Microsoft Access Performance Enhancement Recommendations

 INF: Microsoft Access, Scanners, and Scanning Software

 INF: Microsoft Graph Changes May Not Be Retained

 INF: Misleading Documentation for Cancel Property

 INF: MS Access Cannot Attach or Import Paradox 4.0 Tables

 INF: MS Access Distribution Kit Questions & Answers

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

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

 INF: No Custom Printer Setup for Mailing Labels ReportWizard

 INF: No Form Caption in Run-Time Application

 INF: No Permission to Modify Data in a Table

 INF: Northwind 'Sales Totals by Amount' Report Is Incorrect

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

 INF: Nulls Allowed in Foreign Key with Referential Integrity

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

 INF: Obtain Name of Current User Database Using Access Basic

 INF: ODBC Disk Contents (1/14/93, 3.5-Inch, MS Access 1.0)

 INF: ODBC Setup for Microsoft Access and SQL Server

 INF: Older Versions of Shared DLLs Cause MS Access Problems

 INF: OLE: New Graph Object Frames are Blank

 INF: OnCurrent Is Not Triggered on Unbound Forms

 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 the ORACLE ODBC Driver (1.x)

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

 INF: Page Locking, No Cluster Indexing Support

 INF: Paradox Tables, Indexes, and Multiple Connections

 INF: Parameter Queries, Wildcards, and SQL Server

 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: Performing an SQL Bulk Action Query from Access Basic

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

 INF: Planning Database Security

 INF: Practice Using Object Analyzer Commands

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

 INF: Printing Microsoft Access Reports on HP Laserjet II

 INF: Programming with the Object Analyzer Engine and Utilities

 INF: Query with Parameters to Evaluate Complex Criteria

 INF: Querying Questions & Answers

 INF: Questions and Answers About .LDB Files

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

 INF: README.TXT File and Novell Locking Issues

 INF: Recovering MDB File Larger Than the 128- Megabyte Limit

 INF: Relationships Between Attached Microsoft Access Tables

 INF: Repeat Group Name at the Top of New Column or Page

 INF: Reporting the Median Value of a Group of Records

 INF: Reports Questions & Answers

 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 Check Whether an Entry Exists

 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 Insert CR/LF in Fixed-Width Files

 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 Current User's Groups

 INF: Sample Function to Return Users in Current System

 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: Sample Timer DLL for MS Access 1.x Available on MSL

 INF: Sample Version 1.1 MSACCESS.INI File

 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: Sending the Current Record to Word for Windows with DDE

 INF: Set Focus to a Subform Control Using GoToControl Action

 INF: Setting Form's Dynaset Property Puts Bookmark at EOF

 INF: Setup Files Utility Appears to Hang

 INF: Setup Questions & Answers

 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: 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: System Objects Retain System Object Properties

 INF: Table Permissions Changes Not Effective with Open Form

 INF: Temporarily Disabling a Macro Action

 INF: Tile, Cascade Menu Options Inconsistent with Prog Manager

 INF: Tips for Debugging Access Basic Code

 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 for Library Being Opened Before Database

 INF: Trapping SQL Server RAISERROR() Function Values

 INF: Troubleshooting Setup and Installation Problems

 INF: Two Functions to Calculate Age in Months and Years

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

 INF: Two Users Can Open the Same dBASE Database Exclusively

 INF: Two Ways to Edit Forms Without Adding New Records

 INF: Unexpected Stored Procedures Found in SysObjects Table

 INF: Updating a Separate Table When a Value Changes on a Form

 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 of Constants as Field Names in a Query

 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 a Conditional Macro to Confirm Changes to a Field

 INF: Using a Form Reference Parameter Query in Access Basic

 INF: Using a Subtract Query to Find Unmatched Records

 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 Indexes in Microsoft Access

 INF: Using Microsoft Access Macro to Quit Windows

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

 INF: Using PrtDevMode Property to Set Print Setup Dialog Box

 INF: Using SetSysModalWindow API Call in Access Basic

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

 INF: Using SQL Server ODBC Driver with Sybase Servers

 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 Windows 3.1 API to Connect to Network Resources

 INF: Using TransferDatabase Macro to Attach to SQL Server Data

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

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

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

 INF: Validating Data with Values From Another Table

 INF: Validation Rule to Accept Only Alphabetic Characters

 INF: Validation Rule to Require Uppercase in a Field

 INF: Version 1.1 Online Help and Text Files

 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: "Database Already in Use" Error After Running Query

 PRA: "Illegal Function Call" Error When Exporting Module

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

 PRA: "Invalid Argument" Error Message Exporting Table

 PRA: "Invalid Reference to Field in Query" Error Message

 PRA: "Table Does Not Exist" Error Message When Deleting Table

 PRA: 255-Char String Displays Only 254 Characters with ODBC

 PRA: Access Hangs Importing Big Lotus 1-2-3 Spreadsheets

 PRA: ApplyFilter Action Causes Form to be Read- Only

 PRA: Cannot Add Counter Columns to Tables with > 4 MB Data

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

 PRA: Cannot Export Paradox/dBase Tables

 PRA: Cannot Paste Data from Clipboard Using DDE

 PRA: Cannot Unhide Windows After "Out of Memory" Message

 PRA: Combo or List Box Column Not Formatted

 PRA: Control Still Appears on Page After GotoPage Action

 PRA: Creating Unbound Object Frame with CreateControl()

 PRA: Crosstab Query with DLL Reference Fails

 PRA: Cue Cards Cannot Be Started from Workstation

 PRA: Dashed Lines in Graph Print as Solid Lines

 PRA: Database Corruption Error After Large Action Query

 PRA: DDEInitiate from Word Fails When Access Not Running

 PRA: DoMenuItem Run Macro Causes GP Fault

 PRA: Duplicate Control Menus and Restore Buttons on Form

 PRA: ERR: Undefined Function Referencing Column Property

 PRA: Error Message Using Access Basic to Import File

 PRA: Error Msg: Data Has Changed, Operation Aborted

 PRA: Error Previewing Subreports that Call Filter Macro

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

 PRA: Error: Not Enough System Resources in Access

 PRA: Formatted Memo Truncates Data at 255 Characters

 PRA: GP Fault Importing Multiuser Microsoft Excel Spreadsheet

 PRA: GP Fault in Datasheet View of a Form

 PRA: GP Fault Printing Large Report with Low Disk Space

 PRA: GP Fault When Allocating Huge Arrays

 PRA: GP Fault when Creating a Dynaset from Form Dynaset

 PRA: GP Fault When Passing User-Defined Type with Array

 PRA: GP Fault When RunningSum Tries to Evaluate #ERROR

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

 PRA: GPF Declaring New Object Variable During Break Mode

 PRA: Group Footer Controls Calculate Twice at Page Break

 PRA: Hang Importing .DBF Files Longer Than dBASE IV Max.

 PRA: Hard-Coded and Passed Wildcards Different in Query

 PRA: Help Context ID Property Does Not Work in Subform

 PRA: Hidden Subform Maximized If Main Form Is Maximized

 PRA: Import/Append Actions Return Errors for Each Record

 PRA: Importing Delimited Text Files Strips Off Decimals

 PRA: Importing Numeric Column Names in Spreadsheets

 PRA: Incorrect Action Query Message Box Text

 PRA: Incorrect Install Directory with Workstation Setup

 PRA: Invalid Characters Added to IN Clause Arguments

 PRA: Invalid Results in Subreport When CanGrow = Yes

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

 PRA: Microsoft Access Closes Abnormally from a Macro

 PRA: Minimize MS Access with Cue Cards, System Hangs

 PRA: MS Graph Not Registered Correctly in Network Setup

 PRA: Multiple Users Adding Fields Causes Cross- Linking

 PRA: Network Setup (/N) Fails After Network Error

 PRA: Null Boolean Values Default to False

 PRA: Numeric Column Names Ignored in Spreadsheet Import

 PRA: OLE Objects Clipped Using Fahrenheit Video Driver

 PRA: OLE Objects Seem to Be Acceptable Filter Criteria

 PRA: Open OLE Objects Not Saved When Record Changes

 PRA: Opening Objects in Transactions Can Cause Rollback

 PRA: Options in Form and Report Wizards Are Not Displayed

 PRA: Oracle Driver Errors on Delimited Column Names

 PRA: Orders Form Doesn't Print/Preview SubTotal & Total

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

 PRA: Password Is Case-Sensitive But Verification Is Not

 PRA: Print Quality Always Defaults to Highest Mode

 PRA: Printer Fonts Cause Text to Shift Down and Right

 PRA: Problem Exporting "Single" Numeric Data to MS Excel

 PRA: Problems Opening a Modal and Pop-Up Form as Dialog

 PRA: Query Progress Meter Reports Status Incorrectly

 PRA: Referential Integrity Error Message with Shared Databases

 PRA: Report Prompts Twice for Same Parameter Value

 PRA: Reserved Error (-1603) Previewing a Report

 PRA: Reserved Error -1001 with Linked Crosstab Subreport

 PRA: Run-Time Error Occurs Calling Financial Functions

 PRA: Run-Time Version Partially Displays Sorting And Grouping

 PRA: RunMacro May Not Work with Large Repeat Count

 PRA: Selecting Options in Find Dialog Box

 PRA: Sent Keys Lost if Microsoft Access Yields Processor

 PRA: Setting OLE Object Property May Cause GP Fault

 PRA: Setup (STFSETUP) GP Faults in Windows Standard Mode

 PRA: Setup Cannot Recognize Forward Slash in Path

 PRA: Setup Writes Over Newer CTL3D.DLL File

 PRA: SQL Delete Triggers Function Incorrectly

 PRA: SQORA.DLL Does Not Allow Lengthy SQL Statements

 PRA: SQORA.DLL Does Not Allow Lengthy SQL Statements

 PRA: StDevP() with All NULL Records Returns #ERROR

 PRA: STFSETUP.EXE Does Not Overwrite Existing SYSTEM.MDA

 PRA: Timeout While Waiting for DDE Response

 PRA: Transaction Limit Can Cause "Out of Memory" Error

 PRA: TransferSpreadsheet Causes Error -1310

 PRA: TrueType Fonts Shift Vertically on HP LJ4 Printer

 PRA: Unique Values Only Select Query Shows Duplicates

 PRA: Update or Delete Query Fails Without Generating Error

 PRA: User with Full Permissions Cannot Run Query

 PRA: Windows Setup Ignores ADK, ADT applications

 PRB:  GoToRecord Macro Does Not Work on Subform

 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: "Can't Update Currently Locked" Attaching FoxPro Table

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

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

 PRB: "Couldn't Open File" Error Message

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

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

 PRB: "Error Writing to File 'MSAIN100.DLL'" During 1.1 Install

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

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

 PRB: "Invalid Database Object" Error Message

 PRB: "Invalid Range" Error When Importing from MS Excel

 PRB: "Invalid Range" Error When Importing Spreadsheet Range

 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: "Object not Found..." Error When Compacting Database

 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 When Exporting Table

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

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

 PRB: "Outdated COMMDLG.DLL" Error Message During Setup

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

 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: '|' Isn't A Valid Path Error Message on Start Up

 PRB: 'Unable to Load Communication Module'

 PRB: <Expression> Not Part of Aggregate Function or Grouping

 PRB: AccessWizards Button Unavailable

 PRB: ADK Custom Setup Hangs During Installation

 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: Bitmap May Not Display Correctly

 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: Can't Create Two Relationships Between Same Tables

 PRB: CancelEvent Action in OnClose Macro Prevents Exit

 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 Auto Update an OLE-Linked Object in a Table

 PRB: Cannot Change Combo Box Value If ControlSource Is Counter

 PRB: Cannot Change the RecordSource of a Form at Run Time

 PRB: Cannot Connect DDE from Word 6.0 to Microsoft Access

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

 PRB: Cannot Edit Data Using Query with Attached dBASE Table

 PRB: Cannot Import YYMMDD Dates in Fixed-Width Text Files

 PRB: Cannot Install Cue Cards Without Installing Help in Version

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

 PRB: Cannot Open Multiple Instances of the Same Form

 PRB: Cannot Perform OpenTable Method on an Attached Table

 PRB: Cannot Rollback in Transaction without Closing Database

 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: Cannot Write README.TXT Error Msg During Installation

 PRB: Close Action from Function Does Not Trigger OnClose Error

 PRB: Closing Forms, Tables, or Queries Is Slow

 PRB: Column Widths in Table Design Not Saved

 PRB: Company Pick List in Suppliers Form Doesn't Filter

 PRB: Compile Error When Attempting to Use an AccessWizard

 PRB: Concatenation of Memo Fields Creates Text Field

 PRB: Creating Multiple New Import/Export Specifications

 PRB: CTRL+' Does Not Trigger Update Events in Datasheet View

 PRB: CueCards Started Outside MS Access Does Not Work

 PRB: Databases Truncated with LAN Manager 2.1a and Earlier

 PRB: Date/Time Formats Not Used In List or Combo Box Controls

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

 PRB: DateDiff "W" Option Does Not Work

 PRB: DateDiff() Function Returns Incorrect Value

 PRB: DDE App Name for Access Is Incorrect in Manual

 PRB: DDEPoke to Word for Windows Incorrectly Formatted

 PRB: Default Values Used Only with a Bound Control

 PRB: Default Width in Report Design Does Not Reflect Margins

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

 PRB: Do Not Have Permissions to Modify Secured Report

 PRB: Domain Param. of Domain Function Cannot Be SQL Exp.

 PRB: Driver Cannot Be Found When Attaching to SQL Server

 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 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 Attaching Btrieve Table

 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 Message: Must Run SETUP /A Before Running SETUP /N

 PRB: Error Using Automatic ODBC Setup with Auto Switch

 PRB: Error When Installing Access on DEC Pathworks Network

 PRB: Error When Opening Attached Table in Shared .MDB File 1.x

 PRB: Error While Importing FoxPro Table Structure

 PRB: ESC While Creating Control Does not Deselect Control

 PRB: Every Other Page Blank in Printed Reports

 PRB: Exclusively Locked Error When Attaching to Btrieve Table

 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: Find Company Macro Does Not Work Correctly in NWIND.MDB

 PRB: Floating Objects Can Cause Unusual Effects

 PRB: Fonts May Change Zooming Out in Print Preview

 PRB: Form Handle Not Released When Closed with Basic Code

 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: Full Path Causes Endless Loop in StartApp() Example

 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: Incorrect Btrieve Error Message, [Btrieve ISAM] section

 PRB: Incorrect Catalog Stored Procedures Error Message

 PRB: Incorrect Time Calculations in Years Prior to 1900

 PRB: Index Does Not Work in AB Function with NWIND.MDB

 PRB: Insert Object Dialog Box Has No "All Files" (*.*) Option

 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: List Box Column Property Gets Incorrect Row Information

 PRB: List Box Not Dimmed When Disabled

 PRB: ListTables Method Returns Odd Names

 PRB: Locking First Record Also Locks Last Record

 PRB: Low Number of Share Locks Can Cause Error Message

 PRB: Macro Condition Evaluates True if Control Is Null

 PRB: Macro Condition Example Using COUNT() Is Incorrect

 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: Memory or Disk Space Problems Using MS-DOS 6.0

 PRB: Microsoft Access Can't Recognize SQL Server Double Index

 PRB: Microsoft Access GP Faults with ATI Ultra Video Card

 PRB: Microsoft Excel Custom Date Format Not Detected by Import

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

 PRB: MS Access Short and Medium Time Formats Have Leading Zero

 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: No System Table Permissions After Admin User Deleted

 PRB: Not Enough Stack Memory When Opening Form

 PRB: Nulls Not Concatenated with "+" Operator

 PRB: NWIND Order Form Updates Order Amount Field with Zero

 PRB: Objects Cannot Be User-Defined Data Type Elements

 PRB: OnDblClick Macro Requires CancelEvent to Change Focus

 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: Parameters Expected When Navigating Form with Sub-subform

 PRB: Paste Unavailable After Record Is Copied to Clipboard

 PRB: Print Preview of Datasheet Does Not Show Data

 PRB: Printing on Avery 5267 labels

 PRB: Queries Sent to Remote SQL Server Run Slowly

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

 PRB: Query Error Caused by Colon in Field Name

 PRB: Query Fails When Linked SQL Server Table Cannot Be Found

 PRB: Query Results in "Overflow" Error Message

 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: Remote ODBC Tables Are Read-Only Without a Unique Index

 PRB: Removing User Admin from Admins Group Cannot Be Reversed

 PRB: Report Detail Items Appear in Group Header

 PRB: Report Grouping on Date/Time Field Incorrect

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

 PRB: Report Property PageFooter Set to "Not With Rpt Ftr"

 PRB: Rounding Errors Importing/Exporting dBASE IV Values

 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: Setup Program STFSETUP.EXE Causes GP Fault

 PRB: SetWarnings Action Works Only While Macro Is Running

 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: System Error When Sharing Database on LAN Man/Workgroups

 PRB: Toolbox Selection Lost When Toolbox Is Closed

 PRB: TransferDatabase Macro Accepts Invalid File Names

 PRB: TransferDatabase Macro Action Does Not Replace Table

 PRB: TransferText Action Removes Spaces from Field Names

 PRB: Troubleshooting "Out of Memory" Errors in Queries

 PRB: Troubleshooting 'ODBC - couldn't find ODBC.DLL' Error

 PRB: Two Error Messages with Database on Workgroups Server

 PRB: Type Conversion Failure when Importing Excel Data

 PRB: Typing in Combo Box Does Not Select Item

 PRB: Unable to Change Permissions (Security)

 PRB: Unable to Close Microsoft Access from Control-Menu Box

 PRB: Unable to Connect to Attached SQL Server Table, Error Msg

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

 PRB: UndoCurrentRecord In BeforeUpdate Property Causes Error

 PRB: Unexpected Results with Make-Table or Append Query

 PRB: Update Queries Do Not Check Validation Rules

 PRB: Update Query Based on Totals Query Fails

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

 PRB: Updated Help Compiler Needed for Word 6.0 RTF Files

 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: Where Condition Refers to Fields Not Controls

 PRB: White Lines or Missing Data When Printing Reports

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

 WX0964: SecurityWizard and White Paper Application Note

 More Information on the Knowledge Base

 Survey for KB Help Users


More Information on the Knowledge Base
 Access 1.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 1.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: "Fieldname" Is Not an Index in This Table

Article ID: Q97001

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SYMPTOMS

========

When you run an Access Basic function that attempts to perform a

Seek method on a table, you receive the following error message

   '<Fieldname>' isn't an index in this table.

where <Fieldname> is the name of a field in your table that has been

defined as an index in your function. This field is also the primary

key in the table.

CAUSE

=====

When you set the Index property in your function and you are

referring to a primary key field, you should refer to the field as

PrimaryKey; that is, do not refer to the field by the name of the

field.

RESOLUTION

==========

Change the statement in your function that sets the current Index

property. The correct syntax should resemble the following:

   EMPTable.Index = "PrimaryKey"

MORE INFORMATION

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

The following example is based on the sample database NWIND.MDB:

Steps to Reproduce

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

1. Create a new module and enter the following function:

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

      'Declarations section of the module.

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

      Option Explicit

      '=============================================

      ' This FINDID function accepts one parameter.

      '=============================================

      Function FINDID (EMPLOYID As String)

         Dim db As Database, EMPTable As Table

         Set db = CurrentDB()

         Set EMPTable = db.OpenTable("Employees")

         EMPTable.Index = "EMPLOYEE ID"

         EMPTable.Seek "=", EMPLOYID

            If EMPTable.NoMatch Then

               MsgBox "Not a valid ID. Try another"

            Else

               MsgBox "This Employee ID is in the table!"

            End If

         EMPTable.Close

      End Function

2. From the View menu, choose the Immediate window.

3. Enter the following statement in the Immediate window:

      ? FINDID("1")

   You will see the following error message:

      'Employee ID' isn't an index in this table.

   NOTE: The Employee ID field has been defined as the primary key in

   the Employees table.

4. Change the EMPTable.Index statement to the following:

      EMPTable.Index = "PrimaryKey"

5. Repeat step 3.

   You will see the appropriate message box indicating whether you

   entered a valid number.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, page 114

Additional reference words: 1.00 1.10 seek find errmsg docerr

KBCategory:

KBSubcategory: PgmObj


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: "Invalid Path" Error Message on Network Installation

Article ID: Q109316

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

After performing a network installation of Microsoft Access using the

SETUP /A command to set up the server, and the SETUP /N command to set up

the workstation, you receive an "Invalid Path" error message when you try

to start Microsoft Access.

MORE INFORMATION

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

During the installation process Microsoft Access checks to see what type

of network you are running. If the network type is Microsoft LanMan,

Windows for Workgroups, or WindowsNT, Microsoft Access will write the

paths of necessary files in the MSACCESS.INI file using the uniform naming

convention (UNC). With other network types, the paths of necessary files

are written using drive letter references.

In either case, the server name must be 11 characters or less in length,

and must use no more than three characters as an extension. This is

standard MS-DOS naming convention.

Filing systems like WindowsNT's NTFS, OS/2's HPFS, UNIX's POSIX, and

Novell's Netware use naming conventions that do not follow standard MS-DOS

naming conventions. This can cause the error message stated above when

Microsoft Access tries to locate a server that is identified in the

MSACCESS.INI file.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.1, Appendix D, "Setting Up

Microsoft Access on a Network"

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: StpNet


INF: "Unexpected Error 1031" Using the SecurityWizard

Article ID: Q109408

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SYMPTOMS

========

When you are using the Microsoft Access SecurityWizard, you receive the

error message "Unexpected Error 1031" after the SecurityWizard has

transferred the database objects.

CAUSE

=====

This error can occur if you are using the WZSECURE.MDA with Microsoft

Access running under Windows 3.1 and do not have the MS-DOS SHARE.EXE

program loaded on your computer.

RESOLUTION

==========

Load the MS-DOS program SHARE.EXE with the following steps:

1. Quit Microsoft Access.

2. Quit Microsoft Windows.

3. Add the following line to your AUTOEXEC.BAT file and then save the

   file:

      C:\DOS\SHARE.EXE /L:500

4. Restart your computer and run the SecurityWizard again.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ScrtOthr


INF: Access Basic and Macros Questions & Answers

Article ID: Q104389

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

        WX0636: ACCESS(R) BASIC AND MACROS QUESTIONS & ANSWERS

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

                                                   Revision Date: 9/93

                                                      No Disk Included

The following information applies to Microsoft Access, versions 1.0,

and 1.1.

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

| 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) 1992-1993 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 can I run macros from Access Basic?

    A. The following are three suggested ways to run macros from

       Access Basic:

       - Create the macro using the macro editor and then call it from

         your Access Basic procedure. For example, if you create a macro

         called Macro1, you can call the macro from a procedure with the

         following command:

            DoCmd RunMacro "macro1"

       - Call the macro from the Immediate window using the same syntax

         as you would in Access Basic. Again, the syntax is as follows:

            DoCmd RunMacro "macro1"

       - Use DoCmd to run a macro action, rather than creating a macro

         specifically for that action. The basic format of DoCmd is as

         follows:

            DoCmd <Action> <Argument1>, <Argument2>

         For more information on DoCmd, RunMacro, and macro actions,

         please refer to the "User's Guide" and "An Introduction to

         Programming;" or, search Help on the keywords DOCMD and

         Expressions in Macros and Actions.

2.  Q. When should I use the Variant data type?

    A. Use the Variant data type if you are unsure what type of data

       you are working with. When you use the Variant data type,

       Microsoft Access evaluates the data and then handles it

       appropriately. Using variants avoids the step of assigning data

       types to variables and manually converting data types in your

       programs. Further, when you store table data in variables,

       using variants eliminates complications with NULL data values.

3.  Q. How do I comment out a macro action?

    A. With the macro in Design view, choose Conditions from the View

       menu. This adds the Condition column to the macro design. Type

       "false" (without the quotation marks) on the condition line for

       the macro action you want to comment out.

4.  Q. How do I bypass the AutoExec startup macro when I open a

       database?

    A. Hold down the SHIFT key when you open the database to prevent

       Microsoft Access from executing that database's AutoExec macro.

5.  Q. How do I include a variable or form reference in the WHERE

       clause of my SQL statement?

    A. The syntax for including a variable or form reference in the

       WHERE clause of an SQL statement depends on the data type of

       the variable. Numeric variables do not require delimiters,

       string variables should be enclosed in single quotation marks,

       and date variables require the number sign (#). You must

       concatenate the variable and use the appropriate delimiter, if

       required, as shown in the examples below:

       For a numeric variable, use the following syntax:

          myq.sql = "select * from orders where [employee id]=" &

          mynum & ";"

       For a string variable, use the following syntax:

          myq.sql = "select * from orders where [customer id]='" &

          mytext & "';"

       For a date variable, use the following syntax:

          myq.sql = "select * from orders where [order date]=#" &

          mydate & "#;"

       For additional information on concatenating variables, please

       obtain Technical Note #96576. You can order this technical note

       by selecting the FastTips Technical Library option from the

       FastTips Main Menu.

Additional reference words: 1.00 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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: Access Workstation Setup (/N) Instructions Are Confusing

Article ID: Q97771

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

When you set up Microsoft Access to run from a network server, the on-

screen instructions are misleading. This article explains which files are

copied to your hard disk (or user directory) when you choose to run

Microsoft Access from the network server.

MORE INFORMATION

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

The SETUP /N command for installing Microsoft Access on a workstation

displays the following question:

   Do you want to install Microsoft Access on your hard disk?

To run from the network server instead of your local hard disk drive,

choose No. If you do so, Setup then presents the following message:

   Setup will install Microsoft Access in the following directory,

   which will be created if it doesn't already exist.

This is confusing because it implies that a full copy of Microsoft

Access will be installed on you local hard disk drive. This is not the

case. Only the following files will be copied:

In the ACCESS directory:

   DETCMD.DLL

   SETUP.INI

   STFSETUP.EXE

   STFSETUP.INF

   SYSTEM.MDA  <- Only if a workgroup is not joined

In the Windows directory:

   MSACCESS.INI

   WINHELP.EXE  <- If not Windows v3.1 or above

   WINHELP.HLP  <- If not Windows v3.1 or above

   WINHELP.INI  <- If not Windows v3.1 or above

In the WINDOWS\SYSTEM directory:

   CTL3D.DLL

   COMMDLG.DLL  <- If not Windows v3.1 or above

   DDEML.DLL    <- If not Windows v3.1 or above

   OLECLI.DLL   <- If not Windows v3.1 or above

   OLESRV.DLL   <- If not Windows v3.1 or above

   SHELL.DLL    <- If not Windows v3.1 or above

   VER.DLL      <- If not Windows v3.1 or above

These are the necessary files for running Microsoft Access from the

network.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: StpNet


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

Article ID: Q93691

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article includes additions to the Microsoft Access "User's Guide,"

Appendix A, "Microsoft Access Specifications." Note that some but not all

of this information may already be in the Microsoft Access "User's Guide."

MORE INFORMATION

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

Tables

------

Attribute                                          Maximum

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

Number of primary key fields and matching fields

  when defining a relationship between tables      5

Queries

-------

Attribute                                          Maximum

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

Number of characters in a cell                     255

Number of GROUP BY fields in a totals query        10

Number of fields allowed when query property

  UniqueValuesOnly is selected (SELECT DISTINCT)   10

Number of ANDs in a WHERE clause (criteria)        40

Number of ANDs in a HAVING clause                  40

Additional reference words: 1.00 1.10 queries tables limits limitations

spec

KBCategory:

KBSubcategory: GnlApp


INF: Aligning User-Defined Formats in Text Fields

Article ID: Q106293

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The Format Property topic in the Microsoft Access Help system states the

following:

   NOTE When you create a user-defined format, the alignment defaults

   to right-aligned. Use an exclamation point to force left alignment.

This information is not true for fields with a text data type. Fields with

a text data type will be left-aligned.

MORE INFORMATION

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

Steps to Reproduce Behavior

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

1. Open the sample database NWIND.MDB.

2. Open the Suppliers table in Design view.

3. Select the Region field, and then enter the following user-defined

   format in the field's Format property:

      @;none

3. View the table in Datasheet view.

Note that the field is left-aligned. To right-align the field, use the

following sample user-defined format:

   /@;none

REFERENCES

==========

For more information on the Format property, search for "format" then

"Format Property" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlFrmt


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: Attaching to FoxPro Data in Microsoft Access

Article ID: Q94193

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

The information in this article applies to:

 - Microsoft Access version 1.0

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

SUMMARY

=======

According to the marketing literature, Microsoft Access cannot attach

FoxPro data, but is able to import FoxPro data. There is an exception to

this rule, which allows a user to attach, rather than import, FoxPro

data.

MORE INFORMATION

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

FoxPro uses a DBF file structure, similar to the structure that dBASE

uses. However, Microsoft Access cannot attach most FoxPro files because

the memo and index structures are different. Consequently, you can attach

a FoxPro table as a dBASE IV table if it meets the following two

conditions:

 - The FoxPro table does not contain any memo fields

 - The FoxPro table is attached without any FoxPro index files

If either of these conditions is not met, then you must import the data

from the FoxPro table instead of attaching it.

Additional reference words: 1.00

KBCategory:

KBSubcategory: IsmXbase


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 6.0 Data Type Does Not Work with Microsoft Access

Article ID: Q93687

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Microsoft Access was not tested with Btrieve version 6.0. Therefore,

new data types introduced with this version of Btrieve may not be

compatible with Microsoft Access.

MORE INFORMATION

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

Btrieve 6.0 introduced the new data type Negative Sign Trailing Numeric

Field. Microsoft Access does not explicitly translate this data type.

REFERENCES

==========

Microsoft Access "User's Guide," versions 1.0 and 1.1, Chapter 4,

"Importing, Exporting, and Attaching," page 66

Additional reference words: 1.00 1.10

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: Cannot Create Relationships with Attached Tables

Article ID: Q98228

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

You cannot create a relationship between a Microsoft Access table and an

attached table. Relationships can be created only between Microsoft Access

tables. Any joins involving attached tables must be created using the

query grid.

MORE INFORMATION

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

To establish a relationship between Microsoft Access tables, do the

following:

1. Open a Microsoft Access database. By default, the Database window

   has the focus.

2. From the Edit menu, choose Relationships.

3. Select a table from the Primary Table list box. Note that no

   attached tables appear on the list.

REFERENCES

==========

For more information, search for "relationships between tables", then

"Defining Relationships Between Tables" using the Microsoft Access

Help menu.

Additional reference words: 1.00 1.10 Tables ISAM

KBCategory:

KBSubcategory: TblOthr


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: 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: Changing the Relationship Between Two Existing Tables

Article ID: Q95058

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

You can change an ID field from a Long Integer or other data type to a

Counter data type in the table on the one-side of a one-to-many

relationship and change the ID values in the corresponding records in the

many-side table while still maintaining the links between the two tables.

MORE INFORMATION

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

The following example uses the sample database NWIND.MDB to show you how to

change the ID values in the Customers table (the one-side table) and update

the values in the Orders table (the many-side table) so that the records in

the two tables are still linked:

1. Add the following fields to the Customers and Orders tables:

      Table: Customers

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

      Field name: New ID

         Data Type: Counter

      Table: Orders

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

      Field name: New ID

         Data Type: Number

         Field Size: Long Integer

2. Create a new query. Add the Customers and Orders tables to the query.

   Make sure the tables are joined on Customer ID.

3. From the Query menu, choose Update.

4. Add the following field and properties to the query grid:

      Update Query: Query1

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

      Field name: Orders.New ID

         Update To: [Customers].[New ID]

   When you type Orders.New ID into the Field name cell, the Orders

   table name disappears. From the View menu, choose Table Names to

   see all the table names displayed on the grid.

6. To run the query, click the Run button on the tool bar.

7. Close the query. You do not need to save it.

If there is a relationship already defined for the two tables, you need

to remove it. For example, the NWIND database has a defined relationship,

so you need to remove it.

To remove the original relationship between tables:

1. Press F11 to give the Database window the focus. From the Edit

   menu, choose Relationships.

2. Select Customers for the Primary Table and Orders for the Related Table.

   Customer ID automatically appears in Select Matching Fields.

3. Choose the Delete button to remove the relationship. Then close the

   dialog box.

Next, remove the original ID field and rename the new one in the Customers

table:

1. Open the Customers table in Design view.

2. Delete the Customer ID field.

3. Change the name of New ID to Customer ID and make it the primary key.

4. Close the table, and save the changes.

Then remove the original ID field and rename the new one in the Orders

table:

1. Open the Orders table in Design view.

2. Delete the Customer ID field.

3. Change the name of New ID to Customer ID.

4. Close the table, and save the changes.

Now you can redefine the relationship between the tables. From the Edit

menu, choose Relationships.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RltOthr


INF: Changing the RowSource of a ListBox/ComboBox at Runtime

Article ID: Q92897

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The RowSource property for a combo box or list box cannot be modified

while the form is active. However, there is a workaround for changing the

recordset that the object is bound to. This article discusses that

workaround.

MORE INFORMATION

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

The workaround for this problem is to bind the object to a query, then

manipulate the query's recordset underneath the object. For example, you

would bind the object to a query called Query1, then create a new query

called Query1 programmatically, while the object is active.

The following example illustrates this technique. In this example, there

is a combo box bound to data from the Products table in the sample

database NWIND.MDB. By selecting one of two check boxes, the order of

records in the combo box will be changed:

1. Create a form with an option group control called MyOption, and a

   combo box called MyCombo.

2. Add two check box controls to MyOption and specify the following

   property:

      AfterUpdate: =NewOrder([MyOption])

3. For MyCombo, specify the following properties:

      RowSourceType: Table/Query

      RowSource: DeleteMe

      ColumnCount: 2

      Locked: True

      Enabled: False

4. Add the following function to a module in the 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.

      Option Explicit

      Function NewOrder (WhichSort%)

         DoCmd Hourglass True

         Dim D As Database, Q As QueryDef

         Set D = CurrentDB()

         Screen.ActiveForm!MyCombo.Enabled = True

         Screen.ActiveForm!MyCombo.Locked = False

         On Error Resume Next

         D.DeleteQueryDef ("DeleteMe")

         On Error GoTo 0

         If WhichSort = 1 Then

            Set Q = D.CreateQueryDef("DeleteMe",_

                   "SELECT [Product ID], [Category ID]_

                   FROM Products ORDER BY [Product ID];")

         Else

            Set Q = D.CreateQueryDef("DeleteMe",_

                   "SELECT [Product ID], [Category ID]_

                   FROM Products ORDER BY [Category ID];")

         End If

         Q.Close

         D.Close

         DoCmd Requery "MyCombo"

         DoCmd Hourglass False

      End Function

5. Open the form, select one of the check boxes, and open the combo box.

   Note the order of the records in the combo box.

6. Select the other check box and open the combo box again. Note that the

   records' order has changed.

The key to changing the recordset is in Step 4. By using different SELECT

statements for the CreateQueryDef() methods, you can create any kind of

query.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsCmbo


INF: Checking for Last or First Record in a Macro

Article ID: Q95807

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

In a macro, you cannot check the result of an action just performed. As a

result, you can run into a problem when using a macro to move to the next

record or the previous record. There is no record previous to the first

record and no next record following the last record. If you attempt to go

to the previous or last record when there is none, Microsoft Access

displays error messages that may confuse users of a custom application.

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

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

You can work around this on a form by using Access Basic functions to

move from record to record. For example, use the following custom

MoveToNext() function to move to the next record or previous record on a

form:

   Option Explicit

   Function MoveToNext (DisplayMsg$, MoveForward%)

      Dim MyDyna As Dynaset

      Set MyDyna = Screen.ActiveForm.Dynaset

      MyDyna.Bookmark = Screen.ActiveForm.Bookmark

      If MoveForward% Then

         MyDyna.MoveNext

      Else

         MyDyna.MovePrevious

      End If

      If MyDyna.EOF Or MyDyna.BOF Then

         MsgBox DisplayMsg$

      Else

         Screen.ActiveForm.Bookmark = MyDyna.Bookmark

      End If

   End Function

To use the MoveToNext() function, specify the following:

 - The name of the function.

 - The message you want displayed if the current record is at the end or

   the beginning of the record set.

 - "True" if you want to move to the next record. "False" if you want to

   move to the previous record.

For example:

   OnPush: =MoveToNext("You are at the end of the record set", True)

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: McrOthr


INF: ComboBox On Toolbar Do Not Use Window Background Color

Article ID: Q90852

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The Microsoft Access combo box on the toolbar does not use the window

background color, so changing the background color from the Color utility

in the Control Panel does not have any effect.

MORE INFORMATION

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

Microsoft Access toolbars are predefined forms. There is no way to specify

the windows background as a color on a form. If you want to change colors

in Microsoft Access, you can open and edit the forms in UTILITY.MDA. If you

modify UTILITY.MDA, make sure to back up the UTILITY.MDA file before you

make any modifications.

Steps to Reproduce Behavior

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

1. Change the Window Background color in the Control Panel.

2. Start Microsoft Access and open the sample database NWIND.MDB.

3. Select the Table command from the View menu.

4. Select the Customer table by double-clicking it.

At this point the "Field:" drop-down combo box still has a white

background.

Additional reference words: 1.00 1.10 combobox

KBCategory:

KBSubcategory: FmrColr


INF: Commonly Asked Questions About MS Access Version 1.0

Article ID: Q90866

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

The information in this article applies to:

 - Microsoft Access version 1.0

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

SUMMARY

=======

Commonly asked questions about Microsoft Access version 1.0 are listed

below.

MORE INFORMATION

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

1.Q. Is it possible to customize the Help file in Microsoft Access?

  A. Customized Help files can be used only in Microsoft Access forms.

     Use the HelpContextId and HelpFile properties of the form to

     reference a Help file previously constructed with the Microsoft

     Windows Help Compiler. For more information on this, search for

     "HelpContextId" in the Microsoft Access online Help.

2.Q. Is it possible to set up a many-to-many relationship?

  A. No. The only kinds of relationships you can define are

     one-to-many and one-to-one. It is generally not a good database

     design to have many-to-many relationships. An alternative is to

     build a linking table between two tables that have a many-to-many

     relationship. For example, if you had an "Employees" table and a

     "Job Skills" table, each employee may have many skills, and each

     skill could belong to more than one employee--a many-to-many

     relationship. To work around this, you would build a linking

     table "EmpSkill" that had two columns, EmpID and SkillID, to

     relate the two tables.

3.Q. Where are OLE objects (such as the pictures in the Employees table

     in NWIND.MDB) stored?

  A. OLE objects can be either linked or embedded. Embedded objects

     are stored inside the .MDB file. Linked objects point to a file

     located external to the database, and are therefore not stored in

     the .MDB file. Since the Employees' pictures within NWIND.MDB are

     embedded OLE objects, the pictures are stored in NWIND.MDB.

4.Q. How can I tell if an OLE object is embedded or linked?

  A. To tell if an object is linked or embedded, first select the

     object, then choose the last command on the Edit menu. The

     command name varies depending on the object type. (For example,

     "Paintbrush Picture Object," "Microsoft Excel Worksheet Object,"

     and so on.) When the option is highlighted or selected, a submenu

     appears to the right of the menu. If the object in question is an

     embedded object, the Change Link option will be unavailable

     (dimmed). If it is a linked object, the Change Link option will

     not be dimmed.

5.Q. Is all the information (tables, queries, reports, and so on) that

     appears as part of a database actually stored in the database?

  A. All database information is stored in the database, with the

     exception of database "preferences" (choose Options from the View

     menu) and certain security information (users, their passwords,

     and group information), which are stored in the SYSTEM.MDA file.

6.Q. Is it possible to break out the information that is contained in a

     database (that is, tables) into individual files?

  A. You can use the Export option to export tables and other data to

     separate files (ASCII, dBASE, and so on). You can also export

     Microsoft Access objects to other Microsoft Access databases.

7.Q. Is some type of tool available that helps document applications?

     (For example, variables used, macros used, properties of different

     interface elements, and so on.)

  A. A tool called "Database Analyzer" is included with Microsoft

     Access that aids in this task. For information on using this

     tool, look in the PSSKB.TXT file, question number 23, or

     choose the Microsoft Access Q&A icon in the Access group in the

     Microsoft Windows Program Manager.

8.Q. Are memo fields part of a table, or are they stored in a

     separately linked file as is done in FoxPro, which has .DBF and

     .FPT files?

  A. They are part of a table and thus stored in the .MDB file.

9.Q. Can Microsoft Access create stand-alone applications?

  A. Currently, Microsoft Access does not create stand-alone

     applications. Since there is not yet a run-time version of

     Microsoft Access, a developer and his or her customers both

     require full working copies of Microsoft Access to run Microsoft

     Access applications. The developer distributes only the .MDB

     file(s) for the application to the customers.

     A run-time version of Microsoft Access is planned for the near

     future that a developer can distribute with his or her .MDB

     file(s) so that customers will not require a full working copy of

     Microsoft Access to run applications.

Additional reference words: 1.00 Misc Setup

KBCategory:

KBSubcategory: GnlOthr


INF: Comparison of Visual Basic 3.0 and Microsoft Access 1.1

Article ID: Q104065

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

The information in this article applies to:

 - Microsoft Access version 1.1

 - Microsoft Access Distribution Kit version 1.1

 - Microsoft Visual Basic Professional version 3.0

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

SUMMARY

=======

Microsoft is committed to continually enhancing its entire desktop

database tool family. The two main forces that guide future product

development plans are: responding to your needs through innovation and

solid execution, and sharing these innovations among products.

The innovations continue with the release of Microsoft Visual Basic

Professional Edition version 3.0 and its ability to directly manipulate

Microsoft Access databases. However, due to this enhanced functionality,

you may have questions about which product will best meet your database

needs. This article will try to help you make that decision by outlining

the important features of Microsoft Access version 1.1 and Visual Basic

Professional Edition version 3.0.

MORE INFORMATION

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

Microsoft Access Version 1.1

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

Microsoft Access is an interactive end-user tool optimized for

customizability and the creation of database solutions. It is designed

exclusively for database work, with simple, yet powerful, integrated

database tools. These tools, such as data-aware forms and reports, are

designed for manipulating data in the Microsoft Access user interface.

Manipulating form and report objects is easy with the use of macros and

the macro builder. Microsoft Access also contains the full- featured

Access Basic language, which is very similar to Visual Basic.

Microsoft Access does not provide the ability to create an executable

database file. This means that customers who receive your Microsoft

Access-developed applications must have either:

 - The retail version of Microsoft Access (note that any user who has a

   retail version of Microsoft Access can modify your applications unless

   you implement security on the database or its objects).

   -or-

 - The run-time version of Microsoft Access that is provided with the

   Microsoft Access Distribution Kit. The run-time package lets users run

   your application without having to own a full retail copy of Microsoft

   Access, and can be distributed with your applications royalty-free.

Microsoft Access Distribution Kit Version 1.1

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

The Microsoft Access Distribution Kit (ADK) contains a set of tools and a

run-time package for Microsoft Access. This run-time package allows you to

ship your Microsoft Access-designed applications to users who may not have

Microsoft Access installed on their computers. Note that modifications to

your application cannot be made when the application is running in the

run-time package.

The ADK comes with advanced developer tools, including:

   - Setup toolkit (includes .DLL file version check)

   - Help compiler

   - Documentation on how to create your own AccessWizards

Microsoft Visual Basic Professional Edition Version 3.0

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

Microsoft Visual Basic is optimized for programmer versatility and

extensibility. It is a tool not only for creating database applications,

but other applications as well. It can be used to create multi-function

applications with complete custom control over the user interface. Visual

Basic creates executable (.EXE) files, which contain precompiled code

tuned to load and execute, and are processed through a dynamic link

library (.DLL) called VBRUN300.DLL. The Visual Basic compiler is not

needed to run applications you develop.

Starting with Visual Basic Professional Edition version 3.0, the Microsoft

Access database engine is also included, giving you complete access to

Microsoft Access-created databases (which can include foreign database

format tables such as Paradox and Btrieve that can be attached to the .MDB

file). However, it does not give you access to other objects in the .MDB

file, such as reports and forms. There is no graphical means of defining

database queries, so you must construct them in code. Visual Basic also

does not provide the ability to modify the security of an .MDB file.

Instead, you must implement security through the Microsoft Access security

interface.

To distribute your Visual Basic applications, you need only distribute the

.EXE file that you developed, the VBRUN300.DLL file, the .MDB file, and

any other miscellaneous files your application requires. Users of your

applications are not required to have Microsoft Access or Visual Basic to

run your applications.

The only way that users can modify your application's objects is if you

implement the ability for them to do so in your code, or if you supply the

source code to your users.

Essentially, Microsoft Visual Basic gives you greater control and freedom

over creation of your applications, but also requires greater

responsibility on your part for managing the code, objects, and so on.

Features Comparison

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

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

      Microsoft Access           |    Microsoft Visual Basic

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

   Is an interactive, end-user   | Contains a full programmatic

   tool designed exclusively     | object layer for creating a

   for database development and  | run-time database solution.

   work.                         |

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

   Contains a full-featured      | Contains a full-featured

   report-writing tool allowing  | report writer with the

   flexible report writing       | ability to execute

   for a custom database         | predefined reports.

   solution.                     |

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

   Provides both macros and      | Includes the complete Visual

   Access Basic for driving      | Basic language set, plus a

   your applications.            | subset of Access Basic to

                                 | fully manipulate data.

                                 | NOTE: Microsoft Access macro

                                 | actions are not available to

                                 | Visual Basic executable(.EXE)

                                 | files.

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

   Supports attachment (either   | Can attach to the same

   programatically or through    | database formats supported

   the user interface) of        | in Microsoft Access through

   multiple external database    | attached tables in the .MDB

   tables of other formats,      | file.

   such as dBASE, Paradox,       |

   Btrieve, SYBASE, and so on.   |

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

   Has data-aware controls       | Has data-aware controls

   bound to data controls on     | bound to fields in the

   forms or reports.             | tables.

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

   Supports multiple subforms    | Can create multiple

   on forms. The data in the     | instances of MDI child

   subforms can be linked to     | forms. (However, you must

   fields on the parent form     | programmatically link the

   so that updates made to the   | data on the subform with the

   parent form are               | parent form.)

   automatically reflected in    |

   the subforms. This can be     |

   done by setting properties    |

   in the subforms without       |

   using code or macros.         |

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

   Is easy for new users to      | Includes full developer

   become immediately            | usability -- full debugging

   productive with. Cue Cards    | tools including watch

   -- automated task             | statements and call threads.

   teaching aids -- walk         |

   inexperienced users through   |

   such tasks as writing a       |

   macro, designing a query, or  |

   creating mailing labels.      |

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

   Is connectable. All project   | Code is in ASCII, in distinct

   code is stored in the         | modules, and works with CASE

   database file and is managed  | and SLM tools.

   through the easy-to-use       |

   Microsoft Access user         |

   interface. Code in other      |

   databases is accessible       |

   through the use of Microsoft  |

   Access libraries.             |

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

   Contains graphical, easy-to-  | Includes additional

   use tools for interactive     | developer tools for

   users:                        | commercial development:

                                 |

    - Report, form, and graph    |  - Setup toolkit for

      wizards (automated task    |    creating your own Help

      coordinators that make     |    files (includes .DLL file

      creation of reports,       |    version check)

      forms, and graphs easy)    |

                                 |  - Win API reference

    - Macros (for easy, fill-in- |

      the-blank programming )    |  - Help compiler (allows you

                                 |    to create your own Help

    - Graphical Query-by-        |    files)

      Example (for creating      |

      custom queries)            |

                                 |

    - Cue Cards                  |

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

   Uses user-friendly            | Has no object-creation user

   objects (such as macros,      | interface for constructing

   forms, reports and queries),  | queries. You either hard- code

   that are easy to implement    | a SQL string or construct the

   and modify.                   | query with code. Cannot read

                                 | any of the macros, modules,

                                 | forms, reports, or queries in an

                                 | .MDB file.

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

   Offers full-featured          | Cannot modify the security

   security on all objects.      | implemented in .MDB files, but

                                 | instead must obey the security

                                 | previously established on the

                                 | database objects. All security

                                 | must be established through the

                                 | Microsoft Access interface.

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

   Currently does not support    | Supports .VBX files for

   custom controls (.VBX         | additional add-on custom

   files).                       | controls.

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

   Efficiently uses system       | Uses true Windows controls

   resources, even displaying    | that you create on your

   large amounts of data in      | forms (not Microsoft Access-

   grid-like presentations.      | owned windows). As a result,

   However, in many instances,   | you have much more control

   Microsoft Access will use the | over them using standard

   same control to display       | Windows API function calls.

   several pieces of data in     | NOTE: Incorrect use of API

   the same window or form.      | function calls can lead to

   Because of this, you may find | resource inefficiency.

   that you do not have the same |

   fine control of objects that  |

   you have using standard       |

   Microsoft Windows API         |

   functions.                    |

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

Additional reference words: 1.10 differences

KBCategory:

KBSubcategory: MdlVb


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: Consecutively Numbering Pages for Two or More Reports

Article ID: Q100919

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

The information in this article applies to:

 - Microsoft Access version 1.0 and 1.1

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

SUMMARY

=======

This article describes how to consecutively number the pages of multiple

reports. For example, if the first report has 10 pages, the second report

will begin numbering at page 11.

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.

The following steps demonstrate how to consecutively number the pages of

multiple reports:

 1. Open a new or existing module and enter the following code:

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

       'Declarations Section of Module

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

       Option Explicit

       Global CurrPage As Integer

'======================================================

'This function returns the page number to be used in the

'consecutive report footer(s). It also increments the Global

'Variable CurrPage.

'======================================================

       Function GetPage ()

          CurrPage = CurrPage + 1

          GetPage = CurrPage

       End Function

'======================================================

       'This function is called by the first report to initialize the

        Global variable to 0.

'======================================================

       Function InitPage ()

          CurrPage = 0

       End Function

'======================================================

       'This function is called from the first report's page footer.

'======================================================

       Function SetPage (PgNumber As Integer)

          CurrPage = PgNumber

       End Function

 2. Open the first report in Design view by selecting the report in the

    Database window and choosing the Design button.

 3. From the View menu, choose Properties to display the property

    sheet.

 4. If the report does not already have a report header, choose Report

    Hdr/Ftr from the Layout menu.

    NOTE: If you do not want a report header or footer, simply resize

    the section to a height of 0.

 5. Click any portion of the report header section not covered by a control

    to display the report header properties.

 6. Set one of the following properties for the report header section:

       OnFormat: =InitPage()

       -or-

       OnPrint: =InitPage()

 7. Click any portion of the page footer section not covered by the

    control to display the Page Footer properties.

 8. Set one of the following properties for the page footer section:

       OnFormat: =SetPage(Page)

       -or-

       OnPrint: =SetPage(Page)

 9. Open the second report in Design view by selecting the report in

    the Database window and choosing the Design button.

10. Create a text box control in the page footer.

11. Set the following property for the text box control you just

    created:

       ControlSource: =GetPage()

12. Repeat steps 9-11 for any additional reports you want to number

    consecutively.

13. Print the reports in order. The pages will be numbered consecutively.

NOTE: To ensure that the reports are numbered correctly, you should print

the reports consecutively without previewing each report. If you want to

preview a report, do not choose Print; be sure to choose Cancel to return

to the Database window and print the reports consecutively.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 422-424 and 440-444

Microsoft Access "Language Reference," version 1.0, page 364

Additional reference words: 1.00 1.10 AB reports

KBCategory:

KBSubcategory: RptOthr


INF: Contents of Solutions Pack Referral List File MSASPL.EXE

Article ID: Q115879

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

The information in this article applies to:

 - Microsoft Access Solutions Pack version 1.0

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

SUMMARY

=======

This article lists the Solutions Providers listed in the Microsoft Access

Solutions Pack Referral List file MSASPL.EXE that is available in the

Microsoft Software Library.

MORE INFORMATION

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

The applications in the Microsoft Access Solutions Pack are fully

functional applications that are designed to meet a broad range of business

needs. If you want to modify any of the Solutions Pack applications, the

Solutions Providers in the following list are experienced with Microsoft

Access and the Solutions Pack, and can help you tailor these applications

to fit your specific business needs.

   Associatech, Inc.

   Charles Fischer

   10116 Lamplighter Sq.

   Cupertino, CA 95014-2644

   Phone: (408) 255-4686

   CompuServe: 70022,11

   Automated Computer Systems, Inc.

   Gunnar J. Cederbom

   1037 Gaudet Drive

   Marrero, LA 70072

   Phone: (504) 340-5518

   Fax: (504) 340-8407

   CompuServe: 74730,15

   Bunder Computer Services

   Joe Bunder

   Po Box 26104

   Greenville, SC 29650

   Phone: (803) 268-7063

   Fax: (803) 288-7063

   CompuServe: 73767,2475

   Computer Consulting

   Terry A. Voss

   1918 W. Boone Ave

   Spokane, WA 99201

   Phone: (509) 327-7202

   Fax: (509) 327-2303

   CompuServe: 73357,2447

   Computer Consulting And Training, Inc.

   Peter M. Lemmon

   5711 E. Lindsey

   Norman, OK 73071

   Phone: (405) 364-5837

   Fax: (405) 447-8202

   CompuServe: 71023,2073

   Computer Professionals Referral Network

   Robert Oxford

   65 Eastmeadow Way

   Manchester, NH 03109

   Phone: (603) 626-3000

   Fax: (603) 647-4610

   CompuServe: 75610,150

   Connelly Communications

   Dave Connelly

   8701 Mallard Creek Rd

   Charlotte, NC 28262

   Phone: (704) 548-1121

   Fax: (704) 548-1125

   CompuServe: 76560,120

   Consulting Alliance

   Ronald Greene

   24061 Neece Ave. #11

   Torrance, CA 90505

   Phone: (310) 378-4531

   CompuServe: 72657,2437

   Coromandel Industries Inc.

   Doraiswamy N Thodla

   70-15 Austin Street, Third Floor

   Forest Hills, NY 11375

   Phone: (718) 793-7963

   CompuServe: 71531,1534

   Crockett & Associates

   John Crockett

   3800 N. Central Avenue

   Suite 550

   Phoenix, AZ 85012

   Phone: (602) 234-1551

   Fax: (602) 234-1642

   CompuServe: 76044,130

   Datawiz Centers

   Sam Gill

   1500 Fashion Island Blvd.

   Suite 209

   San Mateo, CA 94404

   Phone: (415) 571-1300

   Fax: (415) 574-2336

   CompuServe: 70322,456

   Eis Solutions, Inc

   Eric Fanwick

   251 Wolfpit Ave

   Norwalk, CT 06851-2642

   Phone: (203) 847-6900

   Fax: (203) 847-4339

   CompuServe: 71563,126

   Excell Data Corporation

   James Beebe

   1756 114th Avenue S.E.

   Suite 220

   Bellevue, WA 98004

   Phone: (206) 462-0965

   Fax: (206) 462-2460

   CompuServe: 74740,3054

   Flash Creative Management, Inc.

   Leslie K. Koorhan

   1060 Main St.

   River Edge, NJ 07661

   Phone: (201) 489-2500

   Fax: (201) 489-6750

   CompuServe: 70724,1411

   FMS, Inc.

   Luke Chung

   8027 Leesburg Pike

   Suite 401

   Vienna, VA 22182

   Phone: (703) 356-4700

   Fax: (703) 448-3861

   CompuServe: 73710,463

   Information Management Services

   John Lanata

   323 Country Way

   Scituate, MA 02066

   Phone: (617) 545-1834

   Fax: (617) 545-1059

   CompuServe: 73072,1507

   Information Management Services

   Jeff Nummelin

   14 Rocky Ridge Road

   St. Johnsbury,  05819

   Phone: (802) 748-5013

   CompuServe: 71652,3450

   Infotek

   Harold Adkins

   56 Camille

   E Patchogue,  11772

   Phone: (516) 289-9682

   CompuServe: 74140,2471

   Integrated Computer Services, Inc.

   Charles Kelsoe

   9 Woodlawn Green, Suite 102

   Charlotte, NC 28217

   Phone: (704) 529-1205

   Fax: (704) 529-1205

   CompuServe: 70451,407

   JV Consultants

   Jorge Vismara

   3013 Yale Ave.

   Marina Del Rey, CA 90292

   Phone: (310) 827-8786

   Fax: (310) 827-2699

   CompuServe: 70323,1110

   Lawsoft Systems

   Perry Shenas

   7777 Fay Avenue Suite K-254

   La Jolla, CA 92037

   Phone: (619) 467-0159

   CompuServe: 71165,1000

   Litwin Consulting

   Paul Litwin

   2529 12Th Avenue West

   Seattle, WA 98119

   Phone: (206) 281-1933

   Fax: (206) 281-1669

   CompuServe: 76447,417

   M1 Software

   Ken Getz

   2841 Selby Ave.

   Los Angeles, CA 90064-4226

   Phone: (310) 836-6405

   Fax: (310) 836-4925

   CompuServe: 76137,3650

   Mce Services, Inc

   Ed Roden

   1409-C Allen Drive

   Troy, MI 48083

   Phone: (810) 588-4640

   Fax: (810) 585-3242

   CompuServe: 73754,202

   Meliora Systems, Inc.

   Michael Gilbert

   95 Allens Creek Rd., Bldg. 2

   Suite 302

   Rochester, NY 14618

   Phone: (716) 461-1900

   Fax: (716) 461-1989

   CompuServe: 70742,3173

   Micro Eye

   Randy Byrne

   17560 County Road 85B

   Esparto, CA 95627

   Phone: (916) 787-3194

   Fax: (916) 787-3993

   CompuServe: 76012,2207

   Mtx International, Inc.

   Michael Mullin

   98 Inverness Drive East

   Suite 110

   Englewood, CO 80112

   Phone: (800) 888-MTXI

   CompuServe: 71201,1714

   Noblestar Systems Corporation

   Andy Sawyer

   501 Foxwood Ln

   Wylie, TX 75098

   Phone: (214) 913-2753

   Fax: (214) 442-9342

   CompuServe: 72234,1212

   Omega Software

   John Bonin

   37 North Policy Street

   Salem,  03079

   Phone:

   CompuServe: 71054,2626

   Parian Development

   Kevin Hartman

   641 W. Lake St.

   Suite 100

   Chicago, IL 60661-1012

   Phone: (312) 655-3900

   CompuServe: 73751,745

   Profit Solutions, Inc.

   Mike Larson

   9151 Queen Ave S

   Bloomington, MN 55431

   Phone:

   CompuServe: 74004,1627

   Pyramid Computers

   Mike Gunderloy

   90 Fifth Ave. #4

   Brooklyn, NY 11217

   Phone: (718) 398-4626

   Fax: (718) 230-5539

   CompuServe: 72271,275

   Quick Software

   Chris St. Valentine

   Po Box 2411

   Redmond, WA 98052

   Phone: (206) 881-7662

   CompuServe: 72702,724

   Sea Group Inc

   Larry Miner

   1014 Overdale Avenue Nw

   Canton, OH 44708

   Phone: (216) 477-4010

   Fax: (216) 477-3402

   CompuServe: 73223,2552

   Stewart Datatech, Ltd.

   Jim Stewart

   3008 36Th Street

   Puyallup, WA 98374

   Phone: (206) 848-3455

   Fax: (206) 848-0333

   CompuServe: 71350,2565

   Systron Software Corporation

   Frank Angel

   3 Eves Dr

   Ste 306

   Marlton, NJ 08053-3129

   Phone: (609) 985-8088

   Fax: (609) 985-3113

   CompuServe: 73577,1637

   Techtryx Systems

   Paul Cassel

   8220 Eddy Ave E

   Albuquerque, NM 87109-4958

   Phone: (505) 823-1932

   Fax: (505) 345-8789

   CompuServe: 71250,563

   Techworks International

   Marshall Harrison

   164 Kings Highway North

   Westport, CT 06880

   Phone: (203) 221-1500

   Fax: (203) 221-1330

   CompuServe: 76547,2000

   The Spectrum Group

   Wayne F. Cummings

   2001 Spring Rd

   Ste 350

   Oak Brook, IL 60521

   Phone: (708) 368-7000

   Fax: (708) 368-7090

   CompuServe: 71412,2617

   Zenreich Systems

   Allen Zenreich

   208 Kinderkamack Road

   Oradell, NJ 07649

   Phone: (201) 261-3325

   Fax: (201) 599-0445

   CompuServe: 71171,1340

Additional reference words: 1.00 solpack

KBCategory:

KBSubcategory: GnlOthr


INF: Controlling Design Mode at Run Time to Change Properties

Article ID: Q101308

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There are a number of form properties in Microsoft Access that cannot

be changed while the form is active. To work around this limitation,

you can use a macro to change the form into Design view, use SetValue

actions to change any property, and then change the form back to Datasheet

view.

MORE INFORMATION

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

You can change the form into Design view by using a DoMenuItem macro

action as shown below:

   MacroName   Action

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

   Test1       DoMenuItem

   Test1 Actions

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

   DoMenuItem

      Menu Bar: Form

      Menu Name: View

      Command: Form Design

When you use this method to change properties on a Microsoft

Access form, the following potential problems should be noted.

Problem 1

---------

When changing from Datasheet view to Design view, or from Design view

to Datasheet view, the form is in Design view yet repainting takes

place on the screen. To minimize this problem, set Echo Off before

going into Design view. Turn Echo On after forcing the form back into

Datasheet view. The following sample illustrates this method:

   MacroName   Action

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

   Test1       DoMenuItem

               Echo

   Test2       DoMenuItem

               Echo

   Test1 Actions

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

   DoMenuItem

      Menu Bar: Form

      Menu Name: View

      Command: Form Design

   Echo

      Echo On: No

   Test2 Actions

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

   DoMenuItem

      Menu Bar: Form

      Menu Name: View

      Command: Browse

   Echo

      Echo On: Yes

Problem 2

---------

After a property is changed, the Save Form dialog box appears. To

avoid this dialog box, set SetWarnings to Off from the form's OnClose

event. If this is done in a macro, SetWarnings will automatically be

reenabled after the form has been closed. The following sample

demonstrates this method:

1. Create a new form called "Form1" bound to the Categories table in

   the sample database NWIND.MDB with the following settings:

      Form

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

      Form: Form1

         Caption:  Form1

         ControlSource: Categories

         OnClose: Macro1.Onclose

      Textbox:  text box1

         ControlName:  Category ID

         ControlSource:  Category ID

      Textbox:  text box2

         ControlName:  Category Name

         ControlSource:  Category Name

      command button:  Button1

         Caption:  Filter

         OnPush:  =ChangeFilter()

      command button:  Button2

         Caption:  Close

         OnPush:  =Macro1.Close

2. Create a macro called "Macro1" with the following options:

      MacroName     Action          Defined Below

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

      OnClose       SetWarnings        1

      Close         Close              2

      1. OnClose Action

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

         Warnings On:  No

      2. Close Action

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

         Object Type:  Form

         Object Name:  Form1

3. Add the following function to a new module:

      Function ChangeFilter ()

         DoCmd Echo False

         DoCmd DoMenuItem 0, 2, 0, 0

         Forms!Form1.AllowFilters = Not Forms!Form1.AllowFilters

         DoCmd DoMenuItem 0, 2, 1, 0

         DoCmd Echo True

      End Function

   NOTE: For development work, you may want to comment out the DoCmd

   Echo actions.

4. Close and save the form, macro, and module.

   NOTE: Before closing the form, make sure that the Field List

   window, the property sheet, and the toolbox are closed.

5. Open the form and choose Filter. Note that the filter buttons in

   the toolbar are unavailable. If you choose Filter again, the filter

   buttons in the toolbar become available.

6. Close the form by choosing Close, or by double-clicking the form's

   Control-menu box. Note that regardless of which way the form is

   closed, no Save Form dialog box appears.

Additional reference words: 1.00 1.10 flip switch browse mode

KBCategory:

KBSubcategory: FmsProp


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 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 Columns In Microsoft Access

Article ID: Q92692

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

When you are viewing or editing a table in Datasheet view, you cannot

select a column of data, copy it to the Clipboard, and then edit it, as you

can with Microsoft Excel. You can, however, change or rearrange data

without copying it to the Clipboard.

MORE INFORMATION

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

This article describes procedures for the following three methods of

manipulating data in a Microsoft Access table:

 - Rearranging the column order

 - Adding a column

 - Copying a column of data to another application

Rearranging the Column Order

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

Use the following steps to rearrange the order of the columns in a

Microsoft Access table:

1. Use the column indicator to select the column.

2. Drag the column to the new position, and then release it.

For more information, search for "Column Width (datasheets)" then "Changing

a Datasheet's Appearance" using the Microsoft Access Help menu.

Adding a Column

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

This section describes how to add a column of information from one

Microsoft Access table to another.

The first procedure describes how to update information in Table1 with

information from Table2. The second procedure describes how to create two

tables (MASTER and EXTRAINFO), and then add the information from EXTRAINFO

to the MASTER table.

To add a column to a Microsoft Access table, you must run an update query.

If you are also adding new records, you must run an append query (refer to

step 3, in either procedure) before you run the update query.

Copying a Column from One Table to Another:

Use the following steps to update information in Table1 with information

from Table2:

1. Set the same primary key for both Table1 and Table2.

2. Manually add the new column names from Table2 to Table1. Make sure

   they are the same data type. They do not have to be the same name

   as the corresponding fields in Table2, but it saves a lot of typing

   if the names are the same.

3. Use Table2 to create an append query.

   NOTE: Skip this step if Table2 contains only records that exist

   in Table1.

   a. Choose the Query button, then choose New. Add Table2 to

      the query, then close the Add Table dialog box.

   b. From the Query menu, choose Append.

   c. In the Query Properties box, specify Table1 as the Append To

      Table Name. Make sure that the Unique Values check box is

      selected, then choose the OK button.

   d. Add all the field names from Table2 to the QBE grid.

      If the field names are spelled correctly, Microsoft Access

      automatically fills in the Append To field with the name of

      the correct field from Table1. If not, you must manually select

      the Table1 field name in the Append To field.

   e. Run the query. New records from Table2 are added to Table1.

4. Create an update query that contains both Table1 and Table2.

   a. Choose the Query button, then choose Update. Add both Table1

      and Table2 to the query, then close the Add Table dialog box.

   b. Join the two tables by dragging the key field from Table1 to

      Table2.

   c. From the Query menu, choose Update.

   d. Drag the new fields from Table1 and drop them into the QBE

      grid, then type the [Table2]![<fieldname>] into the Update

      From field. (You must manually type this entry.)

   e. Run the query to update the new fields in existing Table1

      records.

Creating Two Tables and Adding Information from One to Another:

1. Create two tables called MASTER and EXTRAINFO. The MASTER table has

   two fields: KEY and ITEM1. The EXTRAINFO table has two fields: KEY

   and ITEM2. Add data as follows:

      MASTER:  KEY   ITEM1          EXTRAINFO:  KEY   ITEM2

                 1   AAAAA                        1   11111

                 2   BBBBB                        3   33333

2. Open MASTER in Design view and add the field ITEM2. It should look

   like this:

      MASTER:  KEY   ITEM1   ITEM2

                 1   AAAAA

                 2   BBBBB

3. Create the append query as follows:

   a. Choose the Query button, then choose New. Add EXTRAINFO to the

      query, then close the Add Table dialog box.

   b. From the Query menu, choose Append.

   c. In the Query Properties dialog box, select MASTER as the Append

      To Table Name. Select the Unique Values check box, then choose

      the OK button.

   d. Drag the KEY field and the new field, ITEM2, and drop them into

      the QBE grid. Microsoft Access fills in the Append To field names.

   e. From the Query menu, choose Run.

   f. When Microsoft Access displays the following message, choose the

      OK button:

         2 rows will be appended.

   g. When Microsoft Access displays the following message, choose the

      OK button:

         1 record(s) were lost due to key violations

      NOTE: This is expected; the record with KEY=1 could not be

      appended. The update query (step 4) will copy this record.

      MASTER should now look like this:

         MASTER:  KEY   ITEM1   ITEM2

                    1   AAAAA

                    2   BBBBB

                    3           33333

4. Create the update query as follows:

   a. Choose the Query button, then choose Update. Add both EXTRAINFO

      and MASTER to the query, then close the Add Table dialog box.

   b. Join the tables by dragging the KEY field from EXTRAINFO to

      MASTER. A line will connect the two tables.

   c. From the Query menu, choose Update.

   d. Drag the new field, ITEM2, from MASTER and drop it into the

      QBE grid. Then, type [EXTRAINFO]![ITEM2] in the Update From

      field.

   e. From the Query menu, choose Run.

   f. When Microsoft Access displays the following message, choose

      the OK button:

         2 rows will be updated.

      MASTER should now look like this:

         MASTER:  KEY   ITEM1   ITEM2

                    1   AAAAA   11111

                    2   BBBBB

                    3           33333

For more information on append and update queries, search on the

following topics using the Microsoft Access Help menu:

   "Appending Records to a Table"

   "Update Queries, Updating Records as a Group"

   "Joins, Joining Tables in a Query"

Copying a Column of Data to Another Application

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

If you need to copy a column of data from Microsoft Access to another

application, such as Microsoft Excel, try one of the following methods:

 - Use Copy & Paste to transfer the records you want to copy. Then

   delete any unwanted columns in the other application.

 - Use the Hide Columns command from the Layout menu to suppress the

   columns that you do not want copied. Then use Copy & Paste to

   transfer the records that you want to copy. You must Unhide each

   column individually.

 - Create a query that contains only the columns that you want. Then

   use Copy & Paste to transfer the records that you want to copy.

   This method is useful if you plan to copy data on a regular basis.

For more information, search for "Copy Command" using the Microsoft Access

Help menu.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0 and 1.1, Chapter 6, "Appending

Records," Chapter 7, "Updating Tables," and Chapter 14, "Changing Column

Width and Order"

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlOthr


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: 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 and Converting Version 1.0 and 1.1 Databases

Article ID: Q105645

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to use Microsoft Access version 1.1 to convert

databases between version 1.0 and 1.1 formats, and how to create new

databases in either version 1.0 or 1.1 formats.

MORE INFORMATION

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

Database versions are not listed when you choose Open Database or Repair

Database from the File menu. If you try to open a version 1.1 database in

Microsoft Access version 1.0, you will receive the error message:

   Database is corrupted or is not an Access Database

If you try to repair a version 1.1 database in Microsoft Access version

1.0, you will receive the error message:

   Out-of-date database format

In Microsoft Access version 1.1, existing databases can be converted

between version 1.0 and 1.1 formats. You can use either the Compact or

Encrypt command to perform the conversion. New databases can be created in

either format.

How to Convert Between Version 1.0 and 1.1 Formats Using Compact Database

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

1. Start Microsoft Access version 1.1. Do not open a database.

2. From the File menu, choose Compact Database.

3. In the Compact From dialog box, select the database you want to

   convert.

4. In the List Files Of Type box, select the format to which you want to

   convert the database.

How to Convert Between Version 1.0 and 1.1 Formats Using Encrypt

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

1. Start Microsoft Access version 1.1. Do not open a database.

2. From the File menu, choose Encrypt/Decrypt.

3. In the Encrypt/Decrypt dialog box, select the database you want to

   convert.

4. In the Encrypt box, select the format to which you want to convert

   the database.

How to Create a Database in Version 1.0 or 1.1 Format

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

1. Start Microsoft Access version 1.1.

2. From the File menu, choose New Database.

3. In the List Files Of Type box, select the format in which you want to

   create the new database.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.1, page 637

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlOthr


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 Result Equivalent to SQL UNION Operator Result

Article ID: Q94830

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The SQL UNION operator is not supported in Microsoft Access. However, you

can obtain an equivalent result (a UNION product) by using the following

two-step process to create two queries, a make- table query and an append

query.

MORE INFORMATION

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

The product of a UNION includes all records from two related tables-- those

that match on the related key field and those that do not match on the

related key field.

For example, say you have two tables, Table A and Table B. Table A contains

the following fields and records:

   Key1    Field A

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

   1       Seattle

   2       Portland

   4       Chicago

Table B contains the following fields and records:

   Key2    Field B

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

   1       Washington

   3       Oregon

   5       Illinois

The UNION product of the two tables would look like this:

   Key     Field A     Field B

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

   1       Seattle      Washington

   2       Portland

   3                    Oregon

   4       Chicago

   5                    Illinois

Use the following two-step process to obtain a UNION product in Microsoft

Access:

Step One: Collect the Records that Have a Matching Key Value

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

1. Create a query, and add the two tables (Table A and Table B) to the

   query grid.

2. Join the two tables by using the mouse to connect Key1 in Table A to

   Key2 in Table B.

3. Double-click the join line between the two tables to bring up the Join

   Properties dialog box. Select the second option, "Include ALL records

   from 'Table A' and only those records from 'Table B' where the joined

   fields are equal."

4. Add three fields to the query grid: Key1 from Table A, Field A from

   Table A, and Field B from Table B. You can use the mouse to drag these

   fields onto the query grid.

5. Choose Make Table... from the Query menu. The Query Properties

   dialog box appears. The default selection is Current Database under

   Make New Table. Enter an appropriate table name (for example,

   UNION Result) for the result table, and choose the OK button.

6. Run the query to create the new table (UNION Result). It will contain

   the following fields and records:

      Key1       Field A      Field B

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

      1          Seattle      Washington

      2          Portland

      4          Chicago

Step Two: Add the Rest of the Records to the Result

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

To complete the UNION, you need to add the records in Table B that do not

have a matching key field value in Table A.

1. Create another new query. Add two tables (Table B and UNION Result) to

   the query grid.

2. Join the two tables by using the mouse to connect Key2 in Table B to

   Key1 in the UNION Result table.

3. Double-click the join line between the two tables to bring up the Join

   Properties dialog box. Select the second option, "Include ALL records

   from 'Table B' and only those records from 'UNION Result' where the

   joined fields are equal."

4. Add three fields to the query grid: Key2 from Table B, Field B from

   Table B, and Key1 from UNION Result. You can use the mouse to drag

   the fields onto the query grid. You do not need Field A from UNION

   Result because UNION Result already contains all the rows from Table A.

5. Choose Append... from the Query menu. The Query Properties dialog box

   appears. Ensure that UNION Result is in the Table Name field under

   Append To. Then choose the OK button.

6. Verify that the query grid how has a line labeled Append To. Choose

   Table Names from the View menu to show table names on the query grid.

   Now the query grid should look something like this:

          Field:   Key2       Field B      Key1

          Table:   Table B    Table B      UNION Result

           Sort:

      Append To:   Key1       Field B

       Criteria:                           Is Null

   Note that the Key1 field from the UNION Result table is not appended

   to anything and it has an Is Null restriction on it. This ensures that

   no records from UNION Result are duplicated and appended to it when you

   run the append query.

7. Run the append query. The UNION Result table looks like this:

      Key1    Field A         Field B

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

      1       Seattle         Washington

      2       Portland

      3                       Oregon

      4       Chicago

      5                       Illinois

   As you can see, record 1 has a match on the joined fields, but all the

   other records are represented only once. This is the correct UNION

   product. If the Key1 values in UNION Result are not in ascending order,

   it is because there is no primary key on that column.

Additional reference words: 1.00 1.10 action sql relational

KBCategory:

KBSubcategory: QryUnion


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: 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: Database Structure Questions & Answers

Article ID: Q104392

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

            WX0635: DATABASE STRUCTURE QUESTIONS & ANSWERS

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

                                                   Revision Date: 9/93

                                                      No Disk Included

The following information applies to Microsoft Access(R), versions

1.0, and 1.1.

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

| 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) 1992-1993 Microsoft Corporation.  All Rights Reserved |

| Microsoft, FoxPro, Microsoft Access, and MS-DOS are registered      |

| trademarks                                                          |

| and Windows is a trademark of Microsoft Corporation.                |

| dBASE III PLUS, dBASE IV, and Paradox are registered trademarks of  |

| Borland International, Inc.                                         |

| 1-2-3 and Lotus are registered trademarks of Lotus Development      |

| Corporation.                                                        |

| Btrieve is a registered trademark of Novell, Inc.                   |

| Oracle is a registered trademark of Oracle Corporation.             |

| Sybase is a registered trademark of Sybase, Inc.                    |

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

1.  Q. What foreign data formats does Microsoft Access support?

    A. Microsoft Access can link to Btrieve(R), dBASE III PLUS(R),

       dBASE IV(R), FoxPro(R) versions 2.x, and Paradox(R) versions

       3.x data, including indexes.

       Microsoft Access can import data from Btrieve, dBASE III PLUS,

       dBASE IV, FoxPro versions 2.x, Lotus(R) 1-2-3(R) versions 2.x

       and 3.x, Lotus 1-2-3/W, Microsoft Excel versions 2.x and later

       for Windows, Paradox 3.x, and fixed-length and delimited ASCII

       text.

       Microsoft Access can connect to Microsoft SQL Server, Sybase(R)

       SQL Server, and Oracle(R) RDBMS Server using the Open Database

       Connectivity (ODBC) specification. These ODBC drivers are the

       only drivers currently certified for Microsoft Access version

       1.1.

2.  Q. What are primary and foreign keys in a relational database?

    A. Primary keys uniquely identify a specific row in a table. They

       are usually composed of a single field or column whose data is

       unique to each row of information (for example, a customer

       identification number, employee social security number, or

       order identification number). Primary keys also can be composed

       of more than one field. For example, the fields Company

       Identification and Contact Name could be combined to form a

       primary key for a table that contains information about

       companies that have more than one contact.

       Foreign keys identify rows in one table that match the primary

       key of another table. For example, if the field Employee ID is

       the primary key in the Employee table, in the Orders table,

       Employee ID is the foreign key. The relationship between

       primary and foreign keys enables you to access related data in

       multiple tables.

3.  Q. Which FieldSize setting should I select for the Number data

       type in order to use a Counter field of another table as the

       foreign key in the current table?

    A. To use a Counter field of another table as the foreign key in

       the current table, select the Long Integer setting.

4.  Q. How do you change the starting value of a Counter column to a

       number other than 1?

    A. To set the starting value of a Counter column to a number other

       than 1, use the following four steps:

       1. Create an additional single-column temporary table. Give the

          Number column the same name as the Counter column in the

          original table.

       2. Create a new row in the temporary table by inserting a value

          in the Number column. This value should be 1 less than the

          desired starting value for the original table.

       3. Create an append query to append the single row from the

          temporary table to the original table.

       4. Delete the temporary table. You can then delete the dummy

          row from the original table.

        NOTE: Do not compact the database before you add the first row

        to the original table. If you do this, the counter value

        resets to begin at 1.

       For additional information and an example of how to set the

       initial value of a counter, please obtain Technical Note

       #94821. You can order this technical note by selecting the

       FastTips Technical Library option from the FastTips Main Menu.

5.  Q. Is data in tables stored in a sorted order? How can I view my

       data in sorted order?

    A. Data in tables is not stored in sorted order. Data is stored in

       the order in which it was entered. To view data in sorted

       order, create a query, or a form based on a query, that uses

       the Sort field on the query grid. By default, if the table

       includes a primary key, the Datasheet view of the table will

       display the data sorted by the primary key. To view the data

       sorted by something other than the primary key alone, use a

       query, as previously described.

6.  Q. How can I delete the primary key from a table?

    A. You can delete the primary key for a table by opening the Table

       Properties dialog box and deleting the entry for the Primary

       Key field. Please note that the primary key cannot be deleted

       from a table that is the primary table in a relationship.

7.  Q. How can I create computed columns in tables?

    A. You can create computed columns or expressions with queries.

       Within the query, create a column that is defined as an

       expression. In general, it is helpful to think of queries as

       virtual tables; you can use a query wherever you can use a

       table. If you're familiar with SQL terminology, this is very

       similar to creating a view. Unlike most implementations of

       views, however, Microsoft Access views can be updated even if

       they involve joins from different data sources, such as

       Paradox, Btrieve, or separate Microsoft Access data sources.

8.  Q. Two of my tables have Counter data type columns in common. Why

       can't I define a relationship between the two tables based on

       these columns?

    A. You can define only one-to-one relationships between Counter

       data type columns. If the linking column on the "one" side is a

       counter, define the linking column on the "many" side as a long

       integer.

       For more information on table relationships, see the "Microsoft

       Access User's Guide," Chapter 1, "Designing a Database," pages

       13-18.

9.  Q. How many databases can I open at a time in Microsoft Access?

    A. Through the user interface menus in Microsoft Access, you can

       open only one database at a time; therefore, you can view only

       one database window in each session of Microsoft Access.

       Through Access Basic, however, you can use the OpenDatabase()

       function to open several databases at once. The number of

       databases you can have open simultaneously through Access Basic

       is limited only by your computer's memory.

       Also, by choosing Attach Table from the File menu, you can

       attach to as many databases as your computer's memory allows.

10. Q. Can Microsoft Access version 1.0 use databases created in

       version 1.1?

    A. Microsoft Access 1.0 cannot read from or write to databases

       created in Microsoft Access 1.1. However, Microsoft Access 1.1

       can read from and write to databases created in version 1.0 and

       still allow version 1.0 to read from and write to the same

       database without conversion.

       If you want to upgrade your version 1.0 database to version 1.1

       format, use the following four steps:

       1. From the version 1.1 File menu, choose Compact Database. The

          Database To Compact From dialog box is displayed.

       2. In the File Name box, select the database that you want to

          convert. In the List Files Of Type box, select Databases

          (*.mdb).

       3. Choose OK. The Database To Compact To dialog box is

          displayed.

       4. In the List Files Of Type box, select Access V1.1 (*.MDB).

           NOTE: If you want to convert your version 1.1 database back

           to version 1.0 format, select Access V1.0 (*.MDB) instead.

Additional reference words: 1.00 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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: Delete Command Available if Counter Field Selected

Article ID: Q89617

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

When a form is open in Form view and the first control selected is a

counter, the Delete command will be enabled on the Edit menu, even though

you cannot execute the Delete command. If you choose the Delete command

at this point, the error message

   Command not Available: Delete

may occur.

MORE INFORMATION

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

The Delete command in the Edit menu will be disabled after this error

message appears. One workaround for this behavior would be to create a

macro that uses the DoMenuItem command and a Select Record from the Edit

menu prior to running the macro that calls Delete from the Edit menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsEvnt


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: 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 CreateForm() and CreateReport() Functions

Article ID: Q109395

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

This article describes the CreateForm() and CreateReport() functions that

are documented in the "The Secrets of Access Wizards" manual which is

included with the Microsoft Access Distribution Kit.

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.

CreateForm(), CreateReport() Functions

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

Description   Creates a new form or report and returns a form or

              report object.

Syntax        CreateForm([database [,formtemplate]])

              CreateReport([database [, reporttemplate]])

Remarks       The CreateForm() and CreateReport() functions use the

              following arguments:

              Argument         Description

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

              database         String expressions identifying the name

                               of the database that contains the form

                               or report template; if the argument is

                               omitted, the current user database (the

                               same value as returned by the CurrentDB

                               function) is used.

              formtemplate,    String expression identifying the name

              reporttemplate   of the form or report template, the

                               name of a form or report, or the word

                               Normal. If the expression is omitted,

                               Access Basic uses the form or report

                               template set with the Options command

                               on the View menu.

              These functions are the equivalent of choosing New Form

              and New Report from the File menu in the Database

              window. They return a form or report object. Use these

              functions in Design Mode only.

Example       Creates a report in the user database using the Normal

              template.

   Sub NormalReport()

       Dim MyReport As Report

       ' CreateReport function creates a minimized report

       ' that we need to restore.

       Set MyReport = CreateReport("","")

       DoCmd Restore

   End Sub

REFERENCES

==========

Microsoft Access "The Secrets of Access Wizards," page 15

Additional reference words: 1.00 1.10 ADK

KBCategory:

KBSubcategory: PgmOthr


INF: Description of HotSpot Editor and HotSpot Types

Article ID: Q109714

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

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

This article describes how to create a Searchable type action that is

associated with the Hot Spot Editor. The "Help Compiler Guide" does not

document this specific type attribute.

MORE INFORMATION

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

The Hot Spot Editor that ships with the Microsoft Access Distribution Kit

version 1.1 creates hypergraphics that you can use within your Help file.

You can create hot spots that link to topics, pop-up windows, or macros.

These links are enabled whenever the user clicks the hot spot.

The "Help Compiler Guide" that ships with the Microsoft Access Distribution

Kit version 1.1 documents three different types of hot spot attributes on

pages 58-59:

   Jump (defines a jump to another topic)

   Pop-up (displays a pop-up window)

   Help macro (runs a Help macro)

There is an additional, undocumented, type of hot spot attribute:

   Searchable type (allows you to search for a word, then jumps

                    to the appropriate graphic)

To add the Searchable type to the drop-down list of types in the hot spot's

Attributes dialog box, add the following lines to your WIN.INI file:

   [HotSpot Editor]

   Searchable=1

How to Use the Searchable Type Attribute

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

1. Open a picture (for example, *.BMP) in the Hot Spot Editor.

2. Create a hot spot on the picture by dragging a box onto the picture.

3. Double-click the hot spot and the Attributes dialog box will appear.

   The Attributes dialog box contains binding information for each hot spot

   that you define.

4. In the Type field, select Searchable.

   Note that the binding portion of the Attributes dialog box differs from

   the diagram on page 58 of the "Help Compiler Guide." Instead of a

   Context String field, you see a Search Keys field.

5. In the Search Keys field, enter a valid keyword from your Rich-Text

   Format (RTF) Help file (for example, TestOpen).

   For additional information on coding keywords for your Searchable type,

   refer to the "Help Compiler Guide," page 32.

6. Fill out the Bounding Box portion of the Attributes dialog box as you

   would for the three other types of hot spot actions.

7. Choose OK.

Testing the Hot Spot

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

1. In the online Help for your application, search for TestOpen (or what-

   ever keyword you assigned in step 5 above).

2. Go to the TestOpen topic.

Microsoft Access will jump to the hot spot graphic that has the TestOpen

search key defined.

REFERENCES

==========

Microsoft Access "Help Compiler Guide," Chapter 4, "Creating Graphics for

Help"

Additional reference words: 1.10 hotspot types

KBCategory:

KBSubcategory: PgmOthr


INF: Description of PrtMip Property

Article ID: Q109407

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article is a copy of the PrtMip property documentation from the "The

Secrets of Access Wizards" manual that is included with the Microsoft

Access Distribution Kit documentation.

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

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

The PrtMip property setting is read-write in Design view, and read-only

in other views.

PrtMip Property

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

Applies To    Reports.

Description   Sets and returns information from print setup for a

              report.

Setting       The PrtMip property setting is a 24-character string

              that maps to the print setup information displayed after

              you press the More button. It takes the following

              settings:

              Setting        Description

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

              Left, Top,     Integer for each. The margin settings

              Right,         specify the distance in inches or

              Bottom Margin  centimeters between the edge of the page

                             and the item to be printed.

              Data Only      Integer. Print only the data in a report

                             without borders, gridlines, or display

                             graphics. The value can be True (-1) or

                             False (0).

              Item Size      Integer. The report width in inches or

              Width          centimeters.

              Item Size      Integer. The report height in inches or

              Height         centimeters.

              Default Size   Integer. True (-1) if the same as the

                             size of the detail section and False (0)

                             if defined by the item size width and

                             height.

              Items Across   Integer. Defines the number of columns

                             across for multiple-column reports or

                             labels.

              Row Spacing    Integer. The space between detail rows in

                             inches or centimeters.

              Column         Integer. The space between detail columns

              Spacing        in inches or centimeters.

              Item Layout    Integer. Horizontal (1) or Vertical (2)

                             layout of report columns.

Example       Reads the device and margin information, resets the page

              orientation, and halves the margins.

   Sub PrtSetUpdemo (szReport$)

      ' The structures defined in the zwAlGlobals module.

      Dim dm As zwtDevModeStr

      Dim DevMode As zwtDeviceMode

      Dim mip As zwfMIPSTR

      Dim mi As zwfMarginInfo

      ' Read DeviceMode info.

      dm.rgb = Reports(szReport).PrtDevMode

      LSet DevMode = dm

      ' If the current orientation is portrait then . . .

      If DevMode.dmOrientation = 1 Then

         ' Change it to landscape.

         DevMode.dmOrientation = 2

      Else

         ' Else change it to portrait.

         DevMode.dmOrientation = 1

      End If

      LSet dm = DevMode

      ' Write the device mode information.

      Reports(szReport).PrtDevMode = dm.rgb

      ' Read margin info.

      mip.rgb = Reports(szReport).PrtMip

      LSet mi = mip

      ' Make all margins smaller.

      mi.xLeftMargin = mi.xLeftMargin / 2

      mi.xRightMargin = mi.xRightMargin / 2

      mi.yTopMargin = mi.yTopMargin / 2

      mi.yBotMargin = mi.yBotMargin / 2

      LSet mip = mi

      ' Write the new margin info.

      Reports(szReport).PrtMip = mip.r

   End Sub

The variables and constants that begin with "zw" are defined in the

zwAllGlobals module in WIZARDS.MDA.

REFERENCES

==========

Microsoft Access "The Secrets of Access Wizards," pages 27-28

Additional reference words: 1.00 1.10 PtrIss

KBCategory:

KBSubcategory: PgmOthr


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: Displaying Totals for Each Row in Crosstab Queries

Article ID: Q102517

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Crosstab queries can display totals for each row. To do this, simply

repeat the field used as the crosstab value and make it a crosstab row

header.

MORE INFORMATION

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

The following steps explain how to create a crosstab query with row

totals:

1. Open the sample database NWIND.MDB.

2. Create a new query based on the Order Review query, as follows:

      Query: XTAB With Row Totals

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

      Field: Company Name

         Total: Group By

         CrossTab: Row Heading

      Field: Total Ordered:Order Amount

         Total: Sum

         CrossTab: Row Heading

      Field: Ship Via

         Total: Group By

         CrossTab: Column Heading

      Field: Order Amount

         Total: Sum

         CrossTab: Value

The Total column always appears before the other data columns, but you

can display the data on a form or report in any order.

REFERENCES

==========

Cue Cards, the Microsoft Access tutorial, walk you through the

process of creating a crosstab query. On the last step, you are given

the option to add row totals, using procedures similar to those shown

above.

For more information, choose Cue Cards from the Help menu and click

About Cue Cards.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: QryCross


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: Double-click Also Executes OnPush Twice

Article ID: Q90853

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

On a form using the OnPush and OnDblClick events, the double-click

runs the OnPush event before and after the OnDblClick event.

MORE INFORMATION

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

If you want the OnDblClick event to execute without the OnPush event,

you must put an explicit CancelEvent action at the end of the OnDblClick

macro. Otherwise, both clicks will execute the macro assigned to the

OnPush event.

Steps to Reproduce Behavior

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

1. Create a macro with a beep action. Save it as Macro1.

2. Create a second macro with a MsgBox action. Save it as Macro2.

3. Create a blank form and add a command button.

4. Set the OnPush property for the command button to Macro1 and the

   OnDblClick property to Macro2.

6. From the View menu, choose Form.

7. Double-click the command button.

   Note that the OnPush event is activated before and after the

   OnDblClick event.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsEvnt


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 in Object Permissions Table

Article ID: Q108437

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There is a table in the Microsoft Access "User's Guide" that summarizes the

permissions available for objects in a database. This table contains an

error. In version 1.0, the table is on page 621. In version 1.1, the table

is on page 627.

The third and fourth lines in the table incorrectly show that Read Data and

Modify Data permissions apply to form objects. These two permissions do not

apply to form objects because forms display data from an underlying

dynaset; they do not actually contain data. Therefore, your ability to

modify data through a form is actually determined by the Read Data and

Modify Data permissions on the form's underlying table or query.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 620-621

Microsoft Access "User's Guide," version 1.1, pages 626-627

Additional reference words: 1.00 1.10 docerr

KBCategory:

KBSubcategory: ScrtOthr


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 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

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

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

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

SUMMARY

=======

The ESC key performs two different functions in Form view in Microsoft

Access. If you are in Extend mode, pressing ESC will exit Extend mode.

While entering data in a control, pressing ESC activates the Undo

feature and causes the data to be deleted. This can create a small

inconvenience when you are in Extend mode and doing data entry

simultaneously. Any effort to exit Extend mode by pressing ESC will

erase your data in the current control (the one with the focus) in

addition to leaving Extend mode.

MORE INFORMATION

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

Extend mode is used to select fields and records in Datasheet and Form

view, and in a report's Design view. It also can be used in grids to select

cells and rows.  To make a selection using Extend mode, position your

cursor in a field or control, then press the F8 function key to turn Extend

mode on. You will notice that EXT appears in the status bar. Once you have

turned Extend mode on, you can press F8 repeatedly to select the word, the

field, the record, and then all records.

To reverse the F8 selection, use SHIFT+F8. The ESC key will exit Extend

mode, as indicated in the summary, but it will also erase your data in the

control with focus.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: UiOthr


INF: Filenames/Version Numbers, ODBC Files for MS Access V1.1

Article ID: Q100975

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

The information in this article applies to:

 - Microsoft Access version 1.1

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

SUMMARY

=======

This article lists information about the ODBC files that ship with

Microsoft Access version 1.1.

MORE INFORMATION

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

The following ODBC files ship with Microsoft Access 1.1:

   Filename      Version     Size     Date

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

   SQLSRVR.DLL   1.01.2920   151856   5-20-93

   SQORA.DLL     1.00.2816   143600   4-16-93

   ODBC.DLL      1.00.2709    44736   4-08-93

   INSTCAT.SQL      **        93834   5-20-93

** The version number that displays when you execute sp_server_info

500 is 01.01.2807, though technically there is no such version of this

file.

Another file that is important to Microsoft SQL Server is DBNMP3.DLL,

which should be 9941 bytes.

Additional reference words: 1.10 ODBC

KBCategory:

KBSubcategory: ObcOthr


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: Five Parameters to Set in ISAM Section of MSACCESS.INI

Article ID: Q101323

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes five parameters for Microsoft Access version 1.x

that you can set in the ISAM section of the MSACCESS.INI file, found in

the WINDOWS directory. For information on setting these parameters for

version 2.0, search for "MSACC20.INI" then "Customizing MSACC20.INI

Settings" using the Help menu.

The MSACCESS.INI file can contain the following five parameters:

   MaxBufferSize

   ReadAheadPages

   PageTimeout

   LockRetry

   CommitLockRetry

NOTE: These parameters are not automatically placed in the MSACCESS.INI

file. If necessary, you must add them.

MORE INFORMATION

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

ISAM parameters are read at only one time: during the launch of the

first instance of Microsoft Access. While the parameters can be

changed while Microsoft Access is running, these changes do not take

effect until all instances of Microsoft Access are closed and

Microsoft Access is restarted.

The examples in the following five sections assume the sample

parameter values below:

   MaxBufferSize = 512

   ReadAheadPages = 5

   PageTimeout=20 (sets PageTimeout to 2 seconds)

   LockRetry = 100

   CommitLockRetry = 100

MaxBufferSize

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

Microsoft Access physically stores all database data in 2K-memory

pages, generally in a large storage medium, such as a hard disk, RAM

drive, or CD-ROM. Once placed in the page cache, memory pages are then

used by Microsoft Access to hold data for tables, reports, and so

forth.

The MaxBufferSize ISAM parameter defines, in kilobytes, how large a

memory page cache to set up. A memory page cache is a section of

memory used to temporarily store (or, buffer) the 2K-memory pages that

Microsoft Access creates. Microsoft Access uses physical memory (RAM),

and, if necessary, virtual memory (for example, a hard disk) to create

the page cache that you specify.

Since the page cache stores data in 2K segments, you should set the

MaxBufferSize parameter only to an even number (for example, 18, 512,

1024, and so forth). If the parameter is set to an odd number,

Microsoft Access uses a MaxBufferSize setting of the given number

minus 1.

Since the page cache size is measured in kilobytes, and since each

memory page is 2K in size, you can calculate how many memory pages

will fit in your new page cache by using the following formula:

   maximum number of memory pages = (MaxBufferSize / 2)

For example, if you set the MaxBufferSize to 18, you set up a memory

page cache of 18K. Applying this number to the above formula yields

the following result:

   (18 / 2) = 9 possible memory pages

Microsoft Access responds to data read requests by checking the page

cache to verify whether or not the requested data is already present.

NOTE: The PageTimeout parameter can also be a factor in this process.

Please read the section below titled "PageTimeout."

If the data you need is present in the page cache, Microsoft Access is

able to immediately read the memory pages from it. Since Microsoft

Access does not have to wait for the cache to be filled from the

storage medium, this feature saves you time. However, if the data does

not appear on a memory page already present in the page cache,

Microsoft Access fills the cache from the storage medium and then

retrieves the data from the cache itself.

All memory pages stay in the page cache indefinitely, either until it

becomes full or until the computer is turned off. If the page cache

becomes full, pages are purged as necessary to make room for the new

data.

   Specifications

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

   Maximum Setting: 4096 (4096 = 4MB)

   Minimum Setting: 18   (18 = 18K)

   Default Setting: 512

   Granularity: 2 (for example, 512 is valid, but 511 is not)

ReadAheadPages

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

The ReadAheadPages ISAM parameter specifies the size of another cache,

known as the "read-ahead" cache. The read-ahead cache is used by

Microsoft Access to cache sequential page reads from a database.

Reading data from a read-ahead cache is more efficient than reading it

from a storage medium, since sequential data reads can occur more

quickly. This is especially true when you are accessing data stored on

a network, where speed is increased by sending small numbers of large

packets, rather than large numbers of small packets.

The read-ahead cache is not used for all reads, but triggered instead

when Microsoft Access detects that a sequential read is taking place.

Microsoft Access attempts to detect a sequential read in the following

manner:

When Microsoft Access receives a read request, it checks to see if the

previous read is adjacent to the current request. If it is, Microsoft

Access reads the requested page, plus the next <n> pages (where <n> is

the value that the ReadAheadPages parameter is set to) in that

direction and places the data in the read-ahead cache. If Microsoft

Access correctly detects a sequential read, it then reads the next <n>

reads directly from the read-ahead cache, thus improving the speed.

When the read-ahead cache is created, Microsoft Access attempts to

place it in the first 640K of memory (also called conventional memory)

to benefit from the ability of Microsoft Windows to directly read from

and write to conventional memory. A separate read-ahead cache is

created for each database open on the host machine. Each library

database has its own read-ahead cache.

   Specifications

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

   Maximum Setting: 31

   Minimum Setting: 0

   Default Setting: 16

   Granularity: 1   (1 = 1 page)

PageTimeout

-----------

NOTE: The PageTimeout parameter is enabled for non-exclusive (shared)

data only.

The PageTimeout ISAM parameter defines the amount of time, in tenths

of a second, that a page is held in the memory page cache before it

must be refreshed to fulfill the next read of the same page. The

following scenario describes how the PageTimeout parameter is used:

If page <x> is read and placed in the memory page cache at time T1,

and later another read request is made for page <x> at time T2, the

memory page can be read directly from the memory page cache, if T2

minus T1 is less than the PageTimeout setting. Otherwise, Microsoft

Access must reread the data from the storage medium to refresh that

particular memory page.

NOTE: PageTimeout applies only to situations in which a database or

database object is opened with shared access. When a database is

opened with exclusive access, only one user has access to the data; as

a result, that user always holds the most current data and has no need

for refreshed data.

The PageTimeout parameter is used only when operating through the

Microsoft Access user interface. It is ignored when running an Access

Basic program, unless you allow background processing to occur by

periodically calling the DoEvents() statement.

   Specifications

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

   Maximum Setting: 2147483647 (maximum long integer)

   Minimum Setting: 0

   Default Setting: 20

   Granularity: 1 (1 = 1/10 second)

LockRetry

---------

The LockRetry ISAM parameter defines the number of times Microsoft

Access tries to lock a page before it reports an error.

For example, if user A tries to lock page <x>, which was previously

locked by another user, user A's lock attempt fails. After this

failure, Microsoft Access tries <n> more times (where <n> is the value

LockRetry is set to) to lock the page. If the lock cannot be secured

by the <n>th retry, an error is reported either in the user interface

or in Access Basic code.

   Specifications

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

   Maximum Setting: 2147483647 (maximum long integer)

   Minimum Setting: 0

   Default Setting: 20

   Granularity: 1

CommitLockRetry

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

The CommitLockRetry ISAM parameter is used in conjunction with the

LockRetry parameter to determine the number of retries performed when

locking pages within transactions. The total number of retries

performed is determined by multiplying the two parameters (LockRetry

and CommitLockRetry).

For example, if LockRetry has a value of 5 and CommitLockRetry has a

value of 6, 30 more retries (5 * 6 = 30) are made after the initial

failure to secure a lock.

   Specifications

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

   Maximum Setting: 2147483647 (maximum long integer)

   Minimum Setting: 0

   Default Setting: 20

   Granularity: 1

REFERENCES

==========

For more information on the MSACCESS.INI file, search for

"MSACCESS.INI" using the Help menu. Also, see both "Setting ODBC

Options in the MSACCESS.INI File" in the README.TXT file and the

PERFORM.TXT file in your ACCESS directory.

MSACCESS.INI memory page cache

Additional reference words: 1.00 1.10 setable parameters ISAM

KBCategory:

KBSubcategory: IntpOthr


INF: Flexible Formatting of Phone Numbers

Article ID: Q89685

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes sample functions that you can use to determine the

format of a field or control.

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.

This example demonstrates a sample function to take the phone number value

entered by the user and determine if an area code was entered. If not, it

will not display the parentheses.

NOTE:  This example does not take into account phone extensions or

international numbers.

By creating two functions, intelligent formatting is possible.

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

'==========================================================

'The following function is designed for use in the AfterUpdate

'property of a Form Control.

'   AfterUpdate: =Format_Phone([<control name>])

'==========================================================

  Function Format_Phone (PhoneNumber As Control)

     '* Exit the function if there is no information passed

     If IsNull(PhoneNumber) Then

        Exit Function

     End If

     '* Need to strip out unwanted characters leaving only numbers

     PhoneNumber = SStrip(PhoneNumber, "-")

     PhoneNumber = SStrip(PhoneNumber, " ")

     PhoneNumber = SStrip(PhoneNumber, ")")

     PhoneNumber = SStrip(PhoneNumber, "(")

     '* Reformat the character string

     Select Case Len(PhoneNumber)

        Case 7

         Screen.ActiveControl = Format(PhoneNumber, "@@@-@@@@")

        Case 10

         Screen.ActiveControl = Format(PhoneNumber, "(@@@) @@@-@@@@")

        Case 11

         'Note that this should be on one line.

        Screen.ActiveControl = Format(PhoneNumber, "@ (@@@) @@@-@@@@")

        Case Else

          MsgBox "This is not a valid phone number."

          Screen.ActiveControl = PhoneNumber

      End Select

  End Function

  Function SStrip (InWord, StripStr)

   Do While InStr(InWord, StripStr)

      'Note that this should be on one line

      InWord = Mid(InWord, 1, InStr(InWord, StripStr) - 1) & _

               Mid(InWord, InStr(InWord, StripStr) + 1)

   Loop

   SStrip = InWord

  End Function

The Format_Phone() function massages the phone number into a common string

(void of parentheses, spaces, and dashes) and then determines the most

appropriate format. This function returns the phone number back to the form

in that format.

The SStrip() function is a very important concept. It continues to operate

until it eliminates a specified character (StripStr) from the string

(InWord). This is used to eliminate extra characters (dashes, spaces, and

so on) from the phone number.

Additional reference words: 1.00 1.10 mask input format telephone

KBCategory:

KBSubcategory: PgmOthr


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 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: Forms Questions & Answers

Article ID: Q104387

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

                   WX0637: FORMS QUESTIONS & ANSWERS

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

                                                   Revision Date: 9/93

                                                      No Disk Included

The following information applies to Microsoft Access(R), versions

1.0, and 1.1.

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

| 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) 1992-1993 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 invoke my Access Basic code from within a form?

    A. To call a function from a property, type the following:

          =<functionname>()

       The equal sign and parentheses are required. You can call an

       Access Basic function from form or control properties, such as

       AfterUpdate or DefaultValue. Search for the name of a specific

       property in Help for examples. Subroutines cannot be called

       from properties. For more information, please refer to "An

       Introduction to Programming," Chapter 7, page 1.

2.  Q. Do form rules override table rules?

    A. Yes, form rules do override table rules. When you position

       fields on a form by dragging them from the Field list, the

       validation property for the field inherits the validation rule

       that was defined for the field in the table design.

3.  Q. When is it appropriate to use the exclamation point versus the

       period when identifying objects and properties in an

       expression?

    A. A good rule of thumb is to use the exclamation point before

       anything you specifically name (such as the name of your form

       or a control on the form) and to use a period before anything

       Microsoft Access names (such as a property).

4.  Q. Why doesn't the header I created show in Form view?

    A. The header you created was most likely a page header. There are

       two different types of headers available on forms: form headers

       and page headers. A form header is displayed on-screen and when

       printed; a page header is displayed only when printed.

5.  Q. How do I reference a control on a subform?

    A. To reference the subform control itself, you must use the form

       property of the subform control as follows:

          forms!<masterformname>!<subformcontrolname>.form!<controlname>

 6. Q. When are validation rules on a form evaluated?

    A. Microsoft Access evaluates a validation rule only when data is

       entered or edited in a field and the cursor is moved to a

       different field or record. If you leave the field unchanged,

       the validation rule is not evaluated. Microsoft Access also

       validates a field on a form when you leave the form, when you

       switch views, or when you close the form. To check for nulls,

       you must use a macro. For more information, please refer to

       Chapter 22 of the "User's Guide."

7.  Q. How do I create my own record-navigation system on a form

       without using the navigation buttons (called "VCR buttons")?

    A. The Customers form in ORDENTRY.MDB, a sample database supplied

       with Microsoft Access, is an excellent example you can follow

       to create your own record-navigation controls. The navigation

       buttons on this form use generic Access Basic code, which you

       can import to your application.

8.  Q. Why do I get the message "#Error" in some controls on my forms

       or reports?

    A. Microsoft Access places an error value in a field or text box

       on a datasheet or form when it can't find information, execute

       an expression, or store a value within the field's prescribed

       limits. The following list describes the possible error values:

        - #Error: Microsoft Access cannot execute the expression. You

          may have supplied either too few or incorrect arguments for an

          aggregate function. This error also occurs in a table or form

          in which the DefaultValue property for a field or control is

          not appropriate for the DataType or FieldSize property setting,

          or in a query in which the value of a calculated field is larger

          than the FieldSize property setting allows. For example, this

          error message appears if you add or multiply two integer values

          and the resulting integer is larger than is permitted in an

          integer field.

          This error also occurs when you substitute an expression for

          a text box and then use the text box's control name within

          the expression, as in the following example:

             ControlName:     [Test]

             ControlSource:   =[Test]

          Since Microsoft Access automatically sets the ControlName

          property to match the field name, this error commonly occurs

          if you create a text box by dragging a field from the Field

          list box to a form or report.

        - #Num!: The numeric value is too large (either positively or

          negatively) for Microsoft Access to store in the field, based on

          the current DataType or FieldSize property settings.

        - #Name?: The ControlSource property you entered for the field's

          value is invalid. This error can result from any of the following

          conditions:

           - You have misspelled the ControlSource property.

           - You have deleted the ControlSource property itself.

           - You have omitted the equal sign (=) when you entered an

             expression for the ControlSource property.

        - #Div/0!: You tried to divide a number by zero. You can neither do

          this directly in an expression (for example, 8/0) nor indirectly

          by using a value from a field whose numeric value is zero.

        - #Deleted: The record to which you referred has been deleted.

          For example, if you or another user deletes a record from an

          underlying table's datasheet, this error value may replace a

          record in a form's datasheet.

        - #Locked: Another user has locked this record; thus, Microsoft

          Access cannot read the data.

9.  Q. How can I check for duplicate records immediately after I enter

       a value in a primary key field?

    A. For a detailed answer to this question, please order Technical

       Note #102527 by selecting the FastTips Technical Library option

       from the FastTips Main Menu.

Additional reference words: 1.00 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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 Delete Table Without Using DoMenuItem

Article ID: Q94042

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

You can create and use the DeleteTable() function to delete a table without

using the DoMenuItem() or SendKeys() functions.

MORE INFORMATION

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

Microsoft Access stores all references to objects (tables, queries, forms,

reports, macros, and modules) in a system table called MSysObjects. You can

delete an object from the MSysObjects table if you have permission to do

so.

To view the system objects in your database,

1. From the View menu, choose Options.

2. Under the General category, change the Show System Objects item to

   Yes.

3. Choose OK.

All the system tables should now be visible in the Database window.

Next, use the following steps to assign yourself permission to delete

objects from the MSysObjects table:

1. From the Security menu, choose Permissions.

2. Choose modify rights for the table by selecting or clearing the

   appropriate check boxes.

The DeleteTable() function accepts the name of a table as its parameter. It

finds the record in MSysObjects that corresponds to that table name and

deletes that record. The function also deletes records from other system

tables, including MSysACEs, MSysIndexes, and MSysColumns, that relate to

the deleted table. The function returns a value of True if it successfully

deletes the table you specified; it returns a value of False if it cannot

find a table with the name you specified.

NOTE: Modifying data in any system table can have serious ramifications. Do

not attempt to do this unless you are thoroughly familiar with the database

and know exactly where, when, and how the table you want to delete is used

elsewhere in the database. It is best to use the DeleteTable() function on

temporary tables only.

The Access Basic code for the DeleteTable() function is as follows:

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 DeleteTable (TableName as String)

      Dim SQL As String, Msg As String

      If DCount("[Name]", "MSysObjects", "[Name] = '" _

            & TableName & "'") = 0 Then

         DeleteTable = FALSE

         Exit Function

      End If

      On Error GoTo DeleteErrorProc

   ' Suppress the "Do you want to delete these records?" message.

      DoCmd SetWarnings False

   ' SQL statement to delete appropriate entries from the MSysColumns

   ' table follows:

      SQL = "DELETE DISTINCTROW MSysObjects.Name, MSysColumns.*"

      SQL = SQL & " FROM MsysObjects, MSysColumns,"

      SQL = SQL & " MSysColumns INNER JOIN MSysObjects ON"

      SQL = SQL & " MSysColumns.ObjectId = MSysObjects.Id"

      SQL = SQL & " WHERE ((MSysObjects.Name = '" & TableName & "'));"

      DoCmd RunSQL SQL

   ' SQL Statement to delete appropriate entries from MSysACEs table

   ' follows:

      SQL = "DELETE DISTINCTROW MSysObjects.Name, MSysACEs.*"

      SQL = SQL & " FROM MSysObjects, MSysACEs,"

      SQL = SQL & " MSysObjects INNER JOIN MSysACEs ON"

      SQL = SQL & " MSysObjects.Id = MSysACEs.ObjectID"

      SQL = SQL & " WHERE ((MSysObjects.Name= '" & TableName & "'));"

      DoCmd RunSQL SQL

   ' SQL statement to delete references to indexes in MSysIndexes follows:

      SQL = "DELETE DISTINCTROW MSysObjects.Name, MSysIndexes.*"

      SQL = SQL & " FROM MSysObjects, MSysIndexes,"

      SQL = SQL & " MSysObjects INNER JOIN MSysIndexes ON"

      SQL = SQL & " MSysObjects.Id = MSysIndexes.ObjectId"

      SQL = SQL & " WHERE ((MSysObjects.Name= '" & TableName & "'));"

      DoCmd RunSQL SQL

   ' SQL statement to delete references to table object from MSysObjects

   ' follows:

      SQL = "DELETE DISTINCTROW MSysObjects.Name "

      SQL = SQL & " FROM MSysObjects"

      SQL = SQL & " WHERE ((MSysObjects.Name = '" & TableName & "'));"

      DoCmd RunSQL SQL

   ' If you decide to update the Database window, include the following

   ' command:

      SendKeys "{F11} %VQ%VT"'

   ' Test to make sure the object was deleted, then exit.

      If DCount("[Name], "MSysObjects", "[Name] = '" _

            & TableName & "'") = 0 Then

         DeleteTable = True

         Exit Function

      EndIf

   ' If error occurs, display the error message and terminate with error.

   DeleteErrorProc:

      Msg = "An unexpected error has occurred." & Chr(13) & Chr(10)

      Msg = Msg & "Error: " & Error$

         MsgBox Msg

      DeleteTable = False

      Exit Function

   End Function

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, chapter 25

Additional reference words: 1.00 1.10 functions sysfiles

KBCategory:

KBSubcategory: PgmObj


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: Graphing Current Sales Compared with Accumulated Sales

Article ID: Q103270

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to create a graph that displays each customer's

total sales for all years compared with their sales for 1992. The data in

the graph is also broken out according to the company from which the orders

were shipped.

This example uses tables in the sample database NWIND.MDB.

MORE INFORMATION

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

How to Create the Queries

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

1. Create the following new query based on the Orders table, and then

   save the query as Total Sales:

      Field:  Customer ID   Ship Via   Order Amount

      Total:  Group By      Group By   Sum

2. Create the following new query based on the Orders table, and then

   save this query as 1992 Sales:

      Field:    Customer ID   Ship Via   Order Amount   Order Date

      Total:    Group By      Group By   Sum            Where

      Criteria:                                         >=#1/1/92#

3. Create a new query based on the Total Sales and 1992 Sales queries.

4. Join on the field [Customer ID]. Double-click the join line and

   select the option Include ALL Records From Total Sales.

5. Join on the field [Ship Via]. Double-click the join line and select

   the option Include ALL Records From Total Sales.

6. Drag [Customer ID], [Ship Via], and [SumofOrder Amount] from Total

   Sales to the query grid. Add the label Total: to [Sum of Order

   Amount] as follows:

      Total: [SumofOrder Amount]

7. Drag [SumofOrder Amount] from 1992 Sales and add the label 1992 as

   follows:

      1992: [SumofOrder Amount]

8. Run the query to verify that it works correctly and then save it

   as Sales Summary.

How to Create the Graph

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

1. Create a new, blank report based on the Customers table. Display

   the field list and drag the Customer ID field to the detail section.

2. Create a new graph in the detail section by selecting the Graph

   tool from the Toolbox and drawing an unbound object frame.

3. Make the following selections in the Graphing Wizard:

   a. Data source: Sales Summary

         Totals: Sum

   b. Which field(s) for data and labels: Ship Via, Total, and 1992

   c. What labels do you want: Ship Via

   d. What labels for the legend: Total and 1992

   e. Link the Graph to the Report: Yes

   f. Which fields will link: Customer ID = Customer ID

4. Save the report and then preview it. For each customer, the report

   should display a graph of that customer's total sales and 1992 sales

   organized by the shipping company.

Additional reference words: 1.00 1.10 overlay multiple summary

KBCategory:

KBSubcategory:  IntpGrph


INF: Hiding the Database Window Menu Bar

Article ID: Q109337

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

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

=======

In Microsoft Access version 1.x, in order to hide the menu bar associated

with the Database window, you must hide the Database window itself. In

Microsoft Access version 2.0, you can use the MenuBar property to hide the

menu bar.

MORE INFORMATION

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

Microsoft Access version 1.x

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

In version 1.x, the menu bar that appears when the Database window is

selected is always the Database window menu bar. The run-time version of

Microsoft Access hides the Database window by keeping it minimized, and not

displaying the minimized window's icon. However, the Database window's

menus and commands are still available on the menu bar.

To keep the Database window's menu bar from being displayed, you must hide

the Database window. The following sample macro action demonstrates how to

hide the Database window. Add this action to the executable application's

Autoexec macro.

NOTE: Make sure to add this action before any OpenForm actions in the

Autoexec macro in order to avoid hiding the forms after they are opened.

   Action

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

   DoMenuItem

      MenuBar: Database

      Menuname: Window

      Command: Hide

Microsoft Access version 2.0

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

In version 2.0, the MenuBar property applies to the application object,

forms, and reports, and can be set in the Autoexec macro for the

application as a whole. You can use the MenuBar property for custom menu

bars at all points in your application, even while in the Database window

and reports.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.x, Chapter 24, "Using Macros for

Application Design"

Microsoft Access "Building Applications," version 2.0, Chapter 2,

"Structuring a User Interface"

Additional reference words: 1.00 1.10 2.00 ADK

KBCategory:

KBSubcategory: UiOthr


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 1.x Uses SQL Server Connections

Article ID: Q88655

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how Microsoft Access uses connections to SQL Server

and how application developers can minimize the use of these connections.

This article assumes the you are highly knowledgeable about the low-

level interaction between applications and SQL Server.

MORE INFORMATION

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

The conventional application that accesses a server does it in a

simple single-tasking manner, requiring a single connection to the

server. Microsoft Access, however, is not a typical conventional server

front-end. Many of its features, including updatable views (dynasets),

joins between local and server data, execution of complex expressions

that the server may not be able to handle, and seamless transition

from one server to another, require Microsoft Access to obtain more

connections than a conventional front-end.

Although some servers, such as Microsoft SQL Server, are not stingy

giving out connections, there are other servers that place strict

limits on the number of connections an application can open. (In some

installations, SQL Server also places absolute restrictions on

connections.) When designing applications for the more restrictive

servers, it is important to understand how Microsoft Access uses

connections.

Connections are opened by Microsoft Access when it needs to execute a

query on the server (which it must do to build dynasets or static views),

obtain the data in a dynaset, or update data on the server. These

connections can be categorized into two types: connections needed to

build the working set and connections needed to service dynasets.

Both types of views available in Microsoft Access (static views and

dynasets) are built by executing a query (called a "local" query to

differentiate it from other types of queries discussed below). This

local query processes Microsoft Access and foreign ISAM data (both

locally and file server based) and remote server data, and pulls it

into a temporary table that represents the view. To build static views,

the actual data is stored in the temporary table, whereas to build

dynasets, pointers to the actual data are stored.

When server data is included in the local query, execution of the

query involves asking the server (or servers) for data, which is done

by opening connections and sending queries to the server. Each query

sent to the server requires that a connection be opened.  If more than

one query is to be sent to the server, a single connection could be

used and the queries executed serially. However, this would typically

require the user to wait for all of the server queries to complete

before any data would appear. Therefore, Microsoft Access executes the

server queries in parallel, requiring a connection for each.

The number of queries sent to a server may not be entirely obvious.

Much of the time, access to all of the remote base tables will be

combined into a single query, if all of the base tables reside on the

same server. In the worst case, each server base table referenced by

the local query will require a connection. There are several factors

that could compel Microsoft Access to split a local query into several

server queries:

 - If server data is joined to data from other sources (that is,

   local, foreign ISAM, and other servers), the Microsoft Access

   optimizer may decide that it is more efficient not to combine

   references to two tables on the same server into a single query.

   For example, if the Customers and Order Items tables are on a server

   and the Orders table is in a local Microsoft Access database, then it

   is likely that the optimizer will decide to ask for the Customers and

   Order Items tables separately, rather than asking for the cross-product

   of the two, to join to the Orders table. As you can tell from this

   example, this is unlikely to happen in a real scenario.

 - If an expression involved in the query cannot be executed on the

   server (either because the server does not support it or because the

   semantics provided by the server differ greatly from those provided

   by Microsoft Access), the expression will be executed locally. An

   extreme example of this is a local query with a restriction that calls

   a user-defined function. Although this may not require separating

   remote tables into separate server queries, it will if the

   expression that is not executable on the server is somehow involved

   with the join between the two tables. Note that in Microsoft Access,

   expressions containing a conjunction that can be executed on the

   server will be executed locally in their entirety. These

   expressions are not split to execute part locally and part on the

   server.

 - The parameters used to attach tables on the same server to a Microsoft

   Access database differ. For example, if two tables are in different

   databases, or if they are being accessed using different user names

   and passwords, then separate connections will be required to

   execute a local query referencing both of them.

   Connections opened in the execution of a local query will be kept

   open until the working set containing the queries is closed.

   Connections are also opened in support of dynasets. But, unlike the

   server queries sent during the execution of a local query, the

   queries sent to the server in support of a dynaset are executed

   entirely and very quickly. This is because they are used to fill

   portions of the dynaset with data (given the pointers to the data

   provided by the local query), and to do updates to the server.

   Therefore, Microsoft Access opens only one connection per attached

   server, provided that the link attachment information is the same

   for each server tables.

As a result of the above rules, when Microsoft Access executes a query, it

typically requires only one (for a static view) or two (for a dynaset)

connection. This does not represent an extravagant use of server

connections, but good applications could involve the execution of many

Microsoft Access queries that could occupy many server connections very

quickly. There are some steps the designer can take to minimize the use

of connections:

 - Reduce the number of queries required by the application. Each

   form, subform, data sheet, report, and list box requires a query,

   and each of these queries that accesses server data will require at

   least one or two connections. Close forms, data sheets, and reports

   as soon as they are no longer needed. Also, bring server data to a

   local database where practical, especially for filling list boxes.

 - Avoid queries that join server data to local data to server data,

   as described above. These types of queries will most likely be

   executed using a connection for each server table.

 - Avoid expressions that must be executed locally when joining server

   data together. Each of the tables involved with such a join

   expression, or that is restricted by a WHERE clause containing such

   an expression, will need to be executed locally. It should be noted

   that separating expressions into separate query objects will not

   help alleviate this problem, because the optimizer combines all

   query objects in a single query before execution for efficiency.

 - Use static working sets when seeing other users' changes, or when

   making changes yourself is not required. This will avoid the

   connections needed to support dynasets.

With an understanding of how Microsoft Access uses connections, and with

prudent application design, you should not run out of server connections.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ObcOthr


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 MS Access Handles Logins to Attached SQL Tables

Article ID: Q93145

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

How Microsoft Access handles a login to an attached SQL table depends

on how the table was originally attached, and whether the login and

password were saved with the table information. It may also depend on

who attached the SQL table, what rights that person has to that table,

what rights you have to that table, and where the tables are located

(different servers, different databases, same database).

MORE INFORMATION

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

If the "Save login ID and password locally" option was enabled when a

SQL table is attached, you will not be prompted for a login ID and

password. Instead, you automatically receive the rights to each table

that are appropriate for the login ID used when the table was

attached.

If this option was not enabled, you are prompted for a login ID and

password once for each unique data source, and you receive the rights

to each table that are appropriate for the login ID that you use.

NOTE: A unique data source is composed of the unique combination of a

SQL server and a database on that server.

So, if you attach multiple SQL tables and use different login IDs with

different rights for each table, but do not enable the option to save

the login and password information, the next time you access the

tables, the login ID and password you supply for each data source will

determine the authority you have to the tables from that data source.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 60-62 and 66-68

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ObcOthr


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 NWIND.MDB Employee Field Photographs Were Created

Article ID: Q100169

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Below is a synopsis of how the photos for the Photo field of the

Employees table in the Northwind Traders sample database NWIND.MDB

were prepared and processed.

1. Photographs of the subjects were taken with a camera and developed

   as prints.

2. The prints were scanned on a color scanner connected to an

   Apple Macintosh.

3. The resulting files from the Macintosh (in .TIFF file format) were

   transferred to an IBM PC/AT compatible computer (to .BMP file format).

4. The images were converted from 256-color to 16-color (dithered) so

   that pictures would display correctly in 16-color mode, and also

   because 16-color images display faster than 256-color images.

5. The images were then added as embedded objects in the Employees

   table of the Northwind Traders database, following the instructions

   given in the Microsoft Access "User's Guide," Chapter 13, "Using

   Pictures, Graphs, and Other Objects," pages 314-339.

MORE INFORMATION

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

If you plan to use this process yourself, steps can be eliminated if

you use a scanner directly connected to an IBM PC/AT compatible

computer since the image transfer from the Macintosh (step 3) would not

be necessary and step 4 can often be handled by the scanner software.

Software helpful for processing graphic images:

Apple Macintosh

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

Adobe Photoshop

IBM PC/AT Compatibles

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

PaintShop (Shareware--can be used for image file conversions.)

WinGif (Shareware--can be used for image file conversions.)

Microsoft Paintbrush (Great for touching up stray pixels.)

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 13, "Using Pictures,

Graphs, and Other Objects," pages 314-339 (in version 1.1, see pages 318-

343)

Additional reference words: 1.00 1.10 ole object

KBCategory:

KBSubcategory: TblOthr


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 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 Add Items to the Help Menu

Article ID: Q88648

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

The information in this article applies to:

- Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The Help menu items that appear at the top of the screen in Microsoft

Access can be supplemented so that your own custom menu items appear.

This can be done by creating an entry in the MSACCESS.INI file.

MORE INFORMATION

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

You can add your own entries to the [Menu Add-Ins] section of the

MSACCESS.INI file. You can use this feature to invoke a macro, an Access

Basic program, or an Access Basic function from a Help menu item. To add

to this section of the MSACCESS.INI file, follow these steps:

1. Close Microsoft Access if it is open.

2. From your Windows Program Manager, start Notepad.

3. In Notepad, open the file MSACCESS.INI (this file is located in

   your Windows directory).

4. Scroll to the bottom of the file, add a blank line, and type the

   following:

      [Menu Add-Ins]

5. Add any menu items that you want to appear in the Help menu below

   the line you just typed. Add lines using the following syntax:

      <menu label>=<menu action>

   Substitute the text that you want to appear in the Help menu for

   <menu label>, and the macro name, user-defined function, or Access

   Basic function that should be run for <menu action> in the example

   above.

For example, to add a Help menu item called Customer Form that runs a

macro called OpenCustForm, the [Menu Add-Ins] section of the MSACCESS.INI

file would read:

   [Menu Add-Ins]

   Customer Form=OpenCustForm

To add a Help menu item called Run Daily Update that runs a user-defined

Access Basic function called RunUpdate(), you would add the following to

the MSACCESS.INI file:

   [Menu Add-Ins]

   Run Daily Update==RunUpdate()

Note that the second equal sign (=) in the above example is required for

running user-defined or other Access Basic functions.

You can also define an underlined character in your Help menu item that

is accessible with the ALT key. To do this, place an ampersand (&) in

front of the character that should be underlined. For example, to create

a Help menu item called Show Message with the M underlined that calls the

Access Basic MsgBox() function, add the following to the MSACCESS.INI

file:

   [Menu Add-Ins]

   Show &Message==MsgBox("This is a message")

You can add multiple items to the [Menu Add-Ins] section of the

MSACCESS.INI file. The example below includes all the examples in this

article:

   [Menu Add-Ins]

   Customer Form=OpenCustForm

   Run Daily Update==RunUpdate()

   Show &Message==MsgBox("This is a message")

Once you have made these changes to the MSACCESS.INI file, save the file

and then close Notepad. When you restart Microsoft Access, the items in

the [Menu Add-Ins] section will be available from the Help menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: UiOthr


INF: How to Add the ACC-KB.HLP File to the Help Menu

Article ID: Q109267

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article explains how to add the Microsoft Access Knowledge Base (KB)

Help file to the Microsoft Access Help menu.

This article assumes that you have already obtained the KB Help file. If

you do not have the file, refer to article Q116190 for full instructions on

how to obtain the file.

MORE INFORMATION

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

To add the Microsoft Access KB Help file to the Help menu, add

the following line to the [Menu Add-Ins] section of the MSACCESS.INI file:

   Access &KB==Shell("winhelp c:\access\acckb1.hlp",1)

   -or-

   Access &KB==Shell("winhelp c:\access\acckb2.hlp",1)

Note that this article assumes that the KB Help file is located in the

ACCESS directory on drive C. If the file and its associated DLL files are

located elsewhere, the error message "Routine not found" will be generated

when you run the new command on the Help menu.

REFERENCES

==========

Microsoft Access "Language Reference," page 440

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: MdlLib


INF: How to Avoid Abandoned Group Headers in Reports

Article ID: Q100920

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes a routine to keep a given number of records

together on a page with their group header. The article also explains how

to avoid an abandoned group header at the bottom of a page and how not to

print the group header beyond a certain position on the page in a single-

column or multiple-column 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.

MORE INFORMATION

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

The KeepTogether property is used to keep all of the controls for one

record together in a particular section of a report. This property

does not keep multiple records together, nor does it keep a group

header and its detail records together.

Method 1 below helps you to find the location on the page beyond which

you should not print a group header if you want to keep a given number of

records together with that header.

Method 2 below helps you to determine the twip location by trial and

error and describes two sample functions, one for a single-column report

and the other for a multi-column report.

Method 1

--------

To keep a set number of records together on a single page with the group

header, you need to know approximately how many records will be printed

per group, or, more importantly, how many records you want to print with

a particular group header. You can preview your report to find the group

that prints the most records to determine how many records to keep with

the group header.

For example, say you have determined that the largest group prints 24

records. The detail section of your report is 1/4 inch in height; thus,

24 detail records take up 6 inches on a page. You must also consider the

top and bottom margins, which default to 1 inch each, and the height of

your group header section.

Using the Report.Top property, you can determine where on the page the

next section will print. If enough space remains to print your group

header, all of its detail records, and the page footer (if any), plus

the bottom margin, your group header will be printed on the same page

as its detail records. If there is not enough blank space, delay

printing the report (use a combination of the MoveLayout, NextRecord,

and PrintSection properties to leave the rest of the page blank) and

continue the group header information on the next page.

Below are sample measurements on which this article's calculations are

based:

    Page Length:    11 inches

    Detail.Height:  0.25 inch

Add the following values together:

    Top Margin:          1 inch

    Page Header.Height:  1 inch

    Group Header.Height: 0.5 inch

    Group Footer.Height: 0.5 inch

    Page Footer.Height:  1 inch

    Bottom Margin:       1 inch

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

    Total = 5 inches

To determine the blank space left on the page for detail records,

subtract the total above from your Page Length property value (11

inches - 5 inches = 6 inches).

Divide the maximum space for detail records by the Detail.Height

property value (6 inches / 0.25 inch). A total of 24 detail records

will fit on a page. Force a new page if fewer than 8 records will

print with the header (for example, if the formula returns either less

than the sum of 8 * 0.25 inches or less than 2 inches of blank space).

To determine where the top of the 2-inch limit is, or the point beyond

which you should not print the group header, add the following values

together:

     Top margin 1 inch

     + Page Header.Height 1 inch

     + Remainder of detail section (6 inches - 2 inches)

     = 1 inch + 1 inch + (6 inches - 2 inches)

Final calculation for the function: = 6 inches or (6 * 1440 twips)

To implement this calculation in a module, use the following steps:

1. Enter the =PrintOK() function in the OnFormat property of your

   group header. (This function assumes a report name of MyReport.)

2. Type the following lines in the Declarations section of a module:

      Option Explicit

      Function PrintOK()

         Dim R As Report

         Set R = Reports!MyReport

         If R.Top > (6 * 1440) Then

            R.MoveLayout = TRUE

            R.PrintSection = FALSE

            R.NextRecord = FALSE

         End If

      End Function

Method 2

--------

Another way to avoid an abandoned group header at the bottom of a

page, or not to print the group header beyond a certain position on

the page, is to replace (6*1440) in the function above with the twip

location beyond which you do not want to print.

The report tests the Top property; if the condition is True, the

report does not print the section. Instead, it moves down the report

layout and attempts to print the section until the condition is False,

which occurs at the top of the next page.

For a multi-column report, the function must be modified as follows:

Option Compare Database

Option Explicit

'=====================================================================

'

' Function to force to new column if at bottom of column.

'  R is the name of the Report being formatted, as in

'  Reports![ReportName], and

'  Bottom is the value (in inches) at which a new column is forced.

'====================================================================

Function IfBottom (R As Report, Bottom As Integer)

   Dim YPos

   Static LastPos

   YPos = R.Top

   If YPos > Bottom * 1440 Then  'Beyond this position, go to a new column.

      R.MoveLayout = True

      R.NextRecord = False

      R.PrintSection = (YPos = LastPos) 'Set to True when at Max position.

      LastPos = YPos

   End If

End Function

NOTE: This function will not work properly if Item Layout is set to

Vertical (in Print Setup) for the columns.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RptSort


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 Read-Only Properties at Run Time

Article ID: Q93298

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Microsoft Access does not allow you to change some control properties,

such as Color and Caption, at run time. This article discusses how you

can get around this limitation.

MORE INFORMATION

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

You can work around this limitation by creating two controls that are

identical except for the property you want to change. You place these

controls at the same location with their Visible property set to No.

At the point where the property is to change, set the Visible property

of the control with the desired property setting to Yes using a Macro

SetValue action, and set the Visible property of the other control to

No in the same manner.

The following example demonstrates this method. In the example, a form

appears with one button and text box. The text box is Blue, and the

button has the Caption "Red." When you click the button, the text

box's color will change to red and the button's caption will change to

"Blue." Clicking the Blue button will toggle back to Red, and so on.

1. Create a new form with the following two text boxes:

       Text Box

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

       Control Name: Red

       Fill Color: 255

       Visible: No

       Text Box

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

       Control Name: Blue

       Fill Color: 16711680

       Visible: Yes

2. Position the text box called Blue directly on top of the text box

   called Red and make sure they are exactly the same size so that

   one covers the other.

3. Add the following two command buttons to the form:

       Command Button

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

       Control Name: RedButton

       Caption: Change to Red

       Visible: Yes

       On Push: ChangeColor.Red

       Command Button

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

       Control Name: BlueButton

       Caption: Change to Blue

       Visible: No

       On Push: ChangeColor.Blue

4. Position the command button called BlueButton directly on top of the

   command button called RedButton and make sure they are exactly

   the same size so that one covers the other.

5. Add the following text box to the form and delete its label:

       Text Box

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

       Control Name: GiveMeFocus

       Width: 0

   The purpose of the zero width for the text box is to maintain focus

   while the Visible properties of other controls are changing.

6. Save the form as ChangeColor and then close it.

7. Create the following new macro:

       Macro Name  Action          Arguments

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

       Blue        GoToControl     ControlName .. GiveMeFocus

                   SetValue        Item ......... [Blue]

                                   Expression ... [Red]

                   SetValue        Item ......... [Blue].Visible

                                   Expression ... True

                   SetValue        Item ......... [Red].Visible

                                   Expression ... False

                   SetValue        Item ......... [RedButton].Visible

                                   Expression ... True

                   SetValue        Item ......... [BlueButton].Visible

                                   Expression ... False

       Red         GoToControl     ControlName .. GiveMeFocus

                   SetValue        Item ......... [Red]

                                   Expression ... [Blue]

                   SetValue        Item ......... [Red].Visible

                                   Expression ... True

                   SetValue        Item ......... [Blue].Visible

                                   Expression ... False

                   SetValue        Item ......... [BlueButton].Visible

                                   Expression ... True

                   SetValue        Item ......... [RedButton].Visible

                                   Expression ... False

8. Save the macro as ChangeColor and then close it.

9. Open the ChangeColor form in Form view. Type any text in the text

   box, and then click the command button. Note that each time you click

   the command button, the color and caption of the button changes,

   without changing the value of the text box.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsProp


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 "Top 10" Report

Article ID: Q109319

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There is no built-in method in Microsoft Access to limit the number of

records returned in a query based on their order. This article describes

a method for creating a "Top 10" report, which is a report that will

print the first 10 records in the report, based on the report's sort

order.

MORE INFORMATION

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

The following example demonstrates how to create a Top 10 report using a

calculated control's RunningSum property to provide a dynamic counter for

each record. A macro called from the report's OnFormat property then

cancels the formatting of records whose counter falls outside the range you

want to print:

1. Open the sample database NWIND.MDB.

2. Create the following new report, and then save it as Top 10 Report:

      Report: Top 10 Report

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

      RecordSource: Sales by Sale Amount

      Detail Section

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

      OnFormat: Top 10 Macro

      Text Box

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

      ControlName: Sale Amount

      ControlSource: Sale Amount

      Text Box

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

      ControlName: Order ID

      ControlSource: Order ID

      Text Box

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

      ControlName: Company Name

      ControlSource: Company Name

      Text Box

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

      ControlName: Counter

      ControlSource: =1

      Visible: No

      RunningSum: Over All

3. From the View menu, choose Sorting And Grouping. Enter the following in

   the Sorting And Grouping window, and then close the window:

      Field/Expression: Sale Amount

      Sort Order: Descending

4. Create the following new macro, and then save it as Top 10 Macro:

      Macro: Top 10 Macro

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

      Condition: [Counter]>10

      Action: CancelEvent

5. Preview the report. The counter control will number each record, and the

   macro will prevent any record whose counter is greater than 10 from

   being printed. Since the report is sorted on Sale Amount, the 10 largest

   sales will be printed.

Notes

-----

 - If you use this method with a Grouping/Totals report, the totals will

   include the records that are not printed, so the totals may not appear

   to be correct. To avoid this discrepancy, you can create a dynamic

   counter in the query. For more information on this method, search on the

   following words here in the Microsoft Knowledge Base:

      dynamic and counter and query.

 - You can use this method with a Grouping/Totals report to show the top 10

   records per group. To do this, change the counter control's RunningSum

   property from Over All to Over Group.

 - You can use this method with a Grouping/Totals report to show the top 10

   groups. To do this, add the counter control to the report's group header

   instead of to the detail section, and add the macro to the OnFormat

   property of the group header, the detail section, and the group footer.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 19, "Sorting and

Grouping Data," pages 450-464

Additional reference words: 1.00 1.10 runningsum

KBCategory:

KBSubcategory: RptOthr


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 Dynamic Crosstab Report

Article ID: Q103262

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Using Microsoft Access version 1.x, you may want to create dynamic reports

based on parameter crosstab queries, or have reports to match a dynaset

returned by such a query. Dynamic reports allow your customized reports

to show only the most recently modified data and eliminate the need for

fixed column headings and empty columns.

The example below uses starting and ending dates entered on a form as

the parameters in a crosstab query. When a button on the form is

chosen, Access Basic functions run the crosstab query, which creates a

dynaset whose contents are displayed in a report.

In the following example, the report shows which employees had sales

for the current week, based on the dates entered on the form.

MORE INFORMATION

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

The steps below show how to create a dynamic crosstab report based on

tables in the sample database NWIND.MDB.

The following new objects must be added to the database: one table,

one query, one form, one report and two functions. Each item is

explained in a separate section below.

TABLE: XTabResult

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

This table must contain enough columns to hold the maximum number of

fields that the crosstab query can possibly generate. The table is

later filled with data by Access Basic functions.

For this example, the maximum number of fields generated by the

crosstab query is 10, with no primary key necessary. Create a new

table with 10 columns (columns 0-9) with the Text data type (for

example, Column0, Column1, and so forth).

QUERY: CrossQry

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

Create a new crosstab query based on the Employees, Orders, Order

Details, and Products tables. (These tables are already joined, based

on previously created relationships in the NWIND database.) To do

this, use the following steps:

1. Choose the Query button in the Database window, then choose the New

   button.

2. Add the Employees, Orders, Order Details, and Products tables.

3. Drag the following fields to the query grid and add the values

   shown below:

   NOTE: To display the crosstab field, choose Crosstab from the Query

   menu.

      Field: Order Amount

         Table: Orders

         Total: Sum

         Crosstab: Value

      Field: Product Name

         Table: Products

         Total: Group By

         Crosstab: Row Heading

      Field: RowTotal:Order Amount

         Table: Orders

         Total: Sum

         Crosstab: Row Heading

      Field: Last Name

         Table: Employees

         Total: Group By

         Crosstab: Column Heading

      Field: Order Date

         Table: Orders

         Total: Where

         Crosstab:

         Criteria: Between [Start Date] and [End Date]

   If you choose SQL from the View menu, the SQL statement should look

   like the following:

      PARAMETERS [Start Date] DateTime, [End Date] DateTime;

      TRANSFORM Sum(Orders.[Order Amount]) AS [SumOfOrder Amount]

      SELECT Products.[Product Name], Sum(Orders.[Order Amount])

      AS RowTotal

      FROM Employees, Orders, [Order Details], Products, Orders

      INNER JOIN [Order Details]

      ON Orders.[Order ID] = [Order Details].[Order ID], Employees

      INNER JOIN Orders

      ON Employees.[Employee ID] = Orders.[Employee ID], Products

      INNER JOIN [Order Details]

      ON Products.[Product ID] = [Order Details].[Product ID]

      WHERE ((Orders.[Order Date] Between [Start Date] And [End Date]))

      GROUP BY Products.[Product Name]

      PIVOT Employees.[Last Name]

      WITH OWNERACCESS OPTION;

4. In the Query Parameters box, add two parameters with the same data

   type, as follows:

      Parameter     DataType

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

      [Start Date]   Date/Time

      [End Date]     Date/Time

FORM: XTabSample

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

1. Create an unbound form. Add two unbound text box controls with the

   following properties:

      (Text_Box_1) ControlName: Start Date

      (Text_Box_2) ControlName: End Date

2. Add a button to the form with the following properties:

      Caption: "Print Report"

      OnPush:  =XTabPrint()

REPORT: CrossReport

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

1. Create a bound report with Page Header and Detail sections and the

   following RecordSource property:

      RecordSource:  XTabResult

2. In the page header, create 10 tabular text box controls, without

   labels, and change the ControlSource property of each to one of the

   matching functions below:

      =GetPageHdr(0)  =GetPageHdr(1)  =GetPageHdr(2)  =GetPageHdr(3)

      =GetPageHdr(4)  =GetPageHdr(5)  =GetPageHdr(6)  =GetPageHdr(7)

      =GetPageHdr(8)  =GetPageHdr(9)

   For example, the ControlSource property of the first text box should

   be set to =GetPageHdr(0), the second to =GetPageHdr(1), and so

   forth.

3. In the Detail section, create 10 tabular text box controls without

   labels. Bind each of these controls to one of each of the fields in

   the XTabResult table:

      [Column0] [Column1] [Column2] [Column3] [Column4] [Column5]

      [Column6] [Column7] [Column8] [Column9]

MODULE: <Any Name>

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

Create a new module with the following Access Basic code and call it

any name you choose:

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 Compare Database   'Use database order for string comparisons.

   Option Explicit

   '==================

   ' Global variables

   '==================

   Dim MyFields()            ' For holding field names.

   Dim nColumns As Integer   ' For holding the number of columns.

   '=====================

   ' GetPageHdr Function

   '=====================

   Function GetPageHdr (col)

      If (col < nColumns) Then

         GetPageHdr = MyFields(col)

      Else

         GetPageHdr = ""

      End If

   End Function

   '====================

   ' XTabPrint Function

   '====================

   Function XTabPrint ()

      Dim MyDB As Database, MyTable As Table

      Dim MyDyna As Dynaset, MyQueryDef As QueryDef

      Dim MySnap As Snapshot, i As Integer

      ' Create a dynaset from the query.

      Set MyDB = CurrentDB()

      Set MyQueryDef = MyDB.OpenQueryDef("CrossQry")

      MyQueryDef![Start Date] = Forms![XTabSample]![Start Date]

      MyQueryDef![End Date] = Forms![XTabSample]![End Date]

      Set MyDyna = MyQueryDef.CreateDynaset()

      MyQueryDef.Close

      ' Get field information and store the field names.

      Set MySnap = MyDyna.ListFields()

      MySnap.MoveLast

      MySnap.MoveFirst

      nColumns = MySnap.RecordCount

      ReDim MyFields(nColumns)

      i = 0

      While Not MySnap.EOF

         MyFields(i) = MySnap!Name

         i = i + 1

         MySnap.MoveNext

      Wend

      MySnap.Close

      ' Delete the contents of the XTabResult table.

      Set MyTable = MyDB.OpenTable("XTabResult")

      While Not MyTable.EOF

         MyTable.Delete

         MyTable.MoveNext

      Wend

      ' Dump the dynaset into the XTabResult table.

      ' Table should have a column called COLUMN# for each column in

      ' the crosstab dynaset.

      While Not MyDyna.EOF

         MyTable.AddNew

         For i = 0 To nColumns - 1

            MyTable("Column" & i) = MyDyna(MyFields(i))

         Next

         MyTable.Update

         MyDyna.MoveNext

      Wend

      MyTable.Close

      MyDyna.Close

      ' Print the report.

      DoCmd OpenReport "CrossReport", A_PREVIEW

   End Function

Choosing a Date Range

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

After you create the new database objects specified above, you will be

able to open the XTabSample form and enter starting and ending dates

on the form. A recommended data range is 1/1/91 through 12/21/92.

However, if you alternate short date ranges with long date ranges, you

will see how the report dynamically changes to fit the data.

After entering the date range, choose the Print Report button on the

form to display your dynamic report.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 154-159

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RptOthr


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 Graph Without a Title

Article ID: Q92655

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

In Microsoft Access version 1.x, when you create a graph in a form's

Design view using the GraphWizard, Microsoft Access supplies the default

title "Graph" if no title is specified for the chart.

MORE INFORMATION

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

You can eliminate the default "Graph" title created by the GraphWizard in

Microsoft Access version 1.x by changing the font color of the graph's

title to the same color as the form's background. To do this, follow these

steps:

 1. Start Microsoft Graph from a form's Design view by double-clicking the

    graph object.

 2. Double-click the graph title.

 3. From the Format menu, choose Font.

 4. Change the font color to the same color as your form's background

    color.

 5. Close Microsoft Graph and answer Yes when you are prompted to update.

 6. Save the form.

Since the title is now the same color as the form's background, the title

is essentially invisible.

If you convert the graph to Microsoft Graph version 5.0, the title can

become visible again. If this occurs, follow these steps in addition to the

steps above:

 7. In the form's Design view, double-click the graph to start Microsoft

    Graph 5.0.

 8. Double-click the title to open the Format Chart Title dialog box.

 9. Select the Font tab.

10. In the Background box, select Transparent.

11. Choose OK.

Another way to eliminate a chart title in Graph 5.0 is to choose Titles

from the graph's Insert menu, then clear the Chart Title check box.

Additional reference words: 1.00 1.10 charts titles graphs

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 Password Text Box

Article ID: Q88650

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Some applications require password protection and should provide a

dialog box at startup which prompts the user for a password. For

security purposes, this prompt should not show the characters that the

user is typing, but should give the user some idea of how many

characters have been typed so that the user does not lose track of

what part of the password is being typed. This article describes how you

can create a password text box in Microsoft Access version 1.x.

In Microsoft Access version 2.0, you can use input masks for typing data

into a field or control. There is an input mask specifically for password

entry. For more information, search for "input masks" using the Microsoft

Access 2.0 Help menu.

MORE INFORMATION

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

To create a password text box:

1. Create a form and open it Design view.

2. Add a text box and select it so it has the focus.

3. In the toolbar, drop down the list of fonts located directly to the

   right of the Paint Pallette toolbar button.

4. From the list, choose 'Courier'.

5. In the toolbar, drop down the list of font sizes located directly

   to the right of the list of fonts from which you just made a

   selection.

6. From the list, choose the value 10.

7. From the palette window, click on the color White for both the

   Fill row and Text row of colors.

8. Save the form and switch to Form view.

When you type characters into the password text box, notice that they do

not appear, but the cursor is present. The Courier font assigned to the

text box makes cursor movement and position clearly identifiable so that

the user has an idea of how many characters have been typed.

REFERENCES

==========

For more information about the InputMask property, search for "text box:

for entering passwords" then "InputMask Property" using the Microsoft

Access Help menu.

-or-

Search for "passwords: text box for entering" then "InputMask Property"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ScrtOthr


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 a Table with Access Basic Code

Article ID: Q88157

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There is no command in Microsoft Access to programmatically create a

table. This article demonstrates a method and a user-defined Access Basic

function you can use to accomplish this task. The user-defined function

requires a "template table" that you can create.

MORE INFORMATION

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

Create the template table before you create the user-defined function. The

template table is used to define the data types that will be used in the

new table.

For example, in the template table below, the user has created a data

type called Long Text, which is a 255-character Text field. The user

has also created data types called Short Text, Long Int, and so on.

Table Name: MyTemplate

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

Field Name     Field Type     Length

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

Long Text      Text           255

Short Text     Text           50

Long Int       Number         Long Integer

Integer        Number         Integer

Memo           Memo           N/A

Date/Time      Date/Time      N/A

OLE Object     OLE Object     N/A

This template can be used as a generic template for using the

CreateTable procedure. Once you have defined your data types in a

template table, you can use the CreateTable procedure in the following

manner:

Definition

----------

CreateTable <target table>, <template table>, <structure definition>

Where:

<target table> is the name of the table to create and MUST NOT exist

in the database. You may want to code a routine to check for the

existence of such a table before invoking this procedure.

<template table> contains the user-defined data types that will be

used in creating the target table.

<structure definition> defines the structure of the columns in the

table.

Where:

<structure definition> = "<field name> As <user-defined data

type>,..."

NOTE: There are quotation marks around the entire <structure

definition> parameter.

Below is an example of how you would invoke the CreateTable procedure

to create a table based on the template table discussed earlier:

CreateTable "NewTable",

            "MyTemplate",

            "First Name As Short Text,

             Last Name As Short Text,

             Description As Long Text,

             Amount As Integer,

             Notes As Memo"

How CreateTable Works

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

As mentioned earlier, there is no Access Basic command or function to

create a table. Fortunately, Microsoft Access supports the SQL SELECT INTO

command that can be used to create a table. However, SELECT INTO

requires a table for its FROM clause, which explains why you need to

have a template table.

CreateTable parses out the structure definition, then builds a

SELECT INTO statement based on that definition. Once the SQL statement

is built, the QueryDef object is employed to invoke the command,

resulting in a new table.

Procedure Listing

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

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 CreateTable (TargetTbl As String, TemplateTbl As String,

   StructureDef As String)

   Dim LineChunk As String, SelectStmt As String, TempChunk As String

   Dim CharPos As Integer, HomePos As Integer, BuildLoop As Integer

   Dim CrtTblDB As Database, CrtTblQry As QueryDef

   BuildLoop = True

   HomePos = 1

   SelectStmt = "Select "

   Do While BuildLoop

      If InStr(HomePos, StructureDef, ",") <> 0 Then

         LineChunk = Trim(Mid$(StructureDef, HomePos, (InStr(HomePos,_

                     StructureDef, ",") - HomePos)))

      Else

         LineChunk = Trim(Mid$(StructureDef, HomePos))

         BuildLoop = False

      End If

      TempChunk = Trim$(Mid$(LineChunk, InStr(UCase$(LineChunk),_

                  " AS ") + 3))

      SelectStmt = SelectStmt & "[" & Trim(Mid$(TempChunk, 1))_

                   & "]" & " As [" & Trim(Mid$(LineChunk, 1, _

                   InStr(UCase$(LineChunk), " AS "))) & "],"

      HomePos = InStr(HomePos, StructureDef, ",") + 1

   Loop

   SelectStmt = Left$(Trim(SelectStmt), Len(Trim(SelectStmt)) - 1) & "_

                Into [" & TargetTbl & "] From [" & TemplateTbl & "];"

   Set CrtTblDB = CurrentDB()

   Set CrtTblQry = CrtTblDB.CreateQueryDef("TempQuery", SelectStmt)

   CrtTblQry.Execute

   CrtTblQry.Close

   CrtTblDB.DeleteQueryDef ("TempQuery")

End Sub

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: TblModfy


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 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 Database Is Open Exclusively

Article ID: Q114837

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes a method using Access Basic that you can use to

determine if a database is open exclusively in Microsoft Access version

1.x.

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

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

When a database is open exclusively, no other program or process can access

that database. When a database is open shared, other programs and processes

can get shared access to the database. This article demonstrates how to use

the Open statement in Access Basic to determine if a database is open

exclusively by using the Open statement's Shared argument to try to access

the database file in shared mode. If the database is open exclusively, an

error will occur. Trapping for the error determines whether the database is

open exclusively or not.

This function may be useful to Access Basic programmers who want to warn

their applications' users that a database is open in the wrong mode.

The following steps demonstrate how to determine whether a database is open

exclusively:

1. Open the sample database NWIND.MDB.

2. Create a new module and add the following line to the Declarations

   section:

      Option Explicit

3. Enter the following function in the module:

      Function IsCurDBExclusive1x () As Integer

      ' Purpose: Determine if a database is open exclusively.

      ' Returns: 0 if the database is not open exclusively.

      '          -1 if the database is open exclusively.

      '          Err if any error condition is detected.

        Dim hFile As Integer

        Dim DBName As String

        hFile = FreeFile

        'This is the name of the database to test.

        dbname = "C:\access\nwind.mdb"

        If Dir$(DBName) <> "" Then

          On Error Resume Next

            Open dbname For Binary Access Read Write Shared As hFile

              Select Case Err

                Case 0

                  IsCurDBExclusive1x = False

                Case 70

                  IsCurDBExclusive1x = True

                Case Else:

                  IsCurDBExclusive1x = Err

              End Select

            Close hFile

          On Error GoTo 0

        Else

          MsgBox "Couldn't find " & dbname & "."

        End If

      End Function

   NOTE: Set the variable DBName to the name of the database file that

   you want to test.

4. From the View menu, choose Immediate Window.

5. Type the following line in the Immediate window, and then press ENTER:

      If IsCurDBExclusive1x()=True Then Msgbox "It's Exclusive!"

If the database named in the DBName variable is open exclusively, the

message "It's Exclusive!" will appear. If the database is open shared, the

message will not appear.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.x, pages 343-345

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlMu


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 Record Is Being Edited

Article ID: Q106298

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

In Microsoft Access version 1.x, there is no built-in functionality to

determine if the current record on a form is "dirty," or being edited. This

article demonstrates a method of determining if the current record is being

edited.

Note that in Microsoft Access version 2.0, you can use the Dirty property

to determine if a record is being edited.

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.

When you are editing a record, the record selector on the left side of the

form becomes a pencil. The pencil indicates that changes have been made to

the record that have not yet been saved.

If the record is being edited, and you try to save it, Microsoft Access

will run the form's BeforeUpdate event before saving the record. Microsoft

Access will not run the BeforeUpdate event if the record is not dirty.

The following example demonstrates how to test whether Microsoft Access

needs to run the BeforeUpdate event to determine whether the record is

dirty:

1. Create a new Access Basic module with the following functions and

   Declarations section:

      *********************

      Declarations Section

      *********************

      Option Explicit

      Dim FormToTest As Form

      Dim fNotDirty

      *********************

      Function IsDirty()

      *********************

      Function IsDirty (F As Form)

         ' Store the form to test

         Set FormToTest = F

         ' Set the flag indicating we want to test to see

         ' if the form is dirty or not

         fNotDirty = True

         ' Activate the form so the DoMenuItem will work

         DoCmd SelectObject A_FORM, F.FormName

         ' Save the current record to see if BeforeUpdate event fires

         On Error Resume Next

         DoCmd DoMenuItem A_FORMBAR, A_FILE, A_SAVERECORD

         ' If record is dirty, control goes to TestIsDirty function

         ' Return the flag result; if dirty, TestIsDirty will have

         ' fired and toggled the flag to False and will have

         ' canceled the save record (BeforeUpdate) event.

         IsDirty = Not fNotDirty

         ' Reset the flag

         fNotDirty = False

      End Function

      **********************

      Function TestIsDirty()

      **********************

      Function TestIsDirty ()

         ' If flag is set, we are testing for Edit Mode

         If fNotDirty Then

            ' Indicate we are testing for Edit Mode

            TestIsDirty = True

            ' Toggle the flag to indicate to IsDirty that

            ' the form is, in fact, dirty

            fNotDirty = False

            ' Cancel the BeforeUpdate event

            DoCmd CancelEvent

            ' Control goes back to IsDirty function

        End If

      End Function

2. Open the form you want to test in Design view and examine the form's

   BeforeUpdate property. If the BeforeUpdate property is empty, add the

   following line to the property:

      =TestIsDirty()

   If the BeforeUpdate property has a macro listed, open the macro and add

   the following action as the first action to be executed in the macro or

   the macro group. This action must appear above any other actions in the

   macro or group:

      Condition       Action

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

      TestIsDirty()   StopMacro

   If the BeforeUpdate property has an Access Basic function listed, open

   the function and add the following Access Basic statement as the first

   line in the function. This statement must run before any other statement

   in the function:

      If TestIsDirty() Then Exit Function

3. Call the IsDirty() function to test whether the record is dirty. With

   the form open in Design view, open an Immediate window and type the

   following, where <FormName> is the name of your form:

      ?MsgBox (isdirty(Forms!<FormName>))

   A message box will display either a 1 (the form is dirty) or a 0 (the

   form is not dirty).

How to Use the IsDirty() Function with a Command Button

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

The following example demonstrates how to add a command button to a form

that you can use to determine if the current record is being edited:

1. Open the sample database NWIND.MDB. Open the Categories form in Design

   view, and make the changes listed above to the BeforeUpdate event. In

   step 2, modify the Validate Primary Keys.Categories macro so that the

   first lines of the macro are as follows:

      Macro Name     Condition        Action

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

      Categories

                     TestIsDirty()    StopMacro

2. Create a new Access Basic function called IsCategoriesFormDirty() or a

   new macro called IsCategoriesFormDirty. Note that the function is the

   preferable method, as the macro method requires IsDirty() to run twice.

   To use the function method, create the following Access Basic function:

      Function IsCategoriesFormDirty ()

         If IsDirty(Forms!Categories) Then

            MsgBox "Dirty!"

         Else

            MsgBox "Not Dirty!"

         End If

      End Function

   To use the macro method, create the following macro:

      Condition                      Action    Described Below

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

      IsDirty(Forms!Categories)      MsgBox          1

      Not IsDirty(Forms!Categories)  MsgBox          2

      IsCategoriesFormDirty Macro Actions

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

      1. MsgBox

            Message: Dirty!

      2. MsgBox

            Message: Not Dirty!

3. Create a new button on the Categories form with the following

   properties:

      Caption: Is Dirty?

      OnPush: =IsCategoriesFormDirty()

   NOTE: If you use the macro method, the OnPush property should be set to:

      OnPush: IsCategoriesFormDirty

4. Open the Categories form in Form view.

5. Click the Is Dirty? button. The result will be "Not Dirty!" since the

   record is not being edited.

6. Modify any field in the record, and then click the Is Dirty? button. The

   result will be "Dirty!" since the record is being edited.

7. From the Edit menu, choose Undo Record. Click the Is Dirty? button. The

   result will be "Not Dirty!"

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsProp


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 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 (1.x)

Article ID: Q114504

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes the following two techniques that you can use to

disable the use of the PAGE UP and PAGE DOWN keys in a form:

 - Open the form as a Dialog form using the OpenForm macro action.

   -or-

 - Use the Windows API GetKeyState() function call to trap the PAGE UP

   and PAGE DOWN keys.

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.

CAUTION: Re-creating the examples in this article 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.

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 a new macro in the sample

database NWIND.MDB with the following action:

   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: Using the GetKeyState() API Call to Trap PAGE UP and PAGE DOWN

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

The following sample user-defined function, DisablePGUP_PGDN(),

demonstrates how to use the GetKeyState() Windows API call to detect and

trap the PAGE UP and PAGE DOWN keys. Attach this function to the OnExit

property of all the controls on a form where the PAGE UP and PAGE DOWN keys

should be disabled.

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.

1. Create a new module with the following in the Declarations section:

      Option Explicit

      Global Const VK_PRIOR = &H21  ' PAGE UP

      Global Const VK_NEXT = &H22   ' PAGE DOWN

      Declare Function GetKeyState% Lib "user.exe" (ByVal nKey%)

2. Enter the following function in the module:

      Function DisablePGUP_PGDN()

         If GetKeyState(VK_PRIOR) < 0 Or GetKeyState(VK_NEXT) < 0 Then

            DoCmd CancelEvent

         End If

      End Function

To demonstrate the use of this function, open the Customers form in the

NWIND.MDB database and alter the OnExit property of each control on the

form to:

   =DisablePGUP_PGDN()

REFERENCES

==========

Microsoft Access "Language Reference," versions 1.0 and 1.1, pages 348-349

Additional reference words: 1.00 1.10 pgup pgdn

KBCategory:

KBSubcategory: FmsOthr


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 Disable the Menu Bar When Previewing a Report

Article ID: Q102524

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

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

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

SUMMARY

=======

Although you can display a custom menu bar in a form in Microsoft Access

version 1.x, there is no way to display a custom menu bar when previewing a

report. However, you can completely remove the menu bar when previewing a

report using Microsoft Windows API calls. This article demonstrates a

sample Access Basic function that you can use to remove the menu bar when

previewing a report.

Microsoft Access version 2.0 has built-in functionality to create a custom

menu for a report. For more information about creating custom menus, search

for "custom menus" using the Microsoft Access 2.0 Help menu.

MORE INFORMATION

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

The technique presented in this article removes the menu bar when in

Print Preview. To also remove the toolbar, choose Options from the

View menu and set Show Tool Bar to No.

The Access Basic code below needs to be called for each report every time

you switch to Print Preview. If you display another report after calling

this code, Microsoft Access will re-establish the Print Preview menu.

NOTE: The menu for the report is also re-established if switching from

the report to a form and then back to the report. If the window from

which the report is called is maximized, then the display may become

erratic. Symptoms of an erratic display include duplications of the

Control menu icon and the Min/Max icons before the report appears.

To remove the menu bar that appears when you are printing a report,

use the following steps:

1. Create the new module 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.

   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.

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

   'Declarations section of the module

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

   Option Explicit

   Declare Function FindWindow% Lib "user" (ByVal lpClassName As Any,_

                       ByVal lpCaption As Any)

   Declare Function SetMenu% Lib "User" (ByVal hWnd%, ByVal hMenu%)

   '==================================================================

   'The following function removes the Microsoft Access menu bar by:

   ' - Retrieving the Microsoft Access window handle with FindWindow.

   ' - Removing the Microsoft Access menu bar with SetMenu.

   '==================================================================

   Function RemoveAccessMenu ()

      Dim hWnd%, dummy%

      hWnd% = FindWindow("OMain", 0&)

      dummy% = SetMenu(hWnd%, 0)

   End Function

2. In the report in which you want to disable the menu bar, set the

   OnFormat or OnPrint property of the first section that prints (such

   as the Report Header section) to call the RemoveAccessMenu()

   function:

      OnFormat: =RemoveAccessMenu()

REFERENCES

==========

"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 menubar security

KBCategory:

KBSubcategory: RptOthr


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 Display Yes/No Choices in a Combo Box or List Box

Article ID: Q109381

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to use a list box or a combo box to display Yes

and No, True and False, or On and Off selections for a field with a Yes/No

data type.

MORE INFORMATION

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

When you use a Yes/No data type, one of three formats may be applied:

Yes/No, True/False, or On/Off. However, list boxes and combo boxes do not

display these formats. Instead, the actual value of the Yes/No field will

be displayed. The actual value of a Yes/No field is either -1 or 0, no

matter which format is applied.

In order to display values with one of the formats listed above in a list

box or a combo box, the following properties must be set for the list box

or the combo box:

   Object: combo box

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

   RowSourceType: Value List

   RowSource: -1;Yes;0;No

   ColumnCount: 2

   ColumnWidths: 0 in; 1 in

   BoundColumn: 1

   List Rows: 2

   Object: list box

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

   RowSourceType: Value List

   RowSource: -1;Yes;0;No

   ColumnCount: 2

   ColumnWidths: 0 in; 1 in

   BoundColumn: 1

The above properties will cause a list box or a combo box to display values

with a Yes/No format. To use one of the other formats (True/False or

On/Off) replace the words "Yes" and "No" in the properties listed above.

REFERENCES

==========

For more information on the use of formatted values in a list box or a

combo box, query on the following words here in the Microsoft Knowledge

Base:

   format and combo and list and box and columns

Microsoft Access "User's Guide," version 1.1, pages 239-242

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsCmbo


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 Execute Macro Actions Using DDE

Article ID: Q99407

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

The information in this article applies to:

 - Microsoft Access version 1.1

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

SUMMARY

=======

Microsoft Access supports the execution of certain macro actions over a

dynamic data exchange (DDE) channel.

MORE INFORMATION

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

The only macro actions that you can execute over a DDE channel to

Microsoft Access are those supported by the DoCmd() function in Access

Basic. For this reason, the following macro actions cannot be executed:

   AddMenu

   MsgBox

   RunApp

   RunCode

   SendKeys

   SetValue

   StopAllMacros

   StopMacro

The syntax for macro actions executed through DDE is the same as the

syntax for macro actions called by the DoCmd() function, that is:

   MacroActionName Argument1,Argument2,...,ArgumentN

You cannot use the predefined constants that are available inside Access

Basic, such as A_NORMAL, as arguments when you are executing macro

actions with DDE. Instead, you must use the actual values of the

constants. The values of the constants can be determined using the

following procedure:

1. Open a macro in Design view.

2. Select the macro action you want to use from the list of macro

   actions in the Action column.

3. In the Action Arguments section, locate the argument for which you

   need to supply a value.

4. In the list box associated with that argument, locate the option

   that you want to use.

5. Count down the list, starting at zero (0), until you reach that

   option.

The number you count to to reach the option is the number you need to

supply as the argument when you execute the macro over a DDE channel.

The following example creates a macro in Microsoft Excel that

demonstrates how to execute macro actions in Microsoft Access using DDE:

NOTE: This macro will not work in Microsoft Access version 1.0.

1. Open Microsoft Access.(This macro only works if Microsoft Access is

   already running.)

2. Open a new macro sheet in Microsoft Excel. Enter the following

   macro:

      Cell    Command

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

      A1     MacroActionDDE

      A2

      A3    chan=INITIATE("MSACCESS","SYSTEM")

      A4    =APP.ACTIVATE("Microsoft Access",FALSE)

      A5    =EXECUTE(chan,"[opendatabase nwind.mdb]")

      A6    =EXECUTE(chan,"[beep]")

      A7    =EXECUTE(chan,"[openform categories,,,,,2]")

      A8    =EXECUTE(chan,"[beep]")

      A9    =EXECUTE(chan,"[openform categories]")

      A10   =EXECUTE(chan,"[close]")

      A11   =EXECUTE(chan,"[closedatabase]")

      A12   =TERMINATE(chan)

      A13   =APP.ACTIVATE(,FALSE)

      A14   =RETURN()

3. Size your Microsoft Access and Microsoft Excel windows so that you

   can see both applications at the same time.

4. To run the macro, select cell A3, choose Run from the Macro menu,

   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. (Pseudo actions

are actions that are only valid over the DDE channel.)

The commands in cells A6 and A8 execute the Microsoft Access macro action

Beep.

The command in cell A7 executes the Microsoft Access macro action

OpenForm to open the Categories form in a minimized state.

The command in cell A9 executes the Microsoft Access macro action

OpenForm to open the Categories form in a normal state.

The command in cell A10 closes the currently active object in Microsoft

Access.

The command in cell A11 closes the currently opened database file using

the CloseDatabase pseudo action.

The commands in cells A12 through A14 terminate the DDE channel, activate

the Microsoft Excel application, and end the macro.

REFERENCES

==========

For more information on sending macro actions to Microsoft Access, query

on the following words here in the Microsoft Knowledge Base:

   access and dde and server and macro

Microsoft Access "Language Reference," version 1.0, pages 149-150

Additional reference words: 1.10

KBCategory:

KBSubcategory: IntpDde


INF: How to Export the Results of a Query

Article ID: Q103130

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

Microsoft Access does not provide a direct way to export the results

of a query directly to a file using the Export command from the File

menu. After the user selects Export from the File menu and selects an

output format, the Select Microsoft Access Object dialog is

presented which lists only tables, not queries, from the current

database.

MORE INFORMATION

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

The following information discusses two ways to export the results of

a query to a file.

1. Method 1: Uses the Transfer macro actions (TransferText,

   TransferDatabase, TransferSpreadsheet) to export query results

   directly to a file.

2. Method 2: Uses a Make Table query to save the results to a new

   table. Once this table exists, it can be exported by choosing Export

   from the File menu.

Method 1: Transfer Macro Action

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

The three Transfer macro actions: TransferText, TransferSpreadsheet,

and TransferDatabase were designed to help automate the process of

exporting (and importing) data from the file menu. These commands can

also be used to facilitate exporting data from a query directly to a

file.

The following examples use the Employee Sales for 1991 query included

with the sample database NWIND.MDB supplied with Microsoft Access.

Example A

---------

To export a query to a comma delimited text file using TransferText:

1. Open NWIND.MDB.

2. Choose the Macro button, then the New button, from the Database

   window. This will present you with a new macro grid containing

   Action and Comments columns.

3. In the Action column choose TransferText.

4. Below the macro grid you will see the arguments that need to be

   filled in for the TransferText action. Fill them in with the

   following settings:

    Action: TransferText

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

       Transfer Type: Export Delimited

       Specification Name: <leave empty>

       Table Name: Employee Sales for 1991

       File Name: C:\EMPSALES.TXT

       Has Field Names: Yes

   NOTE: You can specify the name of a query in the Table Name

   argument.

5. Choose Save from the File menu, type a unique macro name, and press

   ENTER.

6. Choose Run from the Macro menu to execute the macro. Microsoft

   Access will run the query and save the results to the specified

   destination file name (EMPSALES.TXT).

Example B

---------

To export a query as a DBase IV file using TransferDatabase:

1. Follow steps 1-3 for TransferText, but choose TransferDatabase as

   the macro action.

2. Fill in the macro arguments with the following settings:

   Action: TransferDatabase

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

      Transfer Type: Export

      Database Type: dBASE IV

      Database Name: c:\

      Object Type: Query

      Source: Employee Sales for 1991

      Destination: EMPSALES

      Structure Only: No

3. Follow steps 5-6 for TransferText.

Example C

---------

To export a query as an Excel spreadsheet using TransferSpreadsheet:

1. Follow steps 1-3 for TransferText, but choose TransferSpreadsheet

   as the macro action.

2. Fill in the macro arguments with the following settings:

   Action: TransferSpreadSheet

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

      Transfer Type: Export

      Database Type: Microsoft Excel

      Table Name: Employee Sales for 1991

      File Name: c:\empsales.xls

      Has Field Names: No

      Range: <leave empty>

   NOTE: You can specify the name of a query in the Table Name

   argument.

3. Follow steps 5-6 for TransferText.

Method 2: Make Table Query

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

Use a Make Table query to export the query results to a table. Once

the data is in a new table, the Export command from the File menu can

be used to export the data to a file.

The disadvantage of this approach is that a new table increases the

size of your database. After you export the data, the table is no

longer needed. If you delete the table, Microsoft Access will not

reclaim the once occupied space until you compact the database file.

The following examples use the "Employee Sales for 1991" query

included with the sample database NWIND.MDB.

1. Open NWIND.MDB.

2. Choose the Query button in the Database window, select Employee

   Sales for 1991, and choose the Design button.

3. Choose Make Table from the Query menu.

4. In the Table Name box, type a unique table name where the data will

   be exported to. Choose OK.

5. Choose Run from the Query menu. The query stores the results in the

   new table.

   You may want to save this query and give it a new name via the Save

   As command on the File menu if you need to export the results

   regularly.

6. Use the Export command from the File menu to export the new table's

   contents to a file.

REFERENCES

==========

For more information on compacting a database see the "Microsoft

Access User's Guide," version 1.0, Chapter 25, "Administering a

Database System," pages 627 - 628

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IntpOthr


INF: How to Fill a Combo Box with Table Names (1.x)

Article ID: Q109327

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to create a combo box that will list the names

of the tables in your Microsoft Access version 1.x database.

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 create a combo box that lists the

names of tables in your database:

1. Add the following to the Declarations section of the Introduction to

   Programming module in the sample database NWIND.MDB:

      Option Explicit

2. Enter the following sample 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 TableList (Fld As Control, Id, Row, Col, Code)

      Static TbLst_Array(100), No_Entries

      Dim MyDB As Database

      Dim cnt As Integer

      Dim Returnval

      Dim SnapOfTables As Snapshot

      Returnval = Null

      Set MyDB = CurrentDB()

      Set SnapOfTables = MyDB.ListTables()

      Select Case code

         Case 0

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

         '  CASE 0:  Initializes the function. Lets the function know

         '  how many elements will be in the list box. It also

         '  initializes the array that holds the elements.

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

            SnapOfTables.MoveFirst

            No_Entries = 0

            TbLst_Array(No_Entries) = Null

            Do Until SnapOfTables.EOF

               If SnapOfTables.tabletype = db_table And_

               SnapOfTables.attributes = 0 Then

                  TbLst_Array(No_Entries) = SnapOfTables.Name

                  No_Entries = No_Entries + 1

               End If

               SnapOfTables.MoveNext

            Loop

            Returnval = No_Entries

         Case 1

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

         ' Open. Provides a unique id number for the function. Most

         ' cases just use the following code in this case.

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

            Returnval = Timer

         Case 2

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

         ' (Reserved for future use.) This case should be omitted.

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

         Case 3

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

         ' Number of Rows. Lets the function know how many rows are

         ' going to be in the list (can be zero). Use -1 if number is

         ' unknown.

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

            Returnval = No_Entries

         Case 4

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

         ' Number of Columns. (CANNOT BE ZERO) Should match the value

         ' in the property sheet.

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

            Returnval = -1

         Case 5

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

         ' Column width. Width in twips of column specified by the col

         ' argument. Use -1 to use default widths.

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

            Returnval = -1

         Case 6

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

         ' List Entry. Gives element to be displayed in the row and

         ' column specified by the row and col arguments.

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

            Returnval = TbLst_Array(row)

         Case 7

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

         ' Format String. Format string to be used to format the list

         ' element displayed in the row and column specified by the

         ' row and col arguments. Use NULL to use the default format.

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

         Case 8

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

         '(Reserved for Future Use.) This case should be omitted.

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

         Case 9

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

         ' End. This is the last call to function. Always

         ' include this case. This is a good place for any

         ' cleanup code.

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

            For No_Entries = 0 To cnt

               TbLst_Array(cnt) = ""

            Next

      End Select

      TableList = Returnval

   End Function

3. Save the module.

4. Create a new, unbound form.

5. Place a combo box with the following properties on the form:

      Form: Form1

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

      Combo Box:

         ControlName: Tablelist

         RowSourceType: TableList

         ColumnCount:    1

         BoundColumn:    1

6. View the form in Form view. Click the combo box.

The combo box will be filled with the names of the tables in the NWIND

database.

REFERENCES

==========

Microsoft Access "User's Guide," Chapter 9, "Designing Forms"

Microsoft Access "Introduction to Programming," pages 82-85

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsCmbo


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 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

Article ID: Q105660

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article demonstrates how to use a single bound control for both data

entry and for finding records 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, the record

containing that value will be displayed. If the value does not exist, 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 "Introduction to Programming" 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 FindBeforeUpdate ()

         Dim DS As Dynaset, C As Control

         Set C = Screen.ActiveControl

         Set DS = Screen.ActiveForm.Dynaset

         On Error Resume Next

         ' Try to find a record with a matching entry in

         ' the form's dynaset as a numeric field

         DS.FindFirst "[" & C.ControlName & "]=" & C

         ' If it was not a numeric field (error 3070) then

         ' try finding the record as a text field

         If Err = 3070 Then

            Err = 0

            DS.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 Error(Err), 48

           DoCmd CancelEvent

           Exit Function

         End If

         ' If we found a record, save the bookmark of the found record

         If DS.NoMatch Then

              Found = Null

         Else

              Found = DS.Bookmark

         End If

         ' If we found the record...

         ' .. Cancel the BeforeUpdate

         ' .. Undo changes made to the current record

         ' .. 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 FindOnExit ()

         ' If we found the record, cancel the OnExit event to

         ' keep us in the control and go find the record

         If Not IsNull(Found) And Found <> "" Then

            DoCmd CancelEvent

            ' Synchronize form record with found record

            Screen.ActiveForm.Bookmark = Found

            Found = Null

         End If

      End Function

2. Open the Categories form in Design view. Change the following

   properties for the Category ID field:

      BeforeUpdate: =FindBeforeUpdate()

      OnExit: =FindOnExit()

3. Switch to Form view. The first category that appears is the Beverages

   category. Type "COND" (without the quotation marks) in the Category ID

   field and press TAB or ENTER. Microsoft Access will automatically find

   and present the Condiments category record.

4. Type "NEW" (without the quotation marks) in the Category ID field and

   then press TAB or ENTER. Since this key value does not exist, no record

   is presented and you can continue to enter data for the new record.

How the Sample Functions Work

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

The FindBeforeUpdate() 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 FindOnExit()

function.

Before the FindRecord action can be run, the BeforeUpdate event must be

canceled, and a SendKeys action must send two ESC keys to undo changes to

the current record.

Next, a SendKeys action sends a TAB key to exit the field. This event

triggers the FindOnExit() 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 1.0, pages 547-548

Microsoft Access "User's Guide," version 1.1, pages 551-552

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlDe


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 Attached Table's Database Name

Article ID: Q109725

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to use the FindFirst method on a dynaset of

the MSysObjects table to find the path and filename of the database that

contains an attached table.

Notes

-----

 - The technique described below relies on the use of system tables

   stored with your database. These tables are undocumented and are

   subject to change in future versions of Microsoft Access.

 - 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

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

The following example demonstrates how to use the FindFirst method to

find the path and filename of the database that contains an attached

table:

1. Create a new database.

2. From the File menu, choose Attach Table.

3. Select Microsoft Access in the Data Source box and then choose OK.

4. Select the sample database NWIND.MDB in the File Name box and then

   choose OK.

5. Select Categories in the Tables In NWIND.MDB box and then choose

   Attach. Choose OK, and then choose Close.

6. Create a new module with the following sample code:

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

      ' MODULE DECLARATIONS

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

      Option Explicit

      Function AttachedDBName (TableName As String)

         Dim DB As Database

         Dim DS As Dynaset

         Set DB = CurrentDB()

         Set DS = DB.CreateDynaset("MSysObjects")

         DS.FindFirst "[name] = '" & TableName & "'"

         If Not DS.NoMatch Then

            AttachedDBName = DS![database]

         Else

            AttachedDBName = ""

         End If

      End Function

7. To run the function, type the following in the module's Immediate

   window and press ENTER:

   ? AttachedDBName("Categories")

The function returns the path and filename of the database that contains

the attached table.

REFERENCES

==========

Microsoft Access "User's Guide," versions 1.0 and 1.1, Chapter 4,

"Importing, Exporting, and Attaching," pages 60-72

Additional reference words: 1.00 1.10 table name

KBCategory:

KBSubcategory: PgmObj


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 Find Which Groups a User Belongs To

Article ID: Q106297

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Microsoft Access has no built-in mechanism for finding which groups a user

belongs to. This article demonstrates a sample Access Basic function that

you can use to check if a user is a member of a specific group.

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.

MORE INFORMATION

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

You can use the following sample function to check if a user belongs to a

specific group:

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

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

   'Function: ug_Group()

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

   Function ug_Group (UserName As String, CheckGroup As Variant)

      Dim MyDB As Database, MyQueryDef As QueryDef, MySnap As Snapshot

      'Trap Error

       On Error GoTo ug_Group_Err

      'Verify CheckGroup is String or Null

       If VarType(CheckGroup) <> 1 And VarType(CheckGroup) <> 8 Then

         ug_Group = Null

         Exit Function

       End If

       Set MyDB = OpenDatabase("SYSTEM.MDA")

       Set MyQueryDef = MyDB.OpenQueryDef("MSysUserMemberships")

       MyQueryDef![UserName] = UserName

       Set MySnap = MyQueryDef.CreateSnapshot()

       'Check if CheckGroup = Null or String

       If IsNull(CheckGroup) Then

           If MySnap.BOF Then

               ug_Group = 0

           Else

               MySnap.MoveLast

               ug_Group = MySnap.RecordCount

           End If

       Else

             MySnap.FindFirst "[Name]='" & CheckGroup & "'"

             ug_Group = IIf(MySnap.NoMatch, False, True)

       End If

       MySnap.Close

       MyQueryDef.Close

       MyDB.Close

       Exit Function

   ug_Group_Err:

       ug_Group = "Error: " & Error

       Exit Function

   End Function

You can use the function ug_Group() to check if a user belongs to a

specific group, or to determine the total number of groups to which the

user belongs. You can specify any user in the SYSTEM.MDA file, or you can

dynamically determine the current user of the application.

The ug_Group() function uses the following arguments:

   Argument     Description

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

   UserName     String expression of the user to be

                checked. Use the User() function to pass the

                current user.

   CheckGroup   Variant expression of the group to check

                if UserName is a member. A group name

                is passed as a String expression.

                Optionally, this value can be passed as null.

If the argument CheckGroup is a String, the function will return true (-1)

if the UserName is a member of CheckGroup, or will return false if the

UserName is not a member of CheckGroup.

If the argument CheckGroup is null, the function will return the number of

groups of which UserName is a member. If the UserName has not been defined

as a user in the SYSTEM.MDA file, the value 0 will be returned. Since all

users are members of the group Users, the function will return the value 1

if UserName is not a member of any other groups. The function will return a

value greater than 1 if UserName is a member of other groups. The value

returned will equal the total number of groups of which UserName is a

member.

If the argument CheckGroup is not a String or null, the function will

return null.

If an error occurs within the function, a description of the error will be

returned.

For example, assume the following users and groups have been created:

   Users: Donald, Jeanie, and Chelsea

   Groups: People and Pets

   Donald is a member of the groups People and Users.

   Jeanie is a member of the groups People and Users.

   Chelsea is a member of the groups People, Pets, Users, and Admins.

Also assume that Chelsea is currently logged into Microsoft Access.

Type the following examples in an Immediate window and note the results.

Remember that -1 equals true and 0 equals false:

   Example:    ? ug_Group( User(), "Admins" )

   Response:   -1

   Meaning:    Chelsea is a member of Admins.

   Example:    ? ug_Group( "Donald", "Pets" )

   Response:   0

   Meaning:    Donald is not a member of Pets.

   Example:    ? ug_Group( "Jeanie", NULL)

   Response:   2

   Meaning:    Jeanie is a member of two groups.

REFERENCES

==========

Microsoft Access "User's Guide," Chapter 25

Microsoft Access "Language Reference," page 489

Additional reference words: 1.00 1.10 ADK

KBCategory:

KBSubcategory: ScrtOthr


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 Cascading Delete

Article ID: Q88635

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The referential integrity capabilities in Microsoft Access versions 1.0

and 1.1 do not extend to performing cascading deletes. A cascading delete

removes all the records of a child table when the corresponding record in

the master table is deleted. This article describes a sample macro you

can use to perform a cascading delete when you delete a record from a

master table.

MORE INFORMATION

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

As an example of a cascading delete, suppose you are viewing the

Categories table in the sample database NWIND.MDB and you decide to

delete the BEVR Category ID. The Products table is related to the

Categories table with referential integrity enabled, and contains many

child records with the BEVR value. Therefore, Microsoft Access prevents

you from deleting the record in the Categories table until you delete all

the child BEVR records in the Products table. With the ability to perform

a cascading delete, all of the Products table's BEVR records would be

deleted automatically and then the BEVR Category ID would be deleted from

the Categories table.

The following example demonstrates how to set up a macro that will

perform cascading deletes:

WARNING: Following these steps will permanently remove records from the

sample database NWIND.MDB. It is a good idea to make a backup copy of

the NWIND database before following these steps, and then restore the

database when you are done following these steps.

1. Open the sample database NWIND.MDB.

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

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

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

   this macro.

     Condition                                            Action

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

     MsgBox("Delete record & all child records?",33)<>1   CancelEvent

     ...                                                  StopMacro

                                                          SetWarnings

                                                          SendKeys

                                                          RunSQL

     SetWarnings Action

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

     Warnings On: No

     SendKeys Action

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

     Keystrokes: {enter}

     RunSQL Action

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

     SQL Statement: DELETE * FROM [Products] WHERE [Category ID] = _

                    Forms!Categories![Category ID];

   Note the semicolon (;) at the end of the SQL statement; it is

   required.

3. Open the Categories form in Design view.

4. Set the form's OnDelete property to the Cascade macro.

5. View the form in Form view.

When you delete a Category ID in the Categories form, all the associated

records in the Products table will be deleted. To delete a record in the

Categories form, choose the Select command from the Edit menu, and then

choose Delete from the Edit menu.

NOTE: Make sure that the subform RecordsLocks property is not set to

All Records.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: QryMktbl


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 a List of Object Names in Microsoft Access

Article ID: Q101674

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There is no built-in mechanism in Microsoft Access version 1.x for

enumerating a list of form, report, macro, or module names. This article

demonstrates an Access Basic function, GetObjectNames(), that you can use

to list the names of these objects as well as table and query names.

NOTE: The technique described below relies on the use of system

tables stored with your database. These tables are undocumented and

are subject to change in future versions of Microsoft Access.

MORE INFORMATION

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

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

creating Microsoft Access applications with the programming tools

provided with Microsoft Access.

First, create a new module with the code listed 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.

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

' MODULE DECLARATIONS

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

Option Explicit

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

' FUNCTION: GetObjectNames

'

' PURPOSE:

'    Fills the string array passed as an argument with a list of names

'    of objects of type ObjectType in the currently opened user

'    database.

'

' ARGUMENTS:

'    ObjectType - A string representing the object whose names are to

'                 be retrieved. ObjectType can be one of the

'                 following:

'

'                 Tables, Queries, Forms, Reports, Macros, Modules

'

'    Names      - A single dimensional array of type string

'

' RETURN:

'    The number of names stored in the Names array. The names

'    are stored beginning from 0 to GetObjectNames - 1.

'

' NOTES:

'    This function utilizes information stored in the MySysObject table

'    of the currently opened user database. The system tables are

'    undocumented and are subject to change in future versions of

'    Access.

'

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

Function GetObjectNames (ByVal ObjectType, Names() As String)

   Dim db As Database

   Dim ss As Snapshot

   Dim Count

   Dim SQL

   Dim Msg As String

    SQL = "Select Name,Type from MSysObjects Where Type="

   Select Case ObjectType

      Case "Tables"

         SQL = SQL & "1 And Left(Name,1)<>'~' And Left(Name,4) <> _

                  ""MSys"" Order By Name;"

      Case "Queries"

         SQL = SQL & "5 And Left(Name,1)<>'~' And Mid(Name, _

                  Len(Name) - 3) <> ""0000"" Order By Name;"

      Case "Forms"

         SQL = SQL & "-32768 And Left(Name,1)<>'~' Order By Name;"

      Case "Reports"

         SQL = SQL & "-32764 And Left(Name,1)<>'~' Order By Name;"

      Case "Macros"

         SQL = SQL & "-32766 And Left(Name,1)<>'~' Order By Name;"

      Case "Modules"

         SQL = SQL & "-32761 And Left(Name,1)<>'~' Order By Name;"

      Case Else

         Msg = "Object Name """ & ObjectType & """ is an invalid"

         Msg = Msg & " argument to Function GetObjectNames!"

         MsgBox Msg, 16, "GetObjectNames"

         Exit Function

   End Select

   Set db = CurrentDB()

   Set ss = db.CreateSnapshot(SQL)

   ss.MoveLast

   If ss.RecordCount > 0 Then

      ReDim Names(0 To ss.RecordCount - 1)

   Else

      GetObjectNames = 0

      Exit Function

   End If

   ss.MoveFirst

   Count = 0

   Do While Not ss.EOF

      Names(Count) = ss![name]

      Count = Count + 1

      ss.MoveNext

   Loop

   GetObjectNames = ss.RecordCount

End Function

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

' FUNCTION: TestGetObjectNames

'

' PURPOSE: Used to demonstrate and test the GetObjectNames function

'

' ARGUMENTS:

'    ObjectType - A string representing the object whose names are to

'                 be retrieved. ObjectType can be one of the following:

'

'                 Tables, Queries, Forms, Reports, Macros, Modules

'

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

Function TestGetObjectNames (ObjectType)

   Dim Count, i

   ReDim Names(0) As String

   Count = GetObjectNames(ObjectType, Names())

   Debug.Print "Count: " & Count

   For i = 0 To Count - 1

      Debug.Print Names(i)

   Next i

End Function

How to Use the GetObjectNames() Function

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

The function TestGetObjectNames(), above, demonstrates how to use

the GetObjectNames() function.

1. With the module open in Design view, choose Immediate Window from

   the View menu.

2. Type the following and press ENTER:

      ? TestGetObjectNames("Forms")

Result: A list of forms in the currently-open database will print in

the Immediate window.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.1, Chapter 8,

"Manipulating Data," pages 124-127

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmOthr


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 SQL Pass-Through Functionality Using Q+E

Article ID: Q90102

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Microsoft Access does not directly support the use of pass-through SQL

(the ability to pass SQL commands directly to a server). However, you can

use Access Basic to perform dynamic data exchange (DDE) with the Q+E

application, which does support pass-through SQL. Using this method, you

can pass SQL commands to run stored procedures and other SQL commands.

MORE INFORMATION

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

To use Q+E's pass-through SQL capabilities in Microsoft Access, create

the following function 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.

   Function SQLPassThru (SQLCommandText, SQLDatabaseText)

      On Error Resume Next

      Err = 0

      chan = DDEInitiate("QE", "System")

      If Err Then

         Err = 0

         Result = Shell("QE", 2)

         If Err Then

             MsgBox "ERROR: Unable to start Q+E. Q+E must be in your _

                PATH statement", 16, "SQL PassThru"

             Exit Function

         End If

         chan = DDEInitiate("QE", "System")

      End If

      DDEExecute chan, "[LOGON(SQLServer)]"

      DDEExecute chan, "[OPEN('USE " & SQLDatabaseText & "; " & _

         SQLCommandText & "','SQLSERVER')]"

      DDEExecute chan, "[EXIT()]"

      DDETerminate chan

   End Function

The SQLPassThru() function initiates a DDE channel with Q+E. If Q+E is

not available, the function attempts to start Q+E. If Q+E cannot be

started, the function displays an error message and ends. If Q+E can be

started, a DDE channel is initiated. The SQLPassThru() function then

directs Q+E to display its Logon dialog box so you can log on to SQL

Server. The SQL USE command is used to ensure that SQLPassThru() is in

the database you specify, and SQLPassThru() runs the SQL command. After

the command is run, SQLPassThru() exits the Q+E application and

terminates the DDE channel that the function established.

The following demonstrates a sample call to the SQLPassThru() function:

   =SQLPassThru("sp_addlogin Ted, ted","master")

In the above example, the SQLPassThru() function will start Q+E and

initiate a DDE channel, if possible. You will then be prompted to log on

to a SQL Server. After you log on, the function will use the master

database on the SQL Server and run the stored procedure sp_addlogin,

which will add a login for a user named Ted with a password of ted. After

the command runs the function will exit the Q+E application and terminate

the DDE channel.

NOTE: You must include quotation marks around both of the parameters to

ensure that they are used properly. You may also have to include

additional quotation marks in the SQL command you are sending to the

SQL Server to ensure that the command is being processed correctly.

For examples of the types of adjustments that you may need to make to

the SQL command string, see the "Q+E for Microsoft Excel User's Guide"

or the application note "A Practical Guide to Using Q+E," which can

be obtained by calling Microsoft Product Support at (206) 454-2030.

You can modify this function in many different ways, including:

 - To accept additional parameters and have additional corresponding

   DDEExecute commands, thereby allowing the execution of multiple SQL

   commands with one function call

 - To use as a subprocedure in which you can hard-code the parameters for

   the command and SQL database in the Access Basic code

 - To retrieve information from the SQL server, or send information to

   the SQL server using the DDERequest and DDEPoke commands

 - To use in conjunction with a form to allow on-line SQL command

   execution

 - To break into multiple functions with different capabilities, such as

   one function to initiate the channel, another function to execute

   the commands, and another function to terminate the channel

 - To access database types that Microsoft Access does not support but

   that Q+E does

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 115-126

Microsoft Access "Introduction to Programming," version 1.0, Chapter 2,

pages 1-8

Microsoft Excel "Q+E for Microsoft Excel User's Guide," version 4.0,

pages 101-102

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IntpDde


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 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 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 Implement a Timer

Article ID: Q95924

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There is no timer control built into Microsoft Access version 1.x. To

implement a timer, you must create an Access Basic module that creates a

timing sequence in your application.

MORE INFORMATION

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

To create a timer within your Microsoft Access application, you must

call two functions. One function starts the sequence, and another

function sets a global variable that tells the first function to stop

performing the timing iteration.

This article assumes 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 the first function, called StartTimer(), you execute an endless

loop that performs the timing update and the DoEvents() function. The

DoEvents() function instructs the Access Basic function to release the

computer's CPU to other tasks, such as your form, other applications

within Microsoft Windows, and most importantly the StopTimer()

function. The StopTimer() function sets the global variable that the

StartTimer() function checks to determine when to stop looping.

To create an example, follow the instructions below. Once these are

done, open the form in Browse mode and press the Start Timer button.

You should see the timing being performed by the updating in the text

box. At any point you can stop the timing sequence by pressing the

Stop Timer button.

1. Create the following controls on a form and set the appropriate

   properties:

      Form: Form1

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

      Control: Text Box

         ControlName: Field0

      Control: Command Button

         Caption: Start Timer

         OnPush: =StartTimer()

      Control: Command Button

         Caption: Stop Timer

         OnPush: =StopTimer()

2. Create a new module and add the following code:

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

      'GLOBAL DECLARATIONS SECTION

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

      Option Explicit

      Dim StopTheTimer     'if set to TRUE, then exit StartTimer()

      Const INTERVAL = 1   'determine how often in seconds to update

                           'the screen

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

      'This function will start the timer, update

      'the display with the correct time unit,

      'and look to see if the StopTheTimer is

      'set to TRUE so as to determine when to

      'stop the process.

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

      Function StartTimer ()

         Static InHere  'stop re-entrant code

         Dim iLast, iNow, x%

         'this stops the user from pressing the command button

         'and re-entering this code again if it is already

         'running.

         If InHere = True Then Exit Function

         iLast = Timer

         Do

            'StopTheTimer is set in StopTimer()

            If StopTheTimer = True Then

               StopTheTimer = False

               Exit Function

            End If

            iNow = Timer

            'need to update display only if the interval

            'has been exceeded.

            If (iNow - iLast) > INTERVAL Then

               Forms!Form1!Field0 = iNow

               iLast = iNow

            End If

            'release the CPU to other tasks, namely enable

            'the user to enter the StopTimer() function.

            x% = DoEvents()

         Loop

      End Function

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

      'This function will set the flag to let StartTimer()

      'stop execution.

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

      Function StopTimer ()

         StopTheTimer = True

      End Function

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmOthr


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 List the Related Tables in a Database in Version 1.x

Article ID: Q88653

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

The information in this article applies to:

- Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Although you can create relationships among tables in your database, there

is no inherent command to list these relationships. Sometimes this

information can be of use, particularly when trying to find the source

table of a referential integrity violation or other such example.

This article discusses how you can use a series of queries to display

a list of tables that are related in a database.

MORE INFORMATION

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

Information on the relationships among the tables in a database can

sometimes be very helpful, particularly when trying to find the source

table of a referential integrity violation or other such example. This

information is also good for documenting your database.

Although you can create relationships among tables in your database, there

is no inherent command that will gather this information and present it in

a meaningful way. All of this information can be made available by

gathering and relating information from the system tables MSysObjects,

MSysColumns, and MSysIndexes. This article discusses how you can create a

query containing two columns. The first column, called "Primary.Name," will

contain a table name. The second column, called "Foreign.Name," will

represent the table that the Primary.Name table is related to.

Because the information will be coming from the system tables

mentioned above, you must make sure you have access rights to these

tables. MSysObjects has these rights by default, so the instructions

below indicate how you can give yourself access rights to MSysIndexes

and MSysColumns.

1. In the Database Window menu, select the View menu, then choose

   Options.

2. Change the Show System Objects setting to Yes, then choose OK.

3. From the Database Window menu, choose the Permissions command from

   the Security menu.

4. In the following dialog box, choose Table for the Object Type

   prompt, then choose MSysIndexes for the Object Name prompt.

5. In the Permissions box at the bottom of the dialog, select the

   Full Permissions box.

6. Click Assign and then choose the Close button. Repeat steps 4 and

   5 for MSysColumns.

7. From the View menu at the top of the screen, choose Options.

8. Change Show System Objects to No, then choose the OK button.

At this point, you can begin building the queries that will retrieve

the relationship information. To do this, follow the instructions

below:

 1. In the database window, choose the Query button, then choose New.

    A query design screen appears, along with a dialog asking for a

    Table/Query to add to the query. Choose Close so that the query

    design grid is blank.

 2. From the View menu, choose SQL.

 3. Delete any contents that appear in the SQL dialog box.

 4. Enter the following into the SQL window:

       SELECT DISTINCTROW

          MSysObjects.Name, MSysObjects.Id

       FROM MSysObjects

       WHERE ((MSysObjects.Type=1)

       AND (MSysObjects.Flags Is Null Or MSysObjects.Flags<>2))

       ORDER BY MSysObjects.Name;

 5. Choose the OK button. Close and save the query as "psi User

    Tables."

 6. Repeat steps 1 through 4, substituting the SQL statement in step 4

    with the following SQL statement:

       SELECT DISTINCTROW [Tables].Name AS Table,

          MSysColumns.Name AS Field,

          [Tables].Id AS [Primary Id]

       FROM [psi User Tables] AS Tables, MSysColumns, Tables

       INNER JOIN MSysColumns ON [Tables].Id = MSysColumns.ObjectId

       ORDER BY [Tables].Name, MSysColumns.PresentationOrder;

 7. Choose the OK button, then close and save the query as "psi User

    Tables Field List."

 8. Repeat steps 1 through 4, substituting the SQL statement in step 4

    with the following SQL statement:

       SELECT DISTINCTROW Primary.Name, Foreign.Name

       FROM [psi User Tables] AS Primary, MSysIndexes, [psi User Tables]

          AS Foreign, MSysIndexes AS LKeyName, LKeyName

       INNER JOIN MSysIndexes ON LKeyName.Idxid = MSysIndexes.Idxid,

          LKeyName

       INNER JOIN MSysIndexes ON LKeyName.ObjectId = MSysIndexes.ObjectId,

          Primary

       INNER JOIN MSysIndexes ON Primary.Id = MSysIndexes.ObjectId,

          Foreign INNER JOIN MSysIndexes ON Foreign.Id =

          MSysIndexes.ObjectIdReference

       WHERE ((MSysIndexes.ObjectIdReference<>0)

          AND (MSysIndexes.Operation=2)

          AND (LKeyName.Operation=0))

       ORDER BY Primary.Name, Foreign.Name;

 9. Choose the OK button. Close and save the query as "psi

    Relationships."

10. To view the Relationships table, highlight the query called "psi

    Relationships" in the database window and choose the Open button.

With this query, you can create reports or use the query in any other

way that you would normally use an Access query to make use of the

information.

Another way to display database information is to use the Database Analyzer

tool. For more inforation on this tool, see the PSSKB.TXT file, question

23, or choose the Microsoft Access Q&A icon in the Microsoft Access group

in Program Manager.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RltOthr


INF: How to List Users in a Given Group

Article ID: Q109740

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes a sample Access Basic function to list

users belonging to a given group in your Microsoft Access system.

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.

MORE INFORMATION

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

The following example demonstrates how to create and use the sample

function Which_Users() to list the users in a group:

1. Create a new module. Add 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 GetPrivateProfileString% Lib "Kernel"_

         (ByVal lpApplicationName$, ByVal lpKeyName$, ByVal lpDefault$,_

         ByVal lpReturnedString$, ByVal nSize%, ByVal lpFileName$)

2. Add the following function:

   Function Which_Users ()

      Dim SqlStr$, GroupName$, Message$, SysDB$

      Dim lpReturnedString$, nSize%, GetInfo%

      Dim MyDB As Database, MyDyna As Dynaset

      Dim MySnap As Snapshot

      On Error GoTo Empty

      GroupName$ = InputBox("Please Enter a Group Name", "Group")

      If GroupName$ = "" Then

         MsgBox "You Must Enter a Name", 16, "Error"

         Exit Function

      End If

      lpReturnedString$ = Space$(255)

      nSize% = Len(lpReturnedString$)

      GetInfo% = GetPrivateProfileString("Options", "SystemDB", "", _

         lpReturnedString$, nSize%, "MSACCESS.INI")

      SysDB$ = lpReturnedString$

      Message$ = UCase(GroupName$) & " Has the Following Members:" &_

         Chr(13) & Chr(10)

      Set MyDB = OpenDatabase(SysDB$)

      Set MySnap = MyDB.CreateSnapshot("MSysAccounts")

      SqlStr$ = "[Name]= '" & GroupName$ & "'"

      MySnap.FindFirst SqlStr$

      If MySnap.NoMatch Then

         MsgBox UCase(GroupName$) & " Is Not A Defined Group"

         MySnap.Close

         MyDB.Close

         Exit Function

      Else

         MySnap.Close

      End If

      SqlStr$ = "SELECT MSysAccounts.Name FROM MSysAccounts AS B,_

         MSysGroups, MSysAccounts, "

      SqlStr$ = SqlStr$ & "B INNER JOIN MSysGroups ON B.SID =_

         MSysGroups.GroupSID, "

      SqlStr$ = SqlStr$ & "MSysGroups INNER JOIN MSysAccounts ON_

         MSysGroups.UserSID = MSysAccounts.SID "

      SqlStr$ = SqlStr$ & "WHERE ((B.Name= '" & GroupName$ & "'));"

      Set MyDyna = MyDB.CreateDynaset(SqlStr$)

      If MyDyna.RecordCount = 0 Then

         MsgBox UCase(GroupName$) & " Has No Members"

         MyDyna.Close

         MyDB.Close

         Exit Function

      End If

      MyDyna.MoveFirst

      Do While Not MyDyna.eof

         Message$ = Message$ & Chr(13) & Chr(10) & MyDyna.[Name]

         MyDyna.MoveNext

      Loop

      MsgBox Message$

      MyDyna.Close

      MyDB.Close

      Exit Function

   Empty:

      If Err = 3021 Then

         MsgBox UCase(GroupName$) & " Is not a Valid Group", 16, "Error"

      Else

         MsgBox "An Unexpected Error (#" & Err & ") Occurred:" & _

            Chr(13) & Chr(10) & Error(Err), 16, "Error"

      End If

      Exit Function

      Resume

   End Function

3. From the View menu, choose Immediate Window.

4. Type the following in the Immediate window and press ENTER:

      ?Which_Users()

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 25, "Administering a

Database System," pages 612-614, version 1.1, pages 616-618

For more information on using external functions, search for "declare

external procedure" then "Declare Statement" using the Microsoft Access

Help menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmApi


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 Analyzer Include Field Descriptions

Article ID: Q109404

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The Object Analyzer utility that comes with Microsoft Access does not

include field descriptions in its output. However, you can make the

Analyzer include field descriptions by making some modifications to the

utility.

MORE INFORMATION

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

To make the Analyzer include field descriptions in its output you need to

modify the table RLTables and the function DumpTableInfo() in the

ANALYZER.MDA library.

The following steps describe how to make the necessary modifications:

 1. Use Windows Notepad (or any other text editor) to open the

    MSACCESS.INI file that is in your Windows directory.

 2. If the line

       analyzer.mda=

    exists in the [Libraries] section of the MSACCESS.INI file, put a

    semicolon at the beginning of the line. The modified line will be:

       ;analyzer.mda=

 3. Save and then close the MSACCESS.INI file.

 4. Start Microsoft Access and open the database ANALYZER.MDA.

 5. Open the RLTables table in Design view.

 6. Add a field called Description to the table. The field should have a

    data type of Text, with a length of 255 characters.

 7. Save and then close the table.

 8. Open the module Object Analyzer.

 9. Find the function DumpTableInfo().

10. Add the lines of code listed below to the function. Note that the

    lines to be added begin with the characters $$.

    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 DumpTableInfo (TargetDB As String, SQLTarget1 As String, _

   ObjOption As String, IsAttached As Integer)

      CurrentProc = "DumpTableInfo"

      '$$ New code begins - declare new variables

      Dim F As Form, C As Control

      '$$ New code ends

      If Not TableExists(TargetDB, SQLTarget1) Then

         '$$ New code begins - change the SQL to include Description

         SQLSTRING$ = "Select TableName,Name,Type,Length,IndexName,_

                Description Into [" & SQLTarget1 & "] in """ & TargetDB _

                & """ From RLTables;"

         '$$ New code ends

         PerformSQLAction SQLSTRING$

      End If

      Set RT_Target = OpenDatabase(TargetDB)

      Set RT_Database = CurrentDB()

      Set RT_SysDB = CodeDB()

      Set RT_Table2 = RT_Target.OpenTable(SQLTarget1)

      Set RT_Dynaset1 = RT_Database.CreateDynaset(ObjOption)

      Set RT_Snapshot1 = RT_Dynaset1.ListFields()

      If Not IsAttached Then

         Set RT_Table1 = RT_Database.OpenTable(ObjOption)

         Set RT_Snapshot2 = RT_Table1.ListIndexes()

      End If

      '$$ New code begins - create a form in Design view

      Set F = CreateForm()

      'set the record source to the source table

      F.RecordSource = ObjOption

      '$$ New code ends

      Do Until RT_Snapshot1.EOF

         RT_Table2.AddNew

         RT_Table2!TableName = ObjOption

         RT_Table2!Name = RT_Snapshot1!Name

         RT_Table2!Type = LookUpFieldType(RT_Snapshot1!Type)

         RT_Table2!Length = RT_Snapshot1!Size

         '$$ New code begins - create a control for this field

         Set C = CreateControl(F.FormName, 109, 0, "", RT_Snapshot1!Name)

         'save the description from the field

         RT_Table2!Description = C.StatusBarText

         '$$ New code ends

         If Not IsAttached Then

            ' Cannot use FindFirst method on List Snapshots

            If RT_Snapshot2.RecordCount > 0 Then

               RT_Snapshot2.MoveFirst

               Do Until RT_Snapshot2.EOF

                  If RT_Snapshot2!FieldName = RT_Snapshot1!Name Then _

                      Exit Do

                  RT_Snapshot2.MoveNext

               Loop

               If Not RT_Snapshot2.EOF Then

                  RT_Table2!IndexName = RT_Snapshot2!IndexName

               End If

            End If

         End If

         RT_Table2.Update

         RT_Snapshot1.MoveNext

      Loop

      '$$ New code begins - close the form, say "No" to save changes

      DoCmd SetWarnings True

      SendKeys "n"

      DoCmd Close A_FORM, F.FormName

      '$$ New code ends

      RT_CloseAllObjects

   End Sub

11. Save and then close the module.

12. Quit Microsoft Access.

13. Use Windows Notepad (or any other text editor) to open the

    MSACCESS.INI file that is in your Windows directory.

14. Remove the semicolon from the beginning of the

       ;analyzer.mda=

    line in the [Libraries] section of the file. The modified line will

    be:

       analyzer.mda=

15. Save and then close the file.

REFERENCES

==========

For more information about the Object Analyzer, see the ANALYZER.TXT file

that comes with Microsoft Access version 1.1 or the README.TXT file that

comes with Microsoft Access version 1.0.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnrlDbanlzr


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

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

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

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

To have the initial Welcome To Microsoft Access opening screen appear when

you start Microsoft Access, edit the MSACCESS.INI file in version 1.x, or

the MSACC20.INI file in version 2.0. Open either file in Windows Notepad

(or any other text editor), and change the "Tutorial=" line in the

[Microsoft Access] section from

   Tutorial=0

to

   Tutorial=1

For example:

   [Microsoft Access]

   Tutorial=1

Save and then close the file, and then start Microsoft Access.

Additional reference words: 1.00 1.10 2.00 startup

KBCategory:

KBSubcategory: UiOthr


INF: How to Mark Records with Unmatched or Invalid Values

Article ID: Q103400

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

A table imported from an external source may contain invalid or erroneous

data. This article demonstrates how to use an update query to compare an

imported table to a reference table and mark the imported records that do

not match the reference table values.

In Microsoft Access version 2.0, this functionality is provided by the Find

Unmatched Query Wizard. For more information, search for "Find Unmatched

Query Wizard" using the Help menu in Microsoft Access 2.0.

MORE INFORMATION

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

For the following example, assume that you have imported a customer

order table and have found that the records in the imported table have

valid but misspelled customer names. The example below demonstrates

how to compare names in the imported table with a table of valid names

and mark the imported records that do not match the reference table.

1. Create two tables. One table will be called Reference Table and the

   other will be called Imported Table. Create a field called Customer

   Name in each table, and add the following entries:

      Reference Table   Imported Table

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

      ACE               ACE

      BAT               ACE

      CAD               ACA

      CAT               BAT

                        BAR

                        CAD

                        CAD

                        CAT

2. Add a field named Matched to the Imported Table. Assign the Yes/No

   data type to this field. Note that the default values in this field

   will be set to No.

3. Create a query based on both tables. Join the tables by dragging

   the Customer Name field from the Reference Table to the Customer

   Name field on the Imported Table. Then choose Update on the Query

   menu.

4. Fill out the query grid with the following entries:

      Query: Mark Unmatched

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

      Field name: Customer Name

         Table: Imported Table

         Criteria: [Reference Table].[Customer Name]

      Field name: Matched

         Table: Imported Table

         Update to: "Yes"

5. Run the query. The Matched field will be set to Yes for all records

   in the Imported Table that have a Customer Name that matches a

   value in the Customer Name field of the Reference Table.

REFERENCES

==========

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

Queries and Parameter Queries, page 176

Additional reference words: 1.00 1.10 unmatched misspell spell

KBCategory:

KBSubcategory: QryMktbl


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 Modify Toolbars

Article ID: Q88907

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Although Microsoft Access does not include any end-user features for

modifying the toolbar at the top of the screen, you can modify the

toolbar if you know how to design a form and write Access Basic code.

This article discusses where toolbars are stored, how they work, and

how you can modify them.

Notes

-----

 - Modification of the toolbar was not intentionally designed into

   Microsoft Access, so you may run into situations where your

   modifications do not work. Test your modifications on noncritical

   databases, since making these modifications is not guaranteed to work

   correctly in every instance. Modifications to toolbars are 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.

MORE INFORMATION

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

The various toolbars that appear when you are using Microsoft Access

are nothing more than forms stored in a database--the same kind of

forms that you create in Microsoft Access. These forms are stored in

UTILITY.MDA, a system database file that is loaded into memory when

you start Microsoft Access.

You cannot simply start Microsoft Access and open UTILITY.MDA to

modify these forms, however. This is because UTILITY.MDA is loaded as

a library database when you are using Microsoft Access and you are not

allowed to open a library database while it is active. To work around

this, do the following:

1. Quit Microsoft Access if you have it open and make sure that no

   instances of Microsoft Access are active.

2. Choose the MS-DOS Prompt icon in Program Manager and type the

   following commands at the MS-DOS command prompt (the example below

   assumes that your Microsoft Access system files are stored in a

   directory called C:\ACCESS). Press ENTER after each command:

      CD \ACCESS

      COPY UTILITY.MDA UTILITY.NEW

3. Start Microsoft Access.

At this point, you can begin modifying the toolbars in UTILITY.NEW.

Open UTILITY.NEW as a database (a couple alerts will appear about

loading duplicate procedure names; ignore these alerts by choosing the

OK button). In the Database window, switch to Form view and note the

names of the forms. The forms in the Database window that end with the

characters "TB" are toolbar forms. At this point, you can open a

toolbar form and make a modification. After the modification is made,

you can change a setting in your MSACCESS.INI file that will force

Microsoft Access to use UTILITY.NEW instead of UTILITY.MDA as its

utility database.

It is important to note that any functionality you add to new

controls on the toolbars must be supported by Access Basic--do not use

macros, as they will not work for this purpose.

The example below illustrates how you can add a toolbar button to your

form design toolbar that will toggle the toolbox on and off:

 1. Open the form called FDTB in Design view. This is the toolbar that

    appears when you bring up a form in Design view, as you are doing

    at this point.

 2. Add a small command button to the right of the "paint palette"

    toolbar button on the form. Make sure your button does not overlap

    any other controls and that it does not alter the height of the

    form.

 3. For the button's OnPush property, specify:

       =ToggleToolBox()

 4. Save and close the form.

 5. Create a new module called NewToolBarFunctions and add the

    following sample function:

       Function ToggleToolBox ()

          DoCmd DoMenuItem 3, 2, 8

          ' The DoCmd command above invokes the forms design menu item

          ' View->Toolbox

       End Function

 6. Save and close the module, and then close the database.

 7. Quit Microsoft Access.

 8. From Program Manager, open Notepad.

 9. In NotePad, open the file MSACCESS.INI from your Windows program

    directory.

10. In MSACCESS.INI, locate the [Options] section and modify the

    UtilityDB= line to read:

       UtilityDB=C:\ACCESS\UTILITY.NEW

11. Save and close MSACCESS.INI, and then start Microsoft Access.

12. Open any database, and open any form in Design view. Note that the

    button you added appears in the toolbar. Click the button to turn

    the toolbox on and off.

In the same way you modified your form design toolbar using the steps

above, you can make other modifications to add functionality to the

other Microsoft Access toolbars.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: MdlLib


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 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 Pass Information to Microsoft Access Using DDE

Article ID: Q100167

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

You cannot poke data into a table through a dynamic data exchange (DDE)

channel in Microsoft Access. However, you can use a function with

parameters in a DDE channel to the SQL topic to pass information to an

Access Basic function. The data can then be processed by the function and

added to a table.

MORE INFORMATION

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

The following example explains how to add a new customer to the Customers

table in the sample database NWIND.MDB, using data from Microsoft Excel:

1. Create a table called None, with one field of any data type.

2. Open a module and create the following sample function with the

   parameters that you want to pass:

      Function AddNewCust$ (CustomerID$, CompanyName$)

         Dim MyDB As Database, MyTable As Table

         Set MyDB = CurrentDB()

         Set MyTable = MyDB.OpenTable("Customers")  ' 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.

      End Function

3. In the DDE client application, initiate a DDE link using MSACCESS as the

   application and use a SQL Select query as the topic. The topic will be

   of the form

      DatabaseName;SQL Select FunctionName(args) From None;

   where None is 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 inserts a new

   record into the Customer table.

   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.

      AddNewCustomer

      chan=INITIATE("MSACCESS","NWIND.MDB;SQL SELECT_

           AddNewCust$(""JOHNJ"",""John's Place"") FROM None; ")

      =TERMINATE(chan)

      =RETURN()

   The following is the equivalent Microsoft Word for Windows Word Basic

   macro.

   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.

      Sub MAIN

      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

Note that this technique works only with functions that perform operations

that can run successfully in the Microsoft Access query by example (QBE)

grid. For example, a function that performs an OpenForm action will fail

with the error message "Can't run this action while in current code

context." The function fails because it tries to perform an OpenForm action

while a query is running, which is not allowed.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 118-124

Additional reference words: 1.00 1.10 dde excel macro ddepoke

KBCategory:

KBSubcategory: IntpOthr


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 Prevent Users from Adding New Records to a Form

Article ID: Q100465

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The DefaultEditing form property, when set to AllowEdits, allows users to

both modify existing records and add new records. Microsoft Access has no

built-in mechanism to prevent users from adding new records.

MORE INFORMATION

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

The following information describes how to use an Access Basic

function to prevent users from entering new employees in the Employees

form in the sample database NWIND.MDB:

1. Add the following Access Basic function to a new or existing

   module:

      Function PreventNew ()

         Dim X

         On Error Resume Next

         X = Screen.ActiveForm.Bookmark

         If Err = 3021 Then DoCmd GoToRecord , , A_LAST

      End Function

   NOTE: There are two commas between GoToRecord and A_LAST above.

2. Change the OnCurrent property of the Employees form to read as

   follows:

      Form: Employees

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

         OnCurrent:  =PreventNew()

   RESULT: The user is placed in the last record of the Employees form

   when attempting to access or navigate to the new record.

How PreventNew() Works

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

Whenever the user navigates to a different record, the OnCurrent

property executes the PreventNew() function. This function attempts to

reference the bookmark property associated with the current record.

All records are assigned a string, called a bookmark, that uniquely

identifies each record.

However, a new record that has not yet been saved has no bookmark

associated with it. Any attempt to reference the bookmark of a new

record generates an error message. If an error occurs, the

PreventNew() function immediately performs a GoToRecord action to

navigate to the last record in the form.

Using PreventNew With Forms that Contain No Records

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

If the table or query the form is based contains no records,

PreventNew will not prevent you from adding a new record to the form.

The developer must first test to see if records exist in the table

or query prior to opening the form, handling this condition

appropriately. The following Access Basic function can be used to

test for the existance of records in a table or query.

      Function RecordsExist (TableQueryName As String)

         Dim DB As Database

         Dim DS As Dynaset

         Set DB = CurrentDB()

         On Error Resume Next

         Set DS = DB.CreateDynaset(TableQueryName)

         DS.MoveFirst

         If Err <> 0 Then

             RecordsExist = False

         Else

             RecordsExist = True

         End If

     End Function

Given the name of table or query, this function will return True (-1)

if records exist, or False (0) if no records exist. Another method,

would be to use the Microsoft Access DCount function. DCount may be

significantly slower than the RecordsExist function in that

it must count all the records in the database, where RecordsExist simply

tests to see if there is a "first" record in the record set.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmObj


INF: How to Prevent Workstation Setup from Installing Locally

Article ID: Q109379

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

To prevent Microsoft Access from being installed locally on workstations

with the SETUP /N command, you need to modify the STFSETUP.IN_ file that

was placed in the INSTALL directory by the administrator setup command

SETUP /A.

MORE INFORMATION

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

If the Setup program is run on a workstation and you have not modified the

STFSETUP.IN_ file, the following message will be displayed on the

workstation:

   You can use the copy of Microsoft Access on your network, or you can

   install Microsoft Access on your hard disk. If you install Microsoft

   Access on your hard disk, it will run faster, but it will take up space

   on your hard disk.

   Do you want to install Microsoft Access on your hard disk?

If the Yes option is chosen, the Setup program will copy all the files

necessary to run Microsoft Access locally to the workstation's hard disk.

If the No option is chosen, the Setup program will copy only those files

necessary to let Microsoft Access run on the workstation from the server.

The following steps describe how to modify the STFSETUP.IN_ file so that

the message stated above will not appear when the Setup program is run from

a workstation. The Setup program will instead automatically configure the

workstation to run Microsoft Access from the network server:

1. Make a backup copy of the STFSETUP.IN_ file by copying the file to

   another disk or directory.

2. Open the STFSETUP.IN_ file located in the INSTALL directory on the

   network server in a text editor such as Windows Write. Do not allow

   the editor to change the format of the file--the file must remain an

   ASCII, or text, file. Note that the STFSETUP.IN_ file is too large to

   be opened in Notepad.

3. Locate the section of the STFSETUP.IN_ file that contains the

   following lines:

      ifstr $(STF_MODE) == "NETWORK"

         read-syms "Copy Local"

         ui start MessageBox

         set LocalCopy = $(DLGEVENT)

         ifstr $(DLGEVENT) == "NO"

            set INIPATH = $(WINDOWSPATH)

            read-syms "Minimum Options"

            set COPYPROG = "OFF"

         else

            set CIRPATH2 = $(HD)$(CIRDIR)

         endif

      endif

   Note that an easy way to find this section is to use the text editor's

   Find function to locate the second occurrence of the text "Copy Local".

4. Modify the lines in this section as follows:

      ifstr $(STF_MODE) == "NETWORK"

         ;read-syms "Copy Local"

         ;ui start MessageBox

         ;set LocalCopy = $(DLGEVENT)

         set LocalCopy = "NO"

         ;ifstr $(DLGEVENT) == "NO"

            set INIPATH = $(WINDOWSPATH)

            read-syms "Minimum Options"

            set COPYPROG = "OFF"

         ;else

            ;set CIRPATH2 = $(HD)$(CIRDIR)

         ;endif

      endif

5. Save the modified STFSETUP.IN_ file, and then close the editor.

NOTE: When you are saving the file, do not allow the editor to change the

format of the file--it must remain a plain ASCII, or text, file.

After these modifications have been made, running the Setup program on a

workstation will automatically result in a configuration on the workstation

to run Microsoft Access from the network server.

NOTE: Make sure, when you are editing an STFSETUP.IN_ file generated by the

Microsoft Access Distribution Kit's SetupWizard, not to make any

modifications below the

   ;================================================

   ;DO NOT MODIFY BELOW THIS LINE

   ;================================================

section in the file. Modifications below this section are not supported.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: StpNet


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 Book Style Page Numbers

Article ID: Q109821

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Microsoft Access does not have a built-in format to print page numbers on

a report in "bookstyle" format, where odd page numbers are printed on the

right side of the page and even page numbers are printed on the left side

of the page. This article describes how to print a report with bookstyle

page numbering.

MORE INFORMATION

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

The following example demonstrates how to set up bookstyle page numbering

for a report:

 1. Open the sample database NWIND.MDB.

 2. Create the following new macro, and then save it as Page Setting:

       Condition                Action

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

       [PageRight] Mod 2 <> 0   SetValue

        ...                     SetValue

       [PageRight] Mod 2 = 0    SetValue

       ...                      SetValue

       Page Setting Actions

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

       SetValue

          Item: [PageRight].Visible

          Expression: Yes

       SetValue

          Item: [PageLeft].Visible

          Expression: No

       SetValue

          Item: [PageRight].Visible

          Expression: No

       SetValue

          Item: [PageLeft].Visible

          Expression: Yes

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

 4. Select the Page text box in the report's page footer section.

 5. Change the Page text box's ControlName property from Page to

    PageRight.

 6. From the Edit menu, choose Copy. Then, from the Edit menu, choose

    Paste. A copy of the PageRight text box will appear.

 7. Drag the new text box to the left side of the page footer.

 8. Change the new text box's ControlName property to PageLeft.

 9. Select the page footer section of the report, and change its

    OnFormat property to the macro Page Setting.

10. Save the report and then preview it.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 11, "Using

Expressions in Forms," page 292, version 1.1, page 296

Microsoft Access "User's Guide," version 1.0, Chapter 20, "Using

Expressions in Reports,"  pages 483-484, version 1.1, pages 487-488

Microsoft Access "Language Reference," version 1.0, "Page Property,"

page 364

Additional reference words: 1.00 1.10 page alternate bookstyle

KBCategory:

KBSubcategory: RptLayou


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 Multiple Labels in Varying Numbers

Article ID: Q117534

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to print multiple copies of the same mailing

label in varying numbers for each 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. This article also assumes that

you are familiar with designing reports in Microsoft Access.

MORE INFORMATION

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

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 each on 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. The following

example demonstrates how to work around this behavior.

Notes:

 - The sample code below is generic. It can be used with any mailing label

   report.

 - The sample code below assumes that you have a mailing label report named

   MyLabels. The report should have a Quantity field that stores a value

   representing the number of copies you want for each label.

 - 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. Create a new module and enter the following sample code:

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

      'Declarations section of the module

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

      Option Compare Database

      Option Explicit

      Dim LabelCopies&

      Dim CopyCount&

      '==========================================================

      ' The LabelSetup() function uses the value of the Quantity

      ' field in the mailing label report to determine how many

      ' copies of each label to print.

      '==========================================================

      Function LabelSetup ()

         LabelCopies& = Val(IIF(IsNull(Reports!MyLabels!Quantity),0,_

            Reports!MyLabels!Quantity))

         If LabelCopies& < 1 Then LabelCopies& = 1

      End Function

      '==========================================================

      ' The LabelInitialize() function sets the CopyCount&

      ' variable to zero.

      '==========================================================

      Function LabelInitialize ()

         CopyCount& = 0

      End Function

      '==========================================================

      ' The LabelLayout() function counts the number of copies

      ' for each mailing label when it is printed.

      '==========================================================

      Function LabelLayout (R As Report)

         Dim x

         x=LabelSetup()

         If CopyCount& < (LabelCopies& - 1) Then

            R.NextRecord = False

            CopyCount& = CopyCount& + 1

         Else

            CopyCount& = 0

         End If

      End Function

2. Open the MyLabels report in Design view and set the detail section's

   OnFormat property to the following line:

      =LabelLayout(Reports![MyLabels])

3. From the Layout menu, choose Report Hdr/Ftr. Then, set the report header

   section's OnFormat property to the following line:

      =LabelInitialize()

4. Set the Height property for both the report header and report footer

   sections to 0.

When you print the report, the LabelInitialize() function in the report

header sets the label count to zero. Then, as each label is formatted, the

LabelLayout() function adjusts the NextRecord property to print the number

of labels determined by the LabelSetup() function.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, page 313

Additional reference words: 1.00 1.10 report duplicate label on format

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 Print Total Number of Pages on Each Page of Report

Article ID: Q97517

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

You can print the page number on each page of a report by using the

Page property in a text box control in the page footer. The example

below also shows you how to print the total number of pages in the

report on each page (for example, 1/<n>, where <n> is the total number of

pages).

The sample program below uses the SendKeys statement to go to the end of

the report, stores the total number of pages in a global variable, then

returns to the beginning of the report to print or preview the report.

NOTE: This method may not work with all reports. Below are four known

problems with this method:

 - If the report window is zoomed (maximized), the END key in the

   SendKeys statement will not work correctly.

   By default, reports open with the report window zoomed. Pressing Z

   unzooms the screen and pressing the END key moves you to the end of

   the report so that the code below can calculate the total number of

   pages. However, if the report window is zoomed, the END key moves

   the cursor to the right corner of the screen instead of going to

   the last page of the report. The SendKeys statement in the

   GotoEnd() function contains the key combination ALT+Z  (or %Z) to

   toggle the zoomed mode off. If your report displays a 0 for total

   pages, try omitting the %Z from the SendKeys statement.

 - If a query takes a long time to process, Microsoft Access can yield

   processor control to Windows, which empties the keyboard buffer.

   When  this happens, the GotoEnd() function (which uses SendKeys)

   fails, the  SendKeys data is lost, and the total number of pages

   listed may be wrong. (This problem most often occurs when a report

   contains subreports.)

 - If your report contains subreports, this method does not calculate

   the total number of report pages correctly. Currently, there is no

   workaround for this behavior. A change to this behavior is being

   reviewed for inclusion in a future version of Microsoft Access.

-  If you use an OpenReport macro action where the report is sent

   directly to the printer, this will fail because the functions are not

   allowed to go to the end of the report and back again to create the

   total page number variable.

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 print the total number of pages in a report at the bottom of each

page, do the following:

1. Open a new module or a previously created module and enter the

   following 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.

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

      'Declarations section of the module

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

      Option Explicit

      Global TotalPages as Integer

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

      'Create the following functions in the module.

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

      Function GetTotalPages()

         GetTotalPages = TotalPages

      End Function

      Function GotoEnd()

         TotalPages = 0

         SendKeys "%z{END}", False

         ' SendKeys does not work if report is maximized

      End Function

      Function SaveTotalPages(TotPgNum As Integer)

         If TotalPages = 0 Then

            TotalPages = TotPgNum

            SendKeys "{HOME}", False

         End If

      End Function

2. Open your report in Design view.

3. From the View menu, choose Properties to display the property

   sheet. Add the following function to the report's OnOpen property:

      OnOpen: =GotoEnd()

4. Place a text box control called MyPage in the page footer:

      Object: Text Box

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

      ControlName: MyPage

         ControlSource: =Page

         Visible: No

5. Change the report footer's OnFormat property to:

      OnFormat: =SaveTotalPages([MyPage])

6. Place a text box control in the page footer as follows:

      Object: Text Box

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

      ControlName: PageNum

         ControlSource: =Page & "/" & GetTotalPages()

When you print the report, the text box control prints the page number

as 1/<n>, where <n> is the total number of pages in the report.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RptLayou


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 for Duplicate Records

Article ID: Q98230

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

When you import data from other databases, records may contain

duplicate information in the primary key fields. You can run a

make-table query to eliminate the duplicate data, but if key fields

for two or more records contain the same value, you may want to

reconcile the information manually to make the records unique.

This article includes sample queries and shows how to list duplicate

information for keys containing single fields or multiple fields.

MORE INFORMATION

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

Single-Field Keys

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

Note that this example assumes you have a table called MyTable, with the

primary key on the Name field.

1. Open MyTable in Design view and index the Name field, as shown

   below:

      Table: MyTable

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

      Field: Name

         Indexed: Yes (Duplicates OK)

2. Create the following query based on MyTable:

      Query: Find Duplicates

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

      Field: Name

         Total: Group By

      Field: Name

         Total: Count

         Criteria: >1

   The equivalent SQL statement is as follows:

      SELECT DISTINCTROW

         Name, Count(Name) As CountOfName

      FROM

         MyTable

      GROUP BY

         Name

      HAVING

         Count(Name)>1

      WITH OWNERACCESS OPTION;

3. Run the query. Duplicate key values are displayed in the first

   column and the number of times the value appears is displayed in

   the second column.

Multiple-Field Keys

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

This example assumes you have a table called MyTable, with a double

primary key on the First Name and Last Name fields.

1. Open MyTable in Design view and index the First Name and Last Name

   fields, as shown below:

      Table: MyTable

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

      Field: First Name

         Indexed: Yes (Duplicates OK)

      Field: Last Name

         Indexed: Yes (Duplicates OK)

2. Create the following query based on MyTable:

      Query: Find Duplicates

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

      Field: Last Name

         Total: Group By

      Field: First Name

         Total: Group By

      Field: First Name

         Total: Count

         Criteria: >1

   The equivalent SQL statement is as follows:

      SELECT DISTINCTROW

         [Last Name], [First Name],

         Count([First Name]) As [CountOfFirst Name]

      FROM

         MyTable

      GROUP BY

         [Last Name], [First Name]

      HAVING

         Count([First Name])>1

      WITH OWNERACCESS OPTION;

3. Run the query. Duplicate key values are displayed in the first two

   columns and the number of times the value appears is displayed in

   the third column.

REFERENCES

==========

For more information on querying for duplicate values, query on the

following words here in the Microsoft Knowledge Base:

   filter and unique and query

Additional reference words: 1.00

KBCategory:

KBSubcategory: QryMktbl


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 Quickly Delete Multiple Tables

Article ID: Q106304

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

In some situations you may want to quickly delete multiple tables, rather

than deleting them one at a time.

For example, when you import data from another product, an error table may

be created. After several imports, you may have several old import error

tables to delete.

Below are two methods of quickly deleting multiple tables. The first method

allows you to bypass the delete confirmation screen. The second method uses

a function that deletes all tables that begin with "Import Errors," and is

particularly useful when the same table type must be deleted often.

MORE INFORMATION

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

Method 1

--------

You can bypass the "Delete table <tablename>?" delete confirmation screen

by pressing SHIFT+DEL instead of just DEL.

For example, if you select a table named Test and then press DEL to delete

the table, you will get the message:

   Delete table Test?

If you choose OK, the table will be deleted. However, if you select the

table named Test and then press SHIFT+DEL to delete the table, the table is

instantly deleted with no delete confirmation screen.

Method 2

--------

To do a bulk deletion of tables with a certain name, you can use an Access

Basic function. The sample function below is written specifically to delete

import error tables. To delete other tables, you can change the name to the

name of the tables you want to delete. The function must be called by an

event such as a button press:

   Function DeleteImportErrorTables ()

      On Error GoTo ResetEnv

      Dim MyDB As Database, MySnapShot As Snapshot

      If MsgBox("Delete Import Error Tables?", 292) = 7 Then

         On Error GoTo 0

         Exit Function

      End If

      Set MyDB = CurrentDB()

      Set MySnapShot = MyDB.ListTables()

      DoCmd Echo False        ' Turn off screen updates.

      DoCmd SetWarnings False ' Turn off warning messages.

      Do Until MySnapShot.EOF

         If MySnapShot.[Name] Like "Import Errors*" Then

            DoCmd SelectObject A_TABLE, MySnapShot.Name, True

            DoCmd DoMenuItem A_DATABASE, A_EDIT, A_DELETE

         End If

         MySnapShot.MoveNext

      Loop

      DoCmd SetWarnings True ' Be sure to set SetWarning back on!

      DoCmd Echo True        ' Be sure to turn screen updating back on!

   Exit Function

   ResetEnv:

      DoCmd SetWarnings True ' Be sure to set SetWarning back on!

      DoCmd Echo True        ' Be sure to turn screen updating back on!

      Exit Function

   End Function

Additional reference words: 1.00 1.10 Erasing

KBCategory:

KBSubcategory: TblOthr


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 Relationships

Article ID: Q92649

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article explains how to delete a relationship in Microsoft Access

once it has been created.

MORE INFORMATION

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

The sample database NWIND.MDB contains a relationship between the

Employees and the Orders tables. The following steps demonstrate how to

delete this relationship:

1. Open the NWIND database.

2. From the Edit menu, choose Relationships.

3. In the Primary Table box, select Employees.

4. In the Related Table box, select Orders. Since these tables already

   have a relationship, Microsoft Access displays Employee ID in the

   Select Matching Fields box, and makes the Add button unavailable.

5. Choose the Delete button to remove the existing relationship.

6. Chose Close to exit the Relationships dialog box.

Note that you can also view existing relationships by creating a query.

Include all the tables in your database in the query, and Microsoft

Access will display join lines to indicate existing relationships.

REFERENCES

==========

For more information on listing the relationships in a database, query on

the following words here in the Microsoft Knowledge Base:

   relationships and list

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RltOthr


INF: How to Remove the Caption Bar from a Form

Article ID: Q103261

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There is no built-in mechanism in Microsoft Access version 1.x for removing

the caption bar from a form. The caption bar runs across the top of the

window and includes the Control menu and the minimize and maximize buttons.

Microsoft Access version 2.0 has properties you can use to remove the

minimize and maximize buttons and the Control menu. For more information,

search for "MinButton, MaxButton, and ControlBox" using the Help menu in

Microsoft Access 2.0. Or you can set the BorderStyle property to None to

remove the caption bar from the form.

This article demonstrates a sample user-defined Access Basic function

called RemoveCaptionBar() that you can use to remove the caption bar from a

form. Procedures for creating a form with no caption bar are also listed.

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

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

Creating a New Module to Delete Caption Bar

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

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 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.

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

' MODULE DECLARATION SECTION

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

Option Explicit

' Windows API Rect structure

Type RECT

    x1 As Integer

    y1 As Integer

    x2 As Integer

    y2 As Integer

End Type

' Windows API Declarations

Declare Function SetWindowLong& Lib "User" (ByVal hwnd%, _

                    ByVal index%, ByVal style&)

Declare Function GetWindowLong& Lib "User" (ByVal hwnd%, _

                    ByVal index%)

Declare Function GetSystemMetrics% Lib "User" (ByVal iIndex%)

Declare Function GetWindowRect% Lib "User" Alias "GetWindowRect" _

                    (ByVal hwin%, rectangle As RECT)

Declare Function MoveWindow% Lib "User" Alias "MoveWindow" _

                    (ByVal hwin%, ByVal x%, ByVal y%, ByVal dx%, _

                    ByVal dy%, ByVal fRepaint%)

' GetWindowLong Constants

Const GWL_STYLE = -16

' Window Styles Constants

Global Const WS_CAPTION = &HC00000

' System Metrics Constants

Global Const SM_CYCAPTION = 4

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

' FUNCTION: RemoveCaptionBar

'

' PURPOSE:

'   Removes the caption bar, which includes the system menu

'   and minimize and maximize buttons, from a form.

'

' ARGUMENTS:

'   F - The form object from which to remove the caption bar.

'

' USAGE:

'   Enter the following for the OnOpen property of a form called

'   MyForm:

'

'       =RemoveCaptionBar(Forms![MyForm])

'

' SIDE AFFECTS:

'   With a normal form, the form opens slightly lower than

'   expected. With a dialog form (PopUp=Yes, Modal=Yes), the form

'   opens slightly higher than expected. Also, you cannot close the

'   form using the Microsoft Access menu; you must close it

'   programmatically.

'

'   If the form property Popup=No, a form is created that has a

'   sizable border. Since Captions are required for sizable windows,

'   screen painting problems may occur. For instance, if the frame

'   of the Window is a light color, the division lines for the frame

'   will display, creating an undesirable effect.

'

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

Function RemoveCaptionBar (F As Form)

    Dim OldStyle As Long, NewStyle As Long

    Dim R As RECT

    Dim RetVal As Integer

    Dim dx As Integer, dy As Integer

    ' Get the current window style of the form.

    OldStyle = GetWindowLong(F.hwnd, GWL_STYLE)

    ' Set the window style to be the same, minus the caption bar.

    NewStyle = OldStyle And Not WS_CAPTION

    'Change the window style of the form.

    OldStyle = SetWindowLong(F.hwnd, GWL_STYLE, NewStyle)

    ' The caption is removed, but the border has not snapped down

    ' .. onto the smaller window. We will call the Windows API to

    ' .. move and size the window to the same location and size,

    ' .. with the window shortened by the length of the caption bar.

    RetVal = GetWindowRect(F.hwnd, R)

    dx = R.x2 - R.x1

    dy = R.y2 - R.y1 - GetSystemMetrics(SM_CYCAPTION)

    RetVal = MoveWindow(F.hwnd, R.x1, R.y1, dx%, dy%, True)

End Function

Creating a Form with No Caption Bar

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

The following instructions show how to create a form that does not

have a caption bar:

1. Create or open a database in Microsoft Access.

2. Create a new, blank, unbound form and save it with the name

   NoCaption.

3. Change the OnOpen property of the form to read:

      =RemoveCaptionBar(Forms![NoCaption])

4. From the View menu, choose Form.

Additional reference words: 1.00 1.10 menu bar

KBCategory:

KBSubcategory: PgmApi


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 Requery a Combo Box on Subform

Article ID: Q101082

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

This article describes a macro that will requery a combo box control

on a subform. This macro is useful for a combo box that is based on a

query that references the main form and thus should be requeried

whenever you change records on the main form.

MORE INFORMATION

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

The following sample macro will requery the combo box:

   Macro Name     Action          Defined Below

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

   RequeryCombo   GoToControl     1

                  GotoControl     2

                  Requery         3

   RequeryCombo Actions

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

   1. GotoControl

         ControlName: <Subform ControlName>

   2. GotoControl

         ControlName: <ComboBox ControlName>

   3. Requery

         ControlName: <ComboBox ControlName>

When this macro is run, it will requery the combo box. If you want the

combo box to be requeried each time you change records in the main

form, add this macro to the OnCurrent property of the main form.

REFERENCES

==========

For more information on form events, search for "events" then "events

for forms" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 macros forms

KBCategory:

KBSubcategory: FmsEvnt


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 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 Run Wizards or Open the WIZARD.MDA File

Article ID: Q104569

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

You can cause the Microsoft Access Wizards to run by calling the

zwWizMain() function that is defined in the zwUI module of the WIZARD.MDA

file.

MORE INFORMATION

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

The zwWizMain() function is declared as

   Function zwWizMain (<szTable> As String, ByVal <fReport> As Integer)

where <szTable> is a string value that is the name of an existing table or

query in the open database, and <fReport> is a Boolean value. The value for

<fReport> is either 0 or 1. Zero will open the FormsWizard, and 1 will open

the ReportWizard.

You can also open the WIZARD.MDA file in Microsoft Access in order to view

the code used by the FormsWizard and ReportWizard. To open the WIZARD.MDA

file, do the following:

1. While Microsoft Access is not running, open the MSACCESS.INI file

   located in your Windows directory. You can use any text editor (for

   example, the Microsoft Windows Notepad editor) to open the MSACCESS.INI

   file.

2. Locate the [Libraries] section in the file. It should look like:

      [Libraries]

      wizard.mda=ro

3. Comment out the "wizard.mda=ro" line by putting a semicolon at the

   beginning of the line. The section should now look like:

      [Libraries]

      ;wizard.mda=ro

4. Save and close the MSACCESS.INI file.

5. Start Microsoft Access.

6. From the File menu, choose Open Database.

7. Select the WIZARD.MDA file in the Open Database dialog box.

With the WIZARD.MDA file open, you can view the code used by the Wizards.

The following example demonstrates how to call the zwWizMain() function

from an Immediate window:

   ?zwWizMain ("My Table", False)

NOTE: You will not be able to run the Wizards as you would normally while

the WIZARD.MDA file is open. To run the Wizards normally, you need to

remove the change made to the MSACCESS.INI file in step 3 above, and then

restart Microsoft Access.

Additional reference words: 1.00 1.10 zwinitwizard

KBCategory:

KBSubcategory: MdlLib


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 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 Simulate Changing RecordSource Property of Report

Article ID: Q102672

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Although you cannot actually change the RecordSource property of a

report, you can simulate the change by using a OpenReport macro action

and calling a different query source from the Filter Name argument.

MORE INFORMATION

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

The Filter Name argument must reference a query that contains the same

number of fields (with the same names) as appear in the existing

report. If the fields do not exist in the query, the report may

display the "#Name?" error message for controls bound to those fields.

To simulate changing the RecordSource property of a report called

MyReport, do the following:

1. Create a new report called MyReport.

2. Create a new query called MyNewQuery, using the same fields that

   appear in MyReport.

3. Create a macro with one action as follows:

      OpenReport

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

      Report Name: MyReport

      View: Print Preview

      Filter Name: MyNewQuery

   NOTE: A SQL statement cannot be substituted for the query name.

Using this method, you can use the same report to print data from

multiple data sources.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 23

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RptProp


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 Sort on Different Fields Dynamically

Article ID: Q109715

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article demonstrates how to design a filter that you can use to

dynamically select the field on which to sort records.

MORE INFORMATION

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

The example below uses the Choose() function in a filter to sort the

records displayed on a form. Toggle buttons in an option group are used

to sort on different fields. The Choose() function accepts the value of

the option group as its first argument, and selects the field from the

subsequent list based on that value.

The following example describes how to create a form and a filter that

demonstrate this technique:

 1. Open the sample database NWIND.MDB.

 2. Create the following new form:

       Form: Customer Filter Test

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

          Caption: Customer Filter Test

          RecordSource: Customers

       Text Box: Company Name

          ControlSource: Company Name

       Text Box: Contact Name

          ControlSource: Contact Name

       Text Box: Address

          ControlSource: Address

 3. Create the following option group on the form:

       Option Group: Field Selector

          AfterUpdate: Apply Sort Macro

 4. Place the following toggle buttons in the option group:

       Toggle Button: CompName

          OptionValue: 1

          Caption: Company Name

       Toggle Button: ContName

          OptionValue: 2

          Caption: Contact Name

       Toggle Button: Addr

          OptionValue: 3

          Caption: Address

 5. View the form in Form view.

 6. Choose Edit Filter/Sort from the Records menu.

 7. Create the following calculated field:

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

    continuation character. Remove the underscore when re-creating this

    example.

       Field: Choose(Forms![Customer Filter Test]![Field Selector], _

          [Company Name], [Contact Name], [Address])

       Sort: Ascending

 8. From the File menu, choose Save As Query. Save the filter as Customer

    Sort Filter.

 9. Save and close the form and close the filter.

10. Create the following new macro and save it as Apply Sort Macro:

       Apply Sort Macro Actions

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

       Action:  ApplyFilter

          Filter Name: Customer Sort Filter

11. Open the Customer Filter Test form. Click the Contact Name

    toggle button.

The records on the form will be sorted by the Contact Name field.

Clicking the other toggle buttons will cause the records to be sorted on

the fields specified by the toggle buttons.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, "Choose Function,"

page 65

For more information on the Choose() function, search for "Choose" using

the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 change column

KBCategory:

KBSubcategory: FmsOthr


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 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 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 Main/Subform with Attached SQL Server Tables

Article ID: Q104979

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

The information in this article applies to:

 - Microsoft Access version 1.1

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

SUMMARY

=======

When you are using a main/subform and the RecordSource properties of

both forms are attached SQL Server tables, performance is reduced. The

select syntax is sent to ODBC as a parameter query, in which the data

types of the linked fields are not known.

MORE INFORMATION

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

Using a main/subform with attached SQL Server tables results in a

parameter query for the subform's RecordSource property. All fields in

which the linked field of the subform is equal to the linked field in

the main form are selected for the subform. Parameter queries based on

attached ODBC tables run slowly when the data type of the field in the

WHERE clause is unknown.

To work around this problem, use the following procedure:

NOTE: The following example is based on the sample database NWIND.MDB,

in which the Employees and Orders tables are exported, attached, SQL

Server tables. The main form is called frmMain and the subform is

called frmSub. The linked field is Employee_ID. This example also

assumes that the RecordSource properties of the two forms are the

Employees and Orders tables, respectively.

1. Delete the Employee_ID field name in the LinkChildFields and

   LinkMasterFields properties of the subform control on the main

   form.

2. Create a query based on the attached Orders table. Specify

   Forms!frmMain!Employee_ID as the criteria of the linked field.

3. Switch to Design view. From the Query menu, choose Parameters.

4. Specify the query parameter as Forms!frmMain!Employee_ID and the

   data type as Long Integer.

5. Change the RecordSource property of the subform to reflect your new

   query.

   The main/subform behaves the same as before, except that the

   subform's query and the control on the main form maintain the link

   through a parameter query.

These concepts apply to any form where the subform is based on an

attached ODBC table.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.1, page 184

Additional reference words: 1.10

KBCategory:

KBSubcategory: FmsSubf


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

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

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

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

SUMMARY

=======

When you run Microsoft Access from Program Manager or File Manager,

you can use command line switches to modify the start up process. For

example, you can open a particular database, execute a macro, or

supply a password.

MORE INFORMATION

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

Microsoft Access recognizes the following command line switches:

Version 1.x Only

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

   /s                  Bypasses the Microsoft startup screen.

NOTE: The startup, or splash, screen in Microsoft Access can be also be

suppressed using the Microsoft Access version 1.x Distribution Kit (ADK)

and the Microsoft Access version 2.0 Developer's Toolkit (ADT).

Versions 1.x and 2.0

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

   <database>          Opens the specified database.

   /Excl               Opens the database for exclusive access.

   /Ro                 Opens the database for read-only access.

   /User <user name>   Starts Access using the specified user name.

   /Pwd <password>     Starts Access using the specified password.

   /X <macro>          Starts Access and runs specified macro.

   /Cmd                Specifies what value to pass to the Command

                       function in an Access Basic procedure that is

                       called by a RunCode action

                       in an AutoExec macro. This option must be the

                       last option on the command line.

Version 2.0 Only

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

/Ini <initialization file>    Starts Microsoft Access using the options in

                              the specified initialization file instead of

                              the standard MSACC20.INI file. The

                              initialization file must have the same

                              entries as the standard MSACC20.INI file.

/Compact <target database>    Compacts the database specified before the

                              /Compact option and then closes Microsoft

                              Access. To compact to a different name,

                              specify a target database.

/Repair                       Repairs the specified database and then

                              closes Microsoft Access.

/Convert <target database>    Converts a 1.x database to a 2.0 database,

                              with a new name, and then closes Microsoft

                              Access. Specify the source database before

                              the /Convert option.

For example, you could type the following command in the Run dialog box

(available by choosing Run from the Program Manager File menu):

   C:\ACCESS\MSACCESS.EXE NWIND.MDB /Excl /X Add Products

This sample syntax starts Microsoft Access, opens the NWIND sample

database for exclusive use, and runs the Add Products macro.

REFERENCES

==========

For more information, search for "command line" then "Starting

Microsoft Access with Command-line Options" using the Microsoft Access

Help menu.

Microsoft Windows "User's Guide," version 3.1, Chapter 2, "Application

Basics," pages 53-54

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory:  UiOthr


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 Custom Colors in Microsoft Access

Article ID: Q106299

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to use colors that are not available on the

color palette for forms and reports in Microsoft Access version 1.x.

In Microsoft Access version 2.0, you can use the Color Builder to create

custom colors for your forms and reports. For more information, search for

"custom colors" using the Help menu in Microsoft Access 2.0.

MORE INFORMATION

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

Microsoft Access 1.x can use any of the colors available to Microsoft

Windows. Custom colors that you create in Windows can be created in

Microsoft Access as well. The following example demonstrates how to use a

custom color in Microsoft Access 1.x:

 1. In the Microsoft Windows Control Panel, choose the Colors Icon.

 2. Choose Color Palette.

 3. Choose Define Custom Colors.

 4. Pick the color you want by clicking in the large color square in the

    Custom Color Selector dialog box.

 5. Note the numbers next to the Red, Green, and Blue boxes. Write these

    numbers down in order (for example, Red=233, Green=44, Blue=99).

 6. Choose Close to close the Custom Color Selector dialog box, and then

    close the Control Panel.

 7. Start Microsoft Access.

 8. Open the database that contains the form or report you want to change.

 9. Create a new module. From the View menu, choose Immediate Window.

10. In the Immediate window, type the following, and then press ENTER:

    NOTE: This example uses the numbers from step 5. Substitute your own

    custom color numbers for these numbers.

       ?RGB(233,44,99)

11. Note the number that is returned in the Immediate window. This number

    is a Long integer representing your custom color. In this example,

    the value returned is 6499561.

12. Open the form or report you want to change in Design view.

13. Select the object you want to assign the custom color to.

14. Set the object's Color property to the value noted in step 11.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 310-312

Microsoft Access "User's Guide," version 1.1, pages 314-316

Additional reference words: 1.00 1.10 ADK

KBCategory:

KBSubcategory: FmrColr


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 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 Microsoft Access Database in Visual Basic

Article ID: Q105646

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Visual Basic for Windows, version 3.0

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

SUMMARY

=======

Microsoft Visual Basic version 3.0 for Windows incorporates the Microsoft

Access version 1.1 engine and shares dynamic-link library (DLL) files with

Microsoft Access. Therefore, Visual Basic can use Microsoft Access database

(.MDB) files.

Microsoft Access creates a system database (SYSTEM.MDA) file that stores

important security information such as user names and accounts. The system

database file can be changed only in Microsoft Access. The Visual Basic

database engine does not require a system database file unless it

interacts with an .MDB file that has the security features enabled.

MORE INFORMATION

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

If security for an .MDB file is enabled, the Visual Basic application must

run the SetDefaultWorkspace statement before the Visual Basic engine is

initialized. The SetDefaultWorkspace statement will set the User ID and

password. If the User ID and password are not set, the Visual Basic

application will access the .MDB file as a user in the Users group.

You can set the location and name of the system database file to be used by

the Visual Basic database engine by changing the SystemDB parameter in the

[Options] section of the VB.INI file. The sample VB.INI section below

demonstrates how to use the MYAPP.MDA system database file in the MYAPP

directory:

   [Options]

   SystemDb=C:\MYAPP\MYAPP.MDA

REFERENCES

==========

Microsoft Visual Basic, "Professional Features Book 2," Appendix A

Microsoft Visual Basic, "Language Reference," page 520

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ScrtOthr


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 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 CTL3D.DLL in Your MS Access Database

Article ID: Q100165

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to achieve a three-dimensional look in your

Microsoft Access database by using the CTL3D.DLL dynamic link library

(DLL). Calling CTL3D.DLL APIs gives your dialog boxes a three-

dimensional appearance.

MORE INFORMATION

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

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

creating Microsoft Access applications with the programming tools

provided with Microsoft Access. For more information on Access Basic,

please refer to the "Introduction to Programming" manual.

You can use CTL3D.DLL to add effects to the common dialog boxes and

message boxes in an Access Basic application. CTL3D.DLL does not

currently work for the controls on an Access Basic form. To use

CTL3D.DLL to enhance the common dialog boxes and message boxes in

Access Basic, follow the steps below.

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, remove or comment the

declare statement from your code.

   ' Note: Each command should be entered on one line.

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

   'GLOBAL DECLARATIONS SECTION

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

   Option Explicit

   Declare Function GetModuleHandle% Lib "Kernel" (ByVal lpModuleName$)

   Declare Function Ctl3dAutoSubClass% Lib "Ctl3D.DLL" (ByVal hInst%)

   Declare Function Ctl3dRegister% Lib "Ctl3D.DLL" (ByVal hInst%)

   Declare Function Ctl3dUnRegister% Lib "Ctl3D.DLL" (ByVal hInst%)

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

   ' The following function needs to be called when your application

   '    starts.

   ' This will register Access and subclass dialogs and message boxes

   '    with the 3D look.

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

   Function Init ()

      Dim Inst%

      Dim ret

      Inst% = GetModuleHandle("MSACCESS.EXE")

      ret = Ctl3dRegister(Inst%)

      ret = Ctl3dAutoSubClass(Inst%)

   End Function

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

   ' The following function needs to be called when your application

   '    quits.

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

   Function ShutDown ()

      Dim Inst%

      Dim ret

      Inst% = GetModuleHandle("MSACCESS.EXE")

      ret = Ctl3dUnRegister(Inst%)

   End Function

After running the Init() function from the Immediate window, an

AutoExec macro, or a RunCode macro action, you can see the three-

dimensional effects by running a macro or function that displays a

message box.

NOTE: Remember to run the ShutDown() function before quitting Microsoft

Access.

Additional reference words: 1.00 1.10 3-D

KBCategory:

KBSubcategory: PgmApi


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 PrtDevNames Property on Reports

Article ID: Q109402

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

You can use the PrtDevNames property for checking or changing the currently

connected printing device and port for specific reports.

The PrtDevNames property is not documented in the Microsoft Access manuals,

but will be documented in the manuals in a future release of the program.

MORE INFORMATION

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

The PrtDevNames property sets or returns information about the selected

printer. It is a variable-length string that mirrors the DEVNAMES structure

defined in the Microsoft Windows Software Development Kit, with the

following components:

 - DriverOffset: Specifies the offset from the beginning of the structure

   to a null-terminated string that specifies the filename (without an

   extension) of the device driver. This string is used to set which

   printer is initially displayed in the dialog box.

 - DeviceOffset: Specifies the offset from the beginning of the structure

   to the null-terminated string that specifies the name of the device.

   This string cannot exceed 32 bytes in length, including the null

   character, and must be identical to the DeviceName member of the DEVMODE

   structure. You can determine the driver name and device name by looking

   at the [DEVICES] section of the WIN.INI file.

 - OutputOffset: Specifies the offset from the beginning of the structure

   to the null-terminated string that specifies the MS-DOS device name for

   the physical output medium (the output port), for example, "LPT1:".

 - Default: Specifies whether the strings specified in the DEVNAMES

   structure identify the default printer. On input, if Default is set to 1

   and all of the values in the DEVNAMES structure match the current

   default printer, the selected printer will be set to the default

   printer. On output, Default is set to 1 if the current default printer

   has been selected.

Microsoft Access uses the DEVNAMES structure to initialize the Print Setup

dialog box. When you choose the OK button to close the dialog box,

information about the selected printer is returned in the PrtDevNames

property.

NOTE: You cannot change the PrtDevNames setting without changing the

PrtDevMode setting to your current printer settings. Some Windows printer

drivers assume that the PrtDevMode was created by that driver. If you

select a different printer driver in the PrtDevNames structure without

changing the PrtDevMode structure, Microsoft Access will pass the old

PrtDevMode structure to the new printer driver. This may cause the printer

driver to operate incorrectly and could cause Application Errors.

Additional reference words: 1.00 1.10 PtrIss

KBCategory:

KBSubcategory: PtrOthr


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 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 Fixed-Width Text Files

Article ID: Q94107

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

The information in this article applies to:

 - Microsoft Access version 1.0

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

SUMMARY

=======

This article describes the fixed-width text file format and explains how

to import this type of file.

MORE INFORMATION

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

A fixed-width text file in Microsoft Access is a file that contains

records of a fixed, consistent width. The data fields in each record

begin at fixed offsets from the beginning of the record.

You cannot import files that have variable length records that do not

contain field separators (for example, commas or tabs). These files are

not fixed-width text files. To import this kind of file, you need to first

process the file using an editor to insert field separators or to turn the

file into a true fixed-width text file by, for example, adding spaces to

each record to make all records the same width (number of characters).

Microsoft Access imports fixed-width text files by casting a record

template into the file at calculable offsets. It uses the offsets to

determine the logical beginning of each new record. Microsoft Access

determines the logical record width by scanning the first data record of

the file to locate the first carriage return and line feed (CR/LF). It

assumes that the first CR/LF marks the end of the first record (see point

three later in this article).

The data fields defined in the template come from the information you

supplied when you set up the import/export specification. Microsoft Access

uses the template to extract the individual field values. Then it enters

the field values into table and advances the template to the next record.

To import fixed-width text files successfully, they must meet the

following conditions:

1. The file must be truly fixed-width. That is, all records have the same

   width with all fields in the records beginning at consistent offsets.

2. The import/export specification you set up must match the physical

   file. Microsoft Access uses the specification to create the template

   of fields after inspecting the physical file to determine the overall

   record size. If the field template differs from the actual record size,

   you may get bad results.

   Ensure that the greatest (Offset + Width - 1) in your import/export

   specification is less than or equal to the physical record width

   excluding the CR/LF at the end of the record. In other words, an

   import/export specification that defines two fields--ID beginning at

   offset 1 for a width and of 8 and DATA beginning at offset 11 for a

   width of 50--requires your physical file to contain records of no less

   than 60 bytes (11 + 50 - 1) not counting the CR/LF. Microsoft Access

   will ignore records that have extra data beyond the last byte defined

   in the import/export specification.

3. The first record in the file must not contain embedded CR/LF

   characters. Otherwise, the Microsoft Access record size calculation

   will be wrong.

REFERENCES

==========

For more information, search for "Fixed-width text files" using the

Microsoft Access Help menu. Also, see the Microsoft Access "User's

Guide," version 1.0, Chapter 4, "Importing, Exporting, and Attaching,"

pages 72-85.

Additional reference words: 1.00 import/export keys forms

Macros Spec

KBCategory:

KBSubcategory: IsmTxtfx


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: Improved Print Merge Feature in Microsoft Access 1.1

Article ID: Q98673

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article discusses a new feature of Microsoft Access version 1.1:

the ability to directly use Microsoft Access tables in a Microsoft

Word for Windows print merge.

MORE INFORMATION

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

To use data from a Microsoft Access database in Word for Windows, the

data must be converted to a format that Word for Windows recognizes.

In Microsoft Access version 1.0, this is done by exporting the data

from Microsoft Access as text, or copying tables and queries from

Microsoft Access and pasting them into a Word for Windows document.

A new feature of Microsoft Access version 1.1 is the ability to select

Word for Windows Merge directly in the Export Data Destination dialog

box.

The following steps, performed in Microsoft Access version 1.1,

demonstrate how to convert your table into a data document for Word for

Windows:

 1. With the Database window selected, choose Export from the File menu.

 2. In the Data Destination box, choose Word for Windows Merge. Choose

    OK.

 3. Select the table that contains the information you want, and then

    choose OK.

 4. Microsoft Access will enter a default filename for export. You

    can either accept the default filename or enter a new filename,

    and then choose OK.

 5. Select the options you want in the Export Word Merge Options

    dialog box, and then choose OK.

 6. Minimize Microsoft Access and start Word for Windows.

 7. Open the main document in Word for Windows.

 8. From the File menu, choose Print Merge.

 9. Choose the Attach Data File button.

10. Select the exported text file that you created in step 4.

    NOTE: Word for Windows will only show *.DOC files by default. You

    will need to specify *.TXT files in the List Files Of Type box

    in the Attach Data File dialog box.

11. Use the Insert Merge Fields, Edit Data Field, Check, and Print

    Merge features of Microsoft Word for Windows to complete the

    document.

REFERENCES

==========

For more information on the print merge capabilities in Microsoft Access

version 1.0, query on the following words here in the Microsoft Knowledge

Base:

   access and word and merge and 1.0

Additional reference words: 1.10

KBCategory:

KBSubcategory: PtrOthr


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: Installation Process for the Companion Disk

Article ID: Q100171

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes the installation process for the Microsoft Access

Companion Disk.

MORE INFORMATION

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

The following lists a sample installation process from drive B, using the

default response:

B:\>install

**********************************************************************

*                                                                    *

*                   Microsoft Access Companion Disk                  *

*               Copyright (c) Microsoft Corporation 1993             *

*                      May 10, 1993 - Edition 1.0                    *

*                                                                    *

**********************************************************************

*                                                                    *

*  This batch program installs the companion disk to your C:\ACCESS  *

*  directory by default. If you wish to override this default        *

*  installation path, enter a new installation path on the command   *

*  line as shown below.                                              *

*                                                                    *

*  REQUIREMENTS:  3.8 MB of free hard disk space                     *

*                                                                    *

*  USAGE:  INSTALL [drive]:\[path]                                   *

*                                                                    *

*     Where [drive] is the drive letter and [path] is the directory  *

*     into which the files will be installed.                        *

*                                                                    *

*  Example:  INSTALL C:\ACCESS                                       *

*                                                                    *

**********************************************************************

.

Install into default directory (Yes/No/Cancel)? [ync]y

.

creating c:\access

.

Decompressing Sample Applications...

.

msforms.mdb (file 1 of 4)

mssweets.mdb (file 2 of 4)

mscms.mdb (file 3 of 4)

msdirect.mdb (file 4 of 4)

.

**********************************************************************

*                                                                    *

*                       INSTALLATION COMPLETE                        *

*                                                                    *

* Please load Microsoft Access to view your sample database files.   *

*                                                                    *

*         MSFORMS.MDB .... sample data entry forms                   *

*         MSSWEETS.MDB ... sample database for small businesses      *

*         MSCMS.MDB ...... sample Contact Management application     *

*         MSDIRECT.MDB ... directory of Access products & services   *

*                                                                    *

* The sample databases contained on this 'companion disk' have been  *

* provided purely as an aid to help users learn more about Microsoft *

* Access and are therefore provided 'as is'. Microsoft is unable to  *

* provide support for these samples due to the nature of their design.

*                                                                    *

**********************************************************************

B:\>

NOTE: Due to line-length restrictions in the Knowledge Base, some

spaces were removed from the ends of lines in the samples above. An

asterisk was also removed from the third from the last line for the

same reason.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: DcmNwd


INF: Installing Microsoft Access on a Diskless Workstation

Article ID: Q94010

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The third paragraph on page 658 of the Microsoft Access "User's Guide,"

version 1.0, states that a workstation that runs Microsoft Access from the

network requires 1 megabyte. This means that a workstation that has a hard

disk requires 1 megabyte of hard disk space, and a diskless workstation

requires 1 megabyte of space in the user's directory on the network--not

on the local workstation.

MORE INFORMATION

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

You can install and run Microsoft Access from a diskless workstation

as long as your workstation meets the basic requirements for running

Microsoft Access.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Appendix D, "Setting up

Microsoft Access on a Network," page 658

Microsoft Access "User's Guide," version 1.1, Appendix D, "Setting up

Microsoft Access on a Network," page 668

Additional reference words: 1.00 1.10 network requirements

KBCategory:

KBSubcategory: StpNet


INF: INSTCAT.SQL file for MS Access 1.0 Available on MSL

Article ID: Q113552

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

The information in this article applies to:

 - Microsoft Access versions 1.0

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

SUMMARY

=======

The INSTCAT.SQL file, available on the Microsoft Software Library (MSL),

contains updated ODBC stored procedures for Microsoft Access version 1.0.

This file must be installed on a SQL Server before you can access data from

that server.

SQL100.EXE, a self-extracting file, is available in the MSL on the

following services:

 - CompuServe

      GO MSL

      Search for SQL100.EXE

      Display results and download

 - Microsoft Download Service (MSDL)

      Dial (206) 936-6735 to connect to MSDL

      Download SQL100.EXE

 - Internet (anonymous FTP)

      ftp ftp.microsoft.com

      Change to the \softlib\mslfiles directory

      At the ftp prompt type (without the "ftp>"):

      ftp>binary

      ftp>get sql100.exe

MORE INFORMATION

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

The SQL100.EXE file contains the following files:

   INSTCAT.SQL -  03-04-93

   INSTCAT.48  -  10-22-92

   README.TXT  -  06-14-93

The INSTCAT.SQL file is the script file that creates catalog stored

procedures on a Microsoft SQL Server or Sybase SQL Server versions prior to

version 4.8.

Use the INSTCAT.48 file for versions of Sybase SQL Server 4.8 or higher.

If the INSTCAT.SQL script has not been properly installed, the following

error message will be displayed when you try to attach an 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.

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 line.

NOTE: You cannot use the SAF utility to install INSTCAT.SQL. 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 (< >).

   /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.

For 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 softlib

KBCategory:

KBSubcategory: GnlOthr


INF: Interoperability Questions & Answers

Article ID: Q104386

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

 WX0811: INTEROPERABILITY WITH OTHER APPLICATIONS QUESTIONS & ANSWERS

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

                                                   Revision Date: 9/93

                                                      No Disk Included

The following information applies to Microsoft Access, version 1.0,

1.1.

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

| 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) 1993 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, FoxPro, Microsoft Access, and MS-DOS are registered      |

| trademarks and Visual Basic and Windows are trademarks of Microsoft |

| Corporation.                                                        |

| Paradox and dBASE are registered trademarks of Borland              |

| International Inc.,                                                 |

| Sybase is a registered trademark of Sybase, Inc.                    |

|  -------------------------------------------------------------------|

1.  Q. When I export a Microsoft Access table to Microsoft SQL Server

       or Sybase SQL Server and then reattach it to Microsoft Access,

       I cannot edit the data. Why does this problem occur?

    A. Microsoft Access can update an attached SQL Server table only

       if the table has a unique index. However, Microsoft Access does

       not build SQL Server table indexes, unique or otherwise, when

       you export data; Microsoft Access allows you only to export

       data to SQL Server back ends. For example, if you attach the

       table immediately after exporting data to it from Microsoft

       Access, the data is displayed in Datasheet or Form view as read-

       only; therefore, updates to the exported table's data are not

       allowed.

       To work around this problem, you must create the SQL Server

       table indexes manually after you export the data from Microsoft

       Access to SQL Server. After the SQL Server indexes are created,

       you can create forms based on the attached SQL Server tables

       and update the data.

       For information on creating indexes based on SQL Server

       database tables, see the "Microsoft SQL Server System

       Administrator's Guide," or pages 67-72 in the "Microsoft SQL

       Server Language Reference."

2.  Q. How do I link a Microsoft Access table to a Microsoft Excel

       spreadsheet using dynamic data exchange (DDE)?

    A. The easiest way to use DDE is 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, highlight 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 Link.

       The formula resulting from the Paste Link command should look

       like the following example

          {=MSAccess|'NWIND.MDB;Table <Customers'>!All}

       where <Customers> is the name of the table you copied.

       For more information on linking Microsoft Access data to data

       in other applications, see the "Microsoft Access User's Guide,"

       version 1.0, Chapter 13, "Using Pictures, Graphs, and Other

       Objects," pages 337-339.

3.  Q. Are any new DDE commands included with Microsoft Access version

       1.1?

    A. Microsoft Access 1.1 supports the entire DDE functionality of

       version 1.0. In addition, it supports several new topics and

       items that allow DDE clients to do the following:

 - Open and close databases

 - Obtain the data type of a field in a table

 - Execute individual macro actions

 - Buffer and execute long SQL strings

 - Quit Microsoft Access

       For more information about the new DDE topics and items in the

       Microsoft Access 1.1 upgrade package, use Microsoft Access

       Help. To do this, use the following six steps:

       1. Press F1 to start Help.

       2. From the File menu, choose Open.

       3. In your Microsoft Access program directory, select the

          MSA110.HLP file.

       4. Choose OK. The "What's New in Microsoft Access Version 1.1"

          Help file is loaded.

       5. At the top of the selection list, choose the jump topic

          "Common Questions and Answers."

       6. Go to question #22, "How can I use Microsoft Access as a

          dynamic data exchange (DDE) server?," and select "Answer."

          You are moved to DDE Server Topics.

       To locate the DDE topics in the full Microsoft Access package,

       search for the keywords "DDE" and "Using Microsoft Access As a

       DDE Server" using the Help menu.

       For additional information about and examples of using

       Microsoft Access as a DDE Server, please obtain Technical Note

       #89586. You can order this technical note by selecting the

       FastTips Technical Library option from the FastTips Main Menu.

4.  Q. Why do the records I delete from an attached dBASE(R) table

       continue to reappear?

    A. When you delete a record in a dBASE database, the record is

       actually only marked for deletion. It is not permanently

       removed until the database is packed in dBASE.

       In dBASE, 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 SET DELETED is ON. Because of this,

       Microsoft Access continues to display records in an attached

       dBASE table, even if the records are marked for deletion.

       To prevent confusion, Microsoft Access provides functionality

       identical to the dBASE SET DELETED command. To take advantage

       of this functionality, use the following four steps:

       1. Open the MSACCESS.INI file using NOTEPAD.EXE.

       2. Find the section called [dBASE ISAM].

       3. Change the Deleted=Off setting to:

             Deleted=On

       4. Save the MSACCESS.INI file and restart Microsoft Access.

       When you view the dBASE data, records marked for deletion no

       longer appear. To permanently remove records marked for

       deletion, you must open the dBASE table in dBASE and run the

       PACK command.

5.  Q. When I attempt to import or attach Btrieve files, why do I

       receive the error message "Couldn't find object <table name>"?

    A. Microsoft Access uses the FILE.DDF file to determine the

       location of the Btrieve data file. The path statements in

       FILE.DDF may not be correct for the current environment. You

       should verify that the path is correct in the FILE.DDF file.

       For additional information on how to resolve this problem,

       please obtain Technical Note #93685. You can order this

       technical note by selecting the FastTips Technical Library

       option from the FastTips Main Menu.

6.  Q. Should I use Microsoft Access or Microsoft FoxPro(R) as my

       database solution?

    A. Microsoft FoxPro is the best database solution for users and

       developers of Xbase products, for developers who need a cross-

       platform solution, and for all customers who can benefit from

       FoxPro's incredible speed and unequaled development

       environment.

       Microsoft Access is the best database solution for users who

       need seamless access to data in multiple formats, for users who

       are not professional programmers but need to develop powerful

       database applications, and for users and developers who need

       the most productive development environment to design decision-

       support systems.

7.  Q. What are the differences between Microsoft Access and Microsoft

       Visual Basic(TM)? Does Microsoft Access support custom controls

       designed for Visual Basic? Do these two applications use the

       same or different programming languages?

    A. While Microsoft Access and Visual Basic share the same basic

       programming concepts (an event-driven programming model, visual

       interface creation, and so forth), each has different

       specialties.

       Visual Basic version 3.0 is a general-purpose programming

       environment, which uses visual tools that allow software

       developers to design both database applications and other

       applications. Visual Basic has a more granular event model than

       Microsoft Access and supports custom controls.

       Microsoft Access is a programmable database designed

       specifically for creating and running database applications.

       Its rich set of tools allows you to create many database

       applications without programming. Microsoft Access supports

       database-oriented events, such as FindRecord and OnUpdate,

       rather than Visual Basic-like properties and events, such as

       MouseMove and MinButton. Microsoft Access currently does not

       support custom controls.

       The nature and syntax of Access Basic and Visual Basic are very

       similar, but not identical. Access Basic supports database

       commands and methods, such as CreateDynaset and Clone. Visual

       Basic supports properties and events, such as PathChange and

       MouseUp, that Access Basic does not have. However, the many

       similarities between Access Basic and Visual Basic allow you to

       move between the two products easily.

Additional reference words: 1.00 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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: 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: 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 1.0 Disk Contents (3.5 inch, 1.44 MB)

Article ID: Q94114

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

The information in this article applies to:

 - Microsoft Access versions 1.0

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

SUMMARY

=======

The following lists the directory contents for each disk shipped

with Microsoft Access version 1.0 (3.5 inch, 1.44 MB).

MORE INFORMATION

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

Disk 1

------

Volume Label: DISK1

1        WMF      4470 10-25-92  12:00a

1E       WMF      4022 10-25-92  12:00a

BTRVISAM DL$     57918 10-25-92  12:00a

COMMDLG  DL$     46406 10-09-92  10:02a

COMMDLG  DL_     89248 10-25-92  12:00a

CTL3D    DL$      7524 08-16-92   7:35p

DBSISAM  DL$    135919 10-25-92  12:00a

DDEML    DL$     20305 03-10-92   3:10a

DETCMD   DL_     24128 10-25-92  12:00a

MSACCESS IN$       519 10-25-92  12:00a

MSACCESS RE$       552 10-25-92  12:00a

MSAIN100 DL$     71625 10-25-92  12:00a

MSAJU100 DL$     38945 10-25-92  12:00a

OLECLI   DL$     41083 10-09-92  10:02a

OLESVR   DL$     13129 10-09-92  10:02a

ORDENTRY TX$      2281 10-25-92  12:00a

ORDENTRY HL$     14224 10-25-92  12:00a

ORDENTRY MD$    200396 10-25-92  12:00a

PIM      HL$      8119 10-25-92  12:00a

SETUP    EXE     21472 10-25-92  12:00a

SETUP    INI       149 11-25-92  10:51a

SHARE    EX$      8112 10-09-92  10:02a

SHELL    DL$     23296 10-09-92  10:02a

SMALLB   FO$      9687 03-06-92   7:16p

SMALLE   FO$     11236 03-06-92   7:16p

SMALLF   FO$      9376 03-06-92   7:16p

STFSETUP EX_    477376 10-25-92  12:00a

STFSETUP IN_     56427 10-25-92  12:00a

VER      DL$      5653 10-09-92  10:02a

VER      DL_      9008 10-25-92  12:00a

WORKGRP  IN_      1393 10-25-92  12:00a

       31 file(s)    1413998 bytes

Disk 2

------

Volume Label: DISK2

2        WMF      8022 10-25-92  12:00a

2E       WMF      6870 10-25-92  12:00a

MSACCESS HL$   1189376 10-25-92  12:00a

PDXISAM  DL$    106830 10-25-92  12:00a

REGEDIT  EX$     18176 10-09-92  10:02a

WBTRCALL DL$     30679 10-25-92  12:00a

        6 file(s)    1359953 bytes

Disk 3

------

Volume Label: DISK3

3        WMF      8950 10-25-92  12:00a

3E       WMF      8470 10-25-92  12:00a

MSABC100 DL$    187802 10-25-92  12:00a

MSAES100 DL$     16899 10-25-92  12:00a

MSAFIN   DL$     18553 10-25-92  12:00a

WIZARD   MD$    174297 10-25-92  12:00a

MSACCESS EX$    790199 10-25-92  12:00a

        7 file(s)    1205170 bytes

Disk 4

------

Volume Label: DISK4

4        WMF      8246 10-25-92  12:00a

4E       WMF      7766 10-25-92  12:00a

ANALYZER MD$     49740 10-25-92  12:00a

MSAJT100 DL$    338672 10-25-92  12:00a

NEWCUST  DB$      1212 10-25-92  12:00a

NWIND    MD$    555226 10-25-92  12:00a

PIM      MD$    109267 10-25-92  12:00a

SYSTEM   MD$     98863 10-25-92  12:00a

UTILITY  MD$     47055 10-25-92  12:00a

WINHELP  EX$    147911 10-09-92  10:02a

WINHELP  HL$     28161 10-09-92  10:02a

       11 file(s)    1392119 bytes

Disk 5

------

Volume Label: DISK5

5        WMF      4662 10-25-92  12:00a

5E       WMF      4150 10-25-92  12:00a

CBTLIB4  DL$     11179 10-25-92  12:00a

CUECARD  EX$     60269 10-25-92  12:00a

CUECARDS DL$      2047 10-25-92  12:00a

CUECARDS LE$    887544 10-25-92  12:00a

GRAPH    EX$    364877 10-09-92  10:02a

MSGRAPH  HL$    110291 10-09-92  10:02a

        8 file(s)    1445019 bytes

Disk 6

------

Volume Label: DISK6

6        WMF      5846 10-25-92  12:00a

6E       WMF      5366 10-25-92  12:00a

MSACCES2 HL$   1133393 10-25-92  12:00a

PSSKB    TX$      7951 10-25-92  12:00a

README   TX$      9465 10-25-92  12:00a

ERRATA   TX$      9805 10-25-92  12:00a

        6 file(s)    1171826 bytes

ODBC Installation Disk

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

Volume Label:  ODBC

DBNMP3   DLL      8241 10-22-92   3:06p

INSTCAT  SQL     93796 10-25-92  12:00a

MSCOMSTF DLL     74528 10-25-92  12:00a

MSDETSTF DLL     24544 10-25-92  12:00a

MSINSSTF DLL     65440 10-25-92  12:00a

MSSHLSTF DLL     14928 10-25-92  12:00a

MSUILSTF DLL      6144 10-25-92  12:00a

ODBC     DLL     44736 10-25-92  12:00a

ODBC     INF      1226 10-25-92  12:00a

ODBCADM  EXE      9136 10-25-92  12:00a

ODBCADM  HLP      4942 10-25-92  12:00a

ODBCINST DLL      6016 10-25-92  12:00a

SETUP    EXE     54464 10-25-92  12:00a

SETUPI   DLL     44032 10-25-92  12:00a

SQLSETUP DLL     11024 10-25-92  12:00a

SQLSRVR  DLL    135792 10-25-92  12:00a

VER      DLL      9008 10-22-92   3:06p

LANMAN21     <DIR>     10-25-92  12:00a

       18 file(s)     607997 bytes

Windows For Workgroups Driver Disk

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

Volume Label: WFWDRV

WFWDRV   EXE     23581 11-02-92   3:11a

WFWNET   DR_    165600 11-02-92   3:11a

        2 file(s)     189181 bytes

Additional reference words: 1.00

KBCategory:

KBSubcategory: StpOthr


INF: Microsoft Access ADK Legal Agreement

Article ID: Q101311

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

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

This article provides additional information about the legal restrictions

on distributing applications developed with the Microsoft Access

Distribution Kit (ADK).

MORE INFORMATION

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

Pages v and vi of the Microsoft Access "Distribution Kit Guide" include

a list of provisions that define what developers may distribute:

1. You may distribute these files only as integrated within and as a

   part of your software product which operates in conjunction with

   Microsoft Access.

   Explanation: This clause means that you may distribute only the

   runtime files with your Microsoft Access application. You cannot

   purchase the ADK and then distribute individual files. This also

   applies to the ODBC disk as well.

   Example: An employee at a large company purchases the ADK. Her manager

   has accidentally removed Graph. Mary gives her manager a copy of the

   run-time Graph application that comes with the ADK. This action is a

   violation of the license agreement. Mary may ONLY distribute files as

   part of a database application.

2. Your software product does not substantially duplicate the

   capabilities of Microsoft Access or, in the reasonable opinion of

   Microsoft, compete with Microsoft Access.

   Explanation: Developers cannot use the ADK to create a database

   application to compete with Microsoft Access. However, it is alright

   for developers to create custom applications based on Microsoft

   Access. If developers believe they might be in competition with

   Microsoft Access, they should contact the Microsoft Access Product

   Manager.

   Example 1: John uses the ADK to create a form designer, report

   designer, and query grid that look almost identical to and have the

   same functionality as Microsoft Access. He then sells this application

   to users as "an inexpensive alternative to Microsoft Access." This

   would be a direct violation of the license agreement.

   Example 2: Jane works at a company that uses SQL Server extensively

   and has purchased the ADK. She designs several forms that allow the

   user to connect to various SQL servers and "query by example." She

   creates a custom Setup that includes both the ODBC Setup disk and the

   run-time Graph application. She runs an administrative Setup to a

   network drive so that anyone in the company can set up her

   application. Because her company has purchased a copy of the ADK and

   she is only distributing files as part of a database application she

   has developed, this is legal.

3. You do not use Microsoft's name, logo, or trademarks to market your

   software product.

   Explanation: This simply means that you may not use the name and logo

   of Microsoft as though your application were a Microsoft product.

   Developers can use Microsoft Access (R) if it is used properly with a

   registered trademark symbol (subject to normal trademark laws) and if

   it is used only in a description of the product.

   Developers are encouraged to inform their customers that the product

   is based on Microsoft Access. However, Microsoft cannot guarantee,

   recommend, or provide support for products developed with the ADK.

   Example: Dana has developed an application that she intends to sell to

   other developers. The front of the box in which her application is

   packaged reads as follows:

                       AX Utilities

                    Secure Screen Savers

       An Application for Use with Microsoft Access (R)

      Requires: 4 MB hard disk space (1.5 MB if you have already

      installed another application for Microsoft Access)

   Because the proper registered trademark appears and "Microsoft Access

   (R)" is included only in the description of her application, this use

   is legal under the license agreement.

4. You include a valid copyright notice on your software product.

   Explanation: A copyright notice is required before you can distribute

   a database application that you develop with the ADK.

   Example: Roger has developed a game using the ADK. He plans to post it

   on the bulletin board that he operates so that others can download it

   for free. He does tell readers that the game was developed using

   Microsoft Access (R) but does not include a copyright notice. This

   is not legal because he does not have a valid copyright notice.

5. You agree to display, if required in the software documentation,

   the designated patent notices on the packaging and in the READ file of

   your software product.

   Explanation: This is part of the standard Microsoft license agreement.

   Any items requiring a patent notice are so indicated in the product

   documentation or the product READ file.

REFERENCES

==========

Microsoft Access "Distribution Kit Guide," version 1.1, pages v and vi

Additional reference words: 1.10

KBCategory:

KBSubcategory: DcmOthr


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 Companion Disk Contents (3.5 in. 1.44MB)

Article ID: Q100170

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

The following lists the directory contents of the Microsoft Access

Companion Disk that was sent to registered users of Microsoft

Access version 1.0 when version 1.1 was released:

COMPRESS   EXE   25563    03-02-90   1:13p

INSTALL    BAT   4677     05-11-93   7:48a

MSCMS      MD$   622969   05-10-93   6:34p

MSDIRECT   MD$   141957   05-10-93   1:47p

MSFORMS    MD$   108739   05-11-93   7:22a

MSSWEETS   MD$   186343   05-10-93   1:51p

YNC        EXE   13023    03-15-91   2:42p

        7 file(s)    1103271 bytes

Note that the contents of this disk can be obtained from CompuServe in

the MSACCESS forum, Library 14, file COMPAN.ZIP. Although this disk

was released only on 3.5-inch, 1.44 MB disks, it can be downloaded and

fit onto a 5.25-inch, 1.2 MB disk.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlApp


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 Performance Enhancement Recommendations

Article ID: Q93684

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

You can improve the performance of Microsoft Access by altering the memory

configuration on your computer. This article lists several tips that you

can use to enhance the performance of Microsoft Access on a computer with 4

MB of memory.

MORE INFORMATION

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

The following tips can be used to enhance the performance of Microsoft

Access versions 1.0 and 1.1 on computers with 4MB of RAM:

 - Do not use any of your RAM for a RAM disk.

 - Use a maximum of 512K for SMARTDrive or other disk caches.

 - Set your network installation to use less than 200K of RAM, if possible.

 - Do not run several other applications that require large amounts of

   memory. Running even one other large application (such as a spreadsheet,

   word processor, or alternate desktop manager such as Norton Desktop for

   Windows) can significantly degrade the performance of Microsoft Access.

 - Run Windows in standard mode.

 - Set the maxbuffersize entry under the [isam] section in the MSACCESS.INI

   file to a value less than 512. In low memory cases this will help, even

   though less memory will be used by Microsoft Access for buffering

   database I/O. (See the Microsoft Access README.TXT file for details on

   setting this value.)

 - Open databases as exclusive and read-only, if possible.

 - If you do not want to use Access Wizards, you can disable them by

   removing the line "WIZARD.MDA=RO" from the [Libraries] section of the

   MSACCESS.INI file. This frees up over 300K of RAM, but takes away the

   ability to use Access Wizards.

 - Keep the number of Windows accessory applications running to a minimum.

 - If you have a full-screen background bitmap (or "wallpaper") on your

   Windows desktop, replace it with a smaller bitmap, or no bitmap at all.

   For a standard VGA video display, this frees about 256K. For a 1024x768

   256 color display, this can free about 3/4 of a megabyte. (Your actual

   memory savings may vary, depending on the display.)

 - Keep in mind that CD-ROM device drivers, sound board drivers, screen

   savers, MIDI drivers, multi-media support drivers, and other drivers

   take extra memory. The 4 MB recommendation does not take this into

   account. If you need to have several drivers running under Windows, then

   more memory than 4 MB will be required for Microsoft Access to run

   efficiently.

The 4 MB RAM recommendation was based on a 386/20 computer, MS-DOS 5.0,

unmodified Windows 3.1, VGA display, mouse, and network workstation

software. If your configuration is similar to, or better than this, you

will get good performance. (This has been verified by benchmarks with

Microsoft Access fully installed.) However, if your system's configuration

is more sophisticated, you will require more memory for peak Microsoft

Access performance.

Additional reference words: 1.00 1.10 optimize speed 4meg

KBCategory:

KBSubcategory: GnlOthr


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: Misleading Documentation for Cancel Property

Article ID: Q96462

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

The information in this article applies to:

 - Microsoft Access version 1.0

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

SUMMARY

=======

The documentation for the Cancel property, as well as for the term

"Cancel," is misleading. It implies that the purpose of the Cancel

property is to allow you to select a Yes button to enable Cancel and

thus undo the current record (just as if you chose the Undo Current

Record command from the Edit menu).

This is not true; the Cancel property actually plays a much smaller

role.

MORE INFORMATION

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

In Microsoft Access version 1.0, the Help topic for "Cancel Property"

states:

   Use the Cancel property to give the user the option of canceling

   uncommitted changes and returning the form to its previous state.

The Microsoft Access "Language Reference" manuals for versions 1.0 and

1.1 contain the same misleading wording on page 59.

NOTE: The help topic was corrected for version 1.1.

The actual purpose of the Cancel property is to execute the Cancel

button's OnPush property when you press the ESC key from anywhere on the

form.

Additional reference words: 1.00

KBCategory:

KBSubcategory: FmsEvnt


INF: MS Access Cannot Attach or Import Paradox 4.0 Tables

Article ID: Q93699

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Microsoft Access supports attaching and importing from Paradox 3.x tables.

Microsoft Access does not support attaching Paradox 4.0 tables. If you

attempt to attach a version 4.0 table, you will be prompted for a password.

This also applies to Paradox 1.0 for Windows files.

MORE INFORMATION

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

If you are prompted to enter a password when you attach to a Paradox

table, and you know that there is no password for the table, it is

possible the table is a Paradox 4.0 file.

NOTE: These directions apply to Paradox 4.0 only; these directions do

not apply to Paradox for Windows.

To use data created in Paradox 4.0, use Paradox to restructure the table in

version 3.5 format. Paradox provides the capability to create files in

Compatible format; this will create files in version 3.5 format.

In Paradox, you can save a Paradox 4.0 table in version 3.5 format by

following these steps:

1. Copy the Paradox 4.0 table.

2. In Paradox, run the Modify/Restructure menu command.

3. Enter the name of the table.

4. Choose FileFormat/Compatible from the menu.

5. Press F2 to save the file in the restructured format.

For more information on restructuring Paradox tables, see the Paradox 4.0

documentation.

Paradox is manufactured by Borland International, 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

KBCategory:

KBSubcategory: IsmPdox


INF: MS Access Distribution Kit Questions & Answers

Article ID: Q104385

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

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

        WX0867: ACCESS(R) DISTRIBUTION KIT QUESTIONS & ANSWERS

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

                                                   Revision Date: 9/93

                                                      No Disk Included

The following information applies to Microsoft Access, version 1.1.

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

| 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) 1993 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

| --------------------------------------------------------------------|

1.  Q. My machine appears to hang when I first run the SUFILES utility

       (SUFILES.EXE), whether I start the SUFILES utility by double-

       clicking the SUFILES icon or by selecting SUFILES from the

       first dialog box after starting the Microsoft Access

       SetupWizard. My mouse pointer does not switch from pointer to

       hourglass to indicate that the program is still processing. The

       progress meter remains at 0% and I do not see any hard disk

       activity. Why does this occur?

    A. The program is not hung; it just does not update the screen

       regularly. The screen eventually updates, allowing you to see

       the program's progress. This behavior is by design so that you

       can choose the Cancel button at any time.

       The amount of time the SUFILES.EXE file takes to run varies,

       depending on the machine type and the amount of memory. Average

       completion time is approximately 20 minutes. For example, using

       a 486/50 machine with 16 megabytes (MB) of memory, the process

       takes approximately 10 minutes to complete; using a 386/16

       machine with 4 MB of memory, the process takes approximately 45

       minutes.

       You need to run SUFILE.EXE only once. SUFILE.EXE compresses

       files from the various directories, including the Windows and

       Access program directories, into a subdirectory called SUFILES.

       When you build your distribution disks, the SetupWizard needs

       only to copy the compressed files to the disk directories and

       does not have to recompress all the files each time

       distribution disks are built.

2.  Q. At the end of the Microsoft Access installation process, why

       does Custom Setup hang immediately after the SETUP.EXE file

       creates the program group?

    A. This problem occurs only when you choose to have the Change

       Workgroups icon installed but have not specified an icon for

       the application.

       To correct this problem, run the SetupWizard again. When the

       "Where are your application's initialization, icon, and Help

       files located?" dialog box appears, select an icon file from

       the .ICO File (Optional) list box.

       You can also manually modify the STFSETUP.IN_ file. For

       information on modifying the STFSETUP.IN_ file, please refer to

       the "Microsoft Access Distribution Kit Guide," Chapter 3,

       "Creating Your Custom Setup Program."

 3. Q. How can I prevent other users from seeing my code?

    A. You can control what users of your application see by taking

       the following precautions:

        - Using forms and macros to control a user's movements within your

          database

        - Securing the objects in your database

        - Encrypting your database

4.  Q. What is the best way to distribute updates of my application to

       other users?

    A. The best way to distribute updates of your application is by

       creating two databases: one database (DATA.MDB) to store the

       application's data, the other database (PROGRAM.MDB) to store

       the application's forms and other objects. This method

       simplifies your application updates, since you can redistribute

       an updated PROGRAM.MDB file (containing updated queries, forms,

       reports, macros, and modules) without destroying your user's

       data.

       All objects in the PROGRAM.MDB file should be based on attached

       tables from the DATA.MDB file. When you create a database with

       attached tables, the specific path to these tables is stored in

       the database. If the path to these tables changes, you receive

       the "Couldn't find table <table name>" error message. To avoid

       this problem, have your AutoExec macro, which the Access

       Distribution Kit (ADK) requires, call an Access Basic function

       to verify that the attached tables are indeed attached. If the

       tables for some reason are not attached, your function attaches

       them automatically.

       When you start your application, make sure that the

       application's working directory property is set to be the same

       directory in which the .MDB file is located. The SetupWizard

       automatically sets this property in Program Manager. Use the

       CurDir() function to determine the directory from which the

       application is being executed, then attach the files from that

       directory.

5.  Q. Why do I get a general protection (GP) fault when I run my

       application's Custom Setup program?

    A. Running Setup in Windows standard mode causes a GP fault. You

       should run Setup in 386 enhanced mode. To start Windows in 386

       enhanced mode, type the following command at the MS-DOS prompt:

          win /3

       Once Setup is complete, your application will run correctly in

       Windows standard mode.

6.  Q. When I start the run-time version of my application, the

       following error message is displayed:

          A run-time error occurred in module: <module name>. You

          don't have permission to view this module.

       Why do I get this error message?

    A. This error message appears when a run-time error occurs in one

       of your modules. When this problem occurs in the retail package

       of Microsoft Access, the module is opened and the line of code

       that caused the error is selected. Because the run-time version

       of the application cannot open the module nor display the line

       causing the error, the previous error message is displayed.

       To correct this problem, open your application in the full

       retail package of Microsoft Access and correct the error in

       your code from there.

 7. Q. I split my database into two files using the COMPRESS.EXE

       utility. After running Custom Setup, I am unable to open my

       database file. How do I put the two .MDB files back together?

    A. Once a database file has been split into two files, you must

       use entries in the Custom Setup Information file, STFSETUP.IN_,

       to rejoin the files. The following steps give an example of how

       to combine two fictitious files, called MYAPP.MD$ and

       MYAPP2.MD$, into one file, called MYAPP.MDB:

       1. Open the STFSETUP.IN_ file in NOTEPAD.EXE or other text

          editor.

       2. In the [Standard Setup Files] section of the STFSETUP.IN_

          file, change the following line

              3 , MYAPP2.MD$, RENAME=MYAPP2.MDB, DEST=$(AppPath)

          to

              3 , MYAPP2.MD$, APPEND=MYAPP.MDB, DEST=$(AppPath)

           NOTE: If your database file was split into more than two

           files, make similar changes for each entry in the

           STFSETUP.IN_ file.

       3. Make similar changes to the [Network Setup Files] and/or the

          [Multiuser Files] sections for any server installations of

          your application.

Additional reference words: 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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: 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 Form Caption in Run-Time Application

Article ID: Q109937

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

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

If you build an application to be distributed, make sure to include the

TitleBar statement in the [Run-Time Options] section of your application's

.INI file. If you do not, the title bar in your application will not

display a caption. Additionally, no caption will be displayed when a

table, query, form, or report is maximized.

MORE INFORMATION

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

The following example demonstrates how to correctly modify the

[Run-Time Options] section of your application's .INI file:

1. Use a text editor such as Notepad to modify the [Run-Time Options]

   section of your application's .INI file to match the following:

      [Run-Time Options]

      TitleBar=This Is My Application

2. Run your application.  Note that the application title bar

   displays the caption:

      This Is My Application

3. Maximize an object such as a table, query, form, or report. Note that

   the application title bar displays the caption:

      This Is My Application - [xxxxxx]

4. Close your application.

5. Modify the [Run-Time Options] section of your application's .INI

   file to match the following:

      [Run-Time Options]

      ;TitleBar=This Is My Application

   The semicolon comments out the line so it is ignored.

6. Run your application again.  Note that the application's title bar is

   empty.

REFERENCES

==========

Microsoft Access "Distribution Kit Guide," version 1.1, "Custom

Initialization (.INI) File," pages 5-7

Additional reference words: 1.10 adk runtime title caption

KBCategory:

KBSubcategory: FmsOthr


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: Northwind 'Sales Totals by Amount' Report Is Incorrect

Article ID: Q94043

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

The report named "Sales Totals by Amount" included in the sample

database Northwind Traders (NWIND.MDB) does not work correctly. The

report uses the Conditional Page Break macro to print 10 lines on each

page of the report. This works properly for only the first page

because the counter on the report is not being reset. To enable this

to work correctly, you must change the Conditional Page Break macro.

In the macro named Show Break within the macro Conditional Page Break,

you must change the Condition to read as follows:

   [COUNTER] MOD 10 = 0

This will now perform a page break after every 10 lines of the report

for every page.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: DcmNwd


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: Nulls Allowed in Foreign Key with Referential Integrity

Article ID: Q98789

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Microsoft Access allows a Null value in a field that is the foreign

key in a relationship if referential integrity is enforced.

To prevent users from leaving the foreign key blank, add a table level

validation rule to the table on the many side of the relationship. For

example...

MORE INFORMATION

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

Steps to Reproduce Behavior

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

1. Open the sample database NWIND.MDB.

2. From the Edit menu, choose Relationships.

3. Under Primary Table, select Customers. Under Related Table, select

   Orders.

   Note the following:

   a. The PrimaryKey Fields and Select Matching Fields both display

      "Customer ID".

   b. The Enforce Referential Integrity check box is checked.

   c. The Add button is unavailable.

   These characteristics indicate an existing relationship between

   Customers and Orders tables; thus, you will not be able to make an

   entry in the Customer ID field of the Orders table if that Customer

   ID does not exist in the Customers table.

4. Close the Relationships dialog box and open the Orders table.

5. Change the Customer ID field of the first order to "XXXX" and press

   TAB to try to move to the next record. You receive the error message:

      Can't add or change record. Referential Integrity rules require

      a related record in the table "Customers."

6. Choose OK.

7. Delete the entry in the Customer ID field. Make sure the field is

   completely empty. Press TAB to move to the next record.

REFERENCES

==========

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

Additional reference words: 1.00 1.10 null compact cascade

KBCategory:

KBSubcategory: GnlApp


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 Disk Contents (1/14/93, 3.5-Inch, MS Access 1.0)

Article ID: Q100158

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

The information in this article applies to:

 - Microsoft Access version 1.0

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

SUMMARY

=======

The following lists the contents of the ODBC disk shipped with

Microsoft Access version 1.0 (release date 1/14/93, 3.5-inch, 1.44

MB).

The WBTRCALL.DLL file was removed from the original release of

Microsoft Access version 1.0. Because of this, the SETUP.EXE program

was changed. No Microsoft Access functionality was changed for this

release.

MORE INFORMATION

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

Disk Contents

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

DBNMP3   DLL      8241 10-22-92   3:06p

INSTCAT  SQL     93796 01-04-93  12:00a

MSCOMSTF DLL     74528 01-04-93  12:00a

MSDETSTF DLL     24544 01-04-93  12:00a

MSINSSTF DLL     65440 01-04-93  12:00a

MSSHLSTF DLL     14928 01-04-93  12:00a

MSUILSTF DLL      6144 01-04-93  12:00a

ODBC     DLL     44736 01-04-93  12:00a

ODBC     INF      1226 01-04-93  12:00a

ODBCADM  EXE      9136 01-04-93  12:00a

ODBCADM  HLP      4942 01-04-93  12:00a

ODBCINST DLL      6016 01-04-93  12:00a

SETUP    EXE     54464 01-04-93  12:00a

SETUPI   DLL     44032 01-04-93  12:00a

SQLSETUP DLL     11024 01-04-93  12:00a

SQLSRVR  DLL    135792 01-04-93  12:00a

VER      DLL      9008 10-22-92   3:06p

7        WMF      5846 01-04-93  12:00a

7E       WMF      5366 01-04-93  12:00a

WFWDRV   TXT      2134 01-04-93  12:00a

WFWDRV   EXE     23581 01-04-93  12:00a

WFWNET   DR_    165600 01-04-93  12:00a

LANMAN21     <DIR>     01-04-93  12:00a

       23 file(s)     810524 bytes

Additional reference words: 1.00

KBCategory:

KBSubcategory: StpOthr


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: Older Versions of Shared DLLs Cause MS Access Problems

Article ID: Q90863

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Shared dynamic-link libraries (DLLs) in your system older than those

supplied with Microsoft Access version 1.0 or Microsoft Windows

version 3.1 can cause unexpected errors with Microsoft Access.

To avoid problems, make sure that all shared DLLs are at least as

current as those supplied with Microsoft Windows version 3.1 or

Microsoft Access version 1.0, and that they are all located in the

WINDOWS\SYSTEM directory.

MORE INFORMATION

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

The shared DLLs used by Microsoft Access are:

   COMMDLG.DLL   89248 bytes   3/10/92   Windows 3.1

   COMMDLG.DLL   89248 bytes   10/25/92  Access 1.0

   COMMDLG.DLL   89248 bytes   5/21/93   Access 1.1

   COMMDLG.DLL   97984 bytes   10/1/92   Windows for Workgroups

   OLECLI.DLL    83456 bytes             Same for all

   OLESVR.DLL    24064 bytes             Same for all

   DDEML.DLL     36864 bytes   3/10/92   Windows 3.1

   DDEML.DLL     36964 bytes   10/25/92  Access 1.0

   DDEML.DLL     36964 bytes   5/21/93   Access 1.1

   DDEML.DLL     38400 bytes   10/1/92   Windows for Workgroups

   SHELL.DLL     41600 bytes   3/10/92   Windows 3.1

   SHELL.DLL     41600 bytes   10/25/92  Access 1.0

   SHELL.DLL     41600 bytes   5/21/93   Access 1.1

   SHELL.DLL     41520 bytes   10/1/92   Windows for Workgroups

   VER.DLL        9008 bytes             Same for all

(These DLLs are used by Windows applications other than Microsoft

Access, as shown above. The DLLs for which no date is provided are the

same for all applications.)

Microsoft Access supplies the same DLL versions as Windows 3.1, and it

requires these (or newer) versions for correct operation; older

versions can cause errors.

Microsoft Access and Windows copy shared DLLs into the WINDOWS\SYSTEM

subdirectory, and that is where Microsoft Access first looks for them.

If it does not find one or more of the shared DLLs, it looks in the

directory where Microsoft Access is installed, and then in the current

directory.

Often, Microsoft Access finds outdated or incorrect DLLs because

third-party software with old or foreign DLLs has been installed or

reinstalled, overwriting the correct DLLs. Some third-party software

packages copy DLLs into directories other than WINDOWS\SYSTEM,

creating multiple copies and making the problem harder to track and

resolve.

Microsoft Access will not reload DLLs previously loaded by another

software package; it will only load shared DLLs not already loaded. If

the previously loaded DLLs are incorrect, they can cause problems with

Microsoft Access.

If the Microsoft Access Setup program fails to locate a shared DLL, or

detects an older version of one, it issues an error message such as:

   Outdated XXXX.DLL found. Please reinstall MSAccess.

   -or-

   Can't find XXXX.DLL.

Additional reference words: 1.00 1.10 WinIss

KBCategory:

KBSubcategory: EvnOs


INF: OLE: New Graph Object Frames are Blank

Article ID: Q89607

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SYMPTOMS

========

When you create an unbound graph on a form or report it will appear as a

blank object frame until you either view the form in Form view or print

or preview the report.

CAUSE

=====

Microsoft Access does not run the query that an unbound graph is based on

until the form is viewed in Form view or the report is printed or

previewed. Until the query is run, the object frame will remain blank.

STATUS

======

This behavior is by design.

MORE INFORMATION

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

Steps To Reproduce Behavior

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

1. Open the sample database NWIND.MDB.

2. Click the New Form button on the toolbar.

3. In the Select A Table/Query box, select Category Sales For 1991.

4. Choose the FormWizards button.

5. Select Graph, and then choose OK.

6. Choose Next to accept the default graph.

7. Choose the ">>" button, and then choose Next.

8. Choose the Design button. Note that the object frame is blank.

9. View the form in Form view. The underlying query will run, and then

   the graph will be displayed.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IntpGrph


INF: OnCurrent Is Not Triggered on Unbound Forms

Article ID: Q88131

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

The information in this article applies to:

 - Microsoft Access version 1.0

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

SUMMARY

=======

If a form is unbound, macros or modules bound to the form's OnCurrent

property will not run. In order to modify properties that can be changed

at run time, the macro or module must be bound to either the OnOpen

property of the form or the OnEnter property of the first control in the

tab order of the form.

MORE INFORMATION

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

You can use the OnOpen property to trigger a macro or module each time

a form is opened. Changes made to properties such as Visible will

occur before the form is displayed. This allows you to make changes

that your application's users do not see.

If, however, you want users to see the changes taking place, the

macro must be run after the OnOpen property.

The following example creates a simple form with two text boxes. The

macro that is triggered automatically sets the Visible property of the

text box to Yes and No alternately so that it appears to flash several

times when the form is opened. Note that you cannot change the Visible

property of a control that is currently selected, so there must be at

least one other object on your form to select:

1. Create a new, unbound form.

2. Place a text box on the form, and give the text box the following

   properties:

      ControlName: Text0

      ControlSource: Hello World

3. Please a second text box on the form, and give it the following

   property:

      Control name: Text2

4. Save the form as Flash.

5. Create a new macro, and then choose Macro Names from the View menu.

6. Add the following macro names and actions, and then save the macro

   group as Flashing Macros:

      Macro Name   Action

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

      Repeat It    GoToControl

                   RunMacro

      Flash        SetValue

                   RepaintObject

                   SetValue

                   RepaintObject

      Repeat It Actions

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

      GoToControl

         Control Name: Text2

      RunMacro

         MacroName: Flashing Macros.Flash

         Repeat Count: 10

      Flash Actions

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

      SetValue

         Item: Forms![Flash]![Text0].Visible

         Expression: No

      RepaintObject

         Object Type: Form

         Object Name: Flash

      SetValue

         Item: Forms![Flash]![Text0].Visible

         Expression: Yes

      RepaintObject

         Object Type: Form

         Object Name: Flash

7. View the Flash form in Design view. Set the form's OnOpen property

   to:

      Flashing Macros.Repeat It

8. Save and then close the form. Open the form in Form view.

Additional reference words: 1.00

KBCategory:

KBSubcategory: FmsEvnt


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 the ORACLE ODBC Driver (1.x)

Article ID: Q95921

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

The information in this article applies to:

 - Microsoft Access version 1.1

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

SUMMARY

=======

This article presents a brief overview of the ORACLE relational

database management system (RDBMS) and the ORACLE Open Database

Connectivity (ODBC) driver.

MORE INFORMATION

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

ORACLE RDBMS is a multiuser relational database management system that

runs with various workstation and minicomputer operating systems. The

IBM-PC and compatible computers running Microsoft Windows can

communicate with ORACLE database servers over a network. Supported

networks include Microsoft LAN Manager, NetWare, VINES, DECnet, and

any network that supports TCP/IP.

The ORACLE driver enables an application to access data in an ORACLE

database through the ODBC interface. The driver communicates with the

network through SQL*Net. The following diagram details the application

and driver architecture:

                          Application

                               :

                               :

                      ODBC Driver Manager

                           (ODBC.DLL)

                               :

                               :

                         ORACLE Driver

                          (SQORA.DLL)

                               :

                               :

                         SQL*Net Driver

                               :

                               :

                        Network Software

               (LAN Manager, NetWare, and so forth)

                               :

                               :

                        SQL*Net Listener

                               :

                               :

                          ORACLE RDBMS

The ORACLE driver complies with API Conformance Level 1 and SQL

Conformance Level Core. The ORACLE driver also supports some functions

in API Conformance Level 2 and most of the grammar in the Core and

Extended SQL conformance levels.

To access ORACLE data, the following components are required:

 - The ORACLE driver

 - An ORACLE RDBMS database

 - A network that connects the computers that run the driver and the

   database. The network must support SQL*Net connections.

The following section describes the hardware and software that each

component requires.

ORACLE Driver

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

The ORACLE driver requires an Industry Standard Architecture (ISA)

computer, such as the IBM PC/AT or compatible, a Micro Channel

Architecture (MCA) computer, such as an IBM PS/2 or compatible, or an

Extended Standard Architecture (EISA) computer.

The computer must have an 80286, 80386, or 80486 microprocessor, at

least eight megabytes of random-access memory (RAM), and a hard disk

with approximately 10 megabytes (MB) of free space.

The ORACLE driver requires MS-DOS version 3.3 or later, Microsoft

Windows version 3.0a or 3.1, and ODBC Driver Manager version 1.0.

ORACLE RDBMS

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

To access data in an ORACLE database with the ORACLE driver, ORACLE

RDBMS version 6.0 or later is required. For more information on the

hardware and software required to run ORACLE RDBMS, please refer to

the ORACLE RDBMS user documentation.

Network Software

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

A network is required to connect the computers on which the ORACLE

RDBMS and the ORACLE driver run. For more information about the

hardware and software that each network requires, please refer to the

user documentation for your particular networking product.

The ORACLE driver and the ORACLE RDBMS use SQL*Net as a common network

interface; it should be possible to use the ORACLE driver on any

SQL*Net connection from Windows to an ORACLE database server. For more

information about SQL*Net, please refer to the SQL*Net user

documentation.

NOTE: SQL*Net components are available only from Oracle Corporation.

Database Error

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

When a database error occurs, the ORACLE driver returns the native

error number, the SQLSTATE (an ODBC error code), and an error message.

The driver determines these values from the errors it detects and from

the errors that the ORACLE RDBMS returns.

Native Error

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

When an error occurs in the data source, the ORACLE driver returns the

native error that the ORACLE RDBMS returns to it. When the driver or

the Driver Manager detects the error, the ORACLE driver returns 0

(zero) for the native error number.

SQLSTATE

--------

When an error occurs in the data source, the ORACLE driver maps the

native error code it receives from the ORACLE RDBMS to the appropriate

SQLSTATE. When the driver or the Driver Manager detects the error, the

ORACLE driver or the Driver Manager generates the appropriate

SQLSTATE.

Error Message

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

When an error occurs in the data source, the ORACLE driver returns an

error message based on the message returned from the ORACLE RDBMS.

When an error occurs in the ORACLE driver or in the Driver Manager,

the ORACLE driver returns the error message associated with the

SQLSTATE. The error message is displayed in the following format:

   <vendor><ODBC-component><data-source>error-message

The prefix items in angle brackets (<>) identify the location of the

error. The table below shows the value returned by the ORACLE driver

for each of these prefix items. Note that when an error occurs in the

data source, the <vendor> and <ODBC-component> variables identify the

vendor and name of the ODBC component that received the error.

Error Location           Prefix                  Value

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

Driver Manager           vendor                  [Microsoft]

                         ODBC-component          [ODBC DLL]

                         data-source             N/A

ORACLE Driver            vendor                  [Microsoft]

                         ODBC-component          [ODBC Oracle Driver]

                         data-source             N/A

ORACLE RDBMS             vendor                  [Microsoft]

                         ODBC-component          [ODBC Oracle Driver]

                         data-source             [Oracle OCI]

The following products are manufactured by vendors independent of

Microsoft: VINES by Banyan Systems, Inc.; DECnet by Digital Equipment

Corporation; IBM PC/AT and PS/2 by International Business Machines

Corporation; NetWare by Novell, Inc.; ORACLE RDBMS and SQL*Net by

Oracle Corporation. We make no warranty, implied or otherwise,

regarding these products' performance or reliability.

Additional reference words: 1.00 1.10 third-party 3rd-party

KBCategory:

KBSubcategory: ObcOthr


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 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: Parameter Queries, Wildcards, and SQL Server

Article ID: Q92682

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The asterisk (*) and the question mark (?) wildcard characters are not

valid in SQL Server parameter queries and thus are interpreted by SQL

Server as text. Unless these characters are present in the field restricted

by the parameter, the query will return an empty set.

Instead of using the asterisk (*) and the question mark (?) wildcard

characters in parameter queries, use the percent sign (%) and the

underscore (_), the SQL Server wildcard characters.

MORE INFORMATION

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

SQL Server uses the percent sign (%) and the underscore (_), the ANSI

standard wildcard characters, whereas Microsoft Access uses the asterisk

(*) and the question mark (?) wildcard characters. When executing a

parameter query, Microsoft Access does not translate the wildcard

equivalents; the string you type in the Query Parameters dialog box is

passed verbatim to SQL Server. Microsoft Access translates only strings

that are part of the QBE grid.

REFERENCES

==========

For more information, search for "parameter query" using the Help menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: QryParm


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: Performing an SQL Bulk Action Query from Access Basic

Article ID: Q88654

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

The information in this article applies to:

- Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Access Basic does not support SQL statements to access your data without

defining a virtual table (VT) object to execute the statement. For

example, you cannot execute the following SQL command on a line by

itself, even though it would be valid in a Microsoft Access query:

   UPDATE Cust SET Cust.[Phone] = "(206) " & [Phone];

This article describes how to perform SQL bulk action queries, and

includes a subprocedure called PerfromSQLAction that you can add to your

programs. You can use this subprocedure to pass a SQL bulk action

statement to the procedure and have it executed.

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

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

Access Basic does not support SQL statements in that you cannot execute a

SQL statement on a line by itself. The following SQL command, although a

valid Microsoft Access query, will generate a syntax error message in

Access Basic:

   UPDATE Cust SET Cust.[Phone] = "(206) " & [Phone];

Instead of including the SQL statement on a line by itself, you have to

follow steps similar to the example below to execute the SQL statement:

1. Dimension a Database and QueryDef variable as shown below:

      Dim MyDB As Database

      Dim MyQuery As QueryDef

2. Set the database variable to the current user database as shown

   below:

      Set MyDB = CurrentDB()

3. Set the QueryDef variable to use the CreateQueryDef method,

   assigning an arbitrary query name such as TempQuery and

   including the desired SQL statement. The query you create using

   this step is only for the purpose of executing the bulk action

   query and will be deleted later. An example of how to use the

   CreateQueryDef method for this purpose is shown 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.

      Set MyQuery = MyDB.CreateQueryDef("TempQuery" ,UPDATE _

         Cust SET Cust.[Phone] = "(206) " & [Phone];

4. Execute the TempQuery query you created in the previous step

   using the Execute method:

      MyQuery.Execute

5. Delete TempQuery using the DeleteQueryDef method as shown below:

      MyDB.DeleteQueryDef("TempQuery")

All of these steps, along with some error trapping, have been combined in

the PerfromSQLAction subprocedure. You can use this subprocedure to

perform bulk action queries in your Access Basic programs.

PerformSQLAction requires only the SQL command you want to execute as a

string value. For example:

   PerformSQLAction "UPDATE Cust SET Cust.[Phone] = '(206) ' & [Phone];"

Note that the SQL command is always followed by a semicolon (;).

The following is a listing of PerformSQLAction:

Sub PerformSQLAction (SQLStmt As String)

   Dim LocalDB As Database, LocalQry As QueryDef

   On Error Resume Next

   Set LocalDB = CurrentDB()

   LocalDB.DeleteQueryDef("TempQuery")

   On Error GoTo 0

   Set LocalQry = LocalDB.CreateQueryDef("TempQuery", SQLStmt)

   LocalQry.Execute

   LocalQry.Close

   LocalDB.DeleteQueryDef("TempQuery")

End Sub

Additional reference words:

KBCategory:

KBSubcategory: ObcOthr


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: Planning Database Security

Article ID: Q92742

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There are two things to remember when dealing with security:

1. Plan your security scheme from the beginning. Planning a good security

   scheme from the beginning will ensure you a minimum of work later on.

2. Assign permissions to Groups, not to Users.

   This is very important. By creating appropriate, well thought out

   groups, a user has the "best" permissions of the groups that he or she

   is a member of. For example, if a user is member of Group A, which does

   not have permissions to an object but also is a member of Group B, which

   does have the permissions to an object, the user will have Group B's

   permission to the object.

   You will find that maintenance work will decrease significantly if

   you plan your groups carefully. A typical database setup should have a

   maximum of 4 to 5 groups. This is not a maximum number of groups

   limitation for Microsoft Access, merely a guideline for easier

   security management.

There is no multiple-selection functionality in the security dialog boxes.

You cannot give a group or user permissions to more than one object at a

time; each object must be selected individually and then permissions may be

assigned.

MORE INFORMATION

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

User Name Case Sensitivity

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

User and group names are not case sensitive when you enter them to start a

Microsoft Access session. However, if you are recreating a user account or

group you have to match the name exactly. This is due to the way the

account information is stored by the system.

NOTE: Passwords are case sensitive.

REFERENCE

=========

Microsoft Access "User's Guide," version 1.0, chapter 25, "Administering a

Database System"

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ScrtOthr


INF: Practice Using Object Analyzer Commands

Article ID: Q88651

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article provides an example of how to use the Object Analyzer

commands discussed in the article titled "Programming with the Object

Analyzer Engine and Utilities." For more information on the commands

themselves, search on the following words here in the Microsoft

Knowledge Base:

   DumpTableInfo or DumpQueryInfo or DumpFormOrReport or

   DumpMacroInfo or DumpModuleInfo

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

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

As discussed in "Programming with the Object Analyzer Engine and

Utilities," you can take advantage of the Object Analyzer engine by

using the commands in the Object Analyzer module.

To get some practice using these commands, follow the steps below to

create your own Database Analyzer in the sample database NWIND.MDB:

Creating a Form

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

1. Create a new form called Little Analyzer.

2. Create a text box control on the form. Change the ControlName

   property to Name.

3. Create an option group control called Options on your form.

4. Add six toggle buttons to the Options option group and modify the

   properties of the toggle buttons as described below:

      Control         Option Value   Caption

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

      First Button          1        Table

      Second Button         2        Query

      Third Button          3        Form

      Fourth Button         4        Report

      Fifth Button          5        Macro

      Sixth Button          6        Module

5. For the AfterUpdate property of the Options option group, specify

   the following:

       =AnalyzeIt(Name, Options)

6. Save and close the form.

Creating a Module

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

1. Create a new module in NWIND.MDB.

2. Add the following function to the module:

Function AnalyzeIt (InName As String, InType As Integer)

   ' This function accepts the name of a Microsoft Access object

   ' and a number representing what type of object it is, then uses

   ' the Object Analyzer Dump commands to analyze the object.

   DoCmd Hourglass True

   Select Case InType

      Case 1

         DumpTableInfo "NWIND.MDB","@Table",InName,False

      Case 2

         DumpQueryInfo "NWIND.MDB","@QuerySQL","@Query",InName

      Case 3

         DumpFormOrReport "NWIND.MDB","@Form","@FCtrls",InName,True

      Case 4

         DumpFormOrReport "NWIND.MDB","@Report","@RCtrls",InName,False

      Case 5

         DumpMacroInfo "NWIND.MDB","@Macro",InName

      Case 6

         DumpModuleInfo "NWIND.MDB","@Procs","@Vars",InName

   End Select

   DoCmd Hourglass False

End Function

3. Save and close the module.

Combine Form and Module to Create Object Analyzer

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

1. Open the Little Analyzer form.

2. In the text box, type "Categories" (without quotation marks).

3. Choose the Tables button. You have created an Object Analyzer.

   The Object Analyzer analyzes the Categories table and creates a

   table called @Table, which contains information about the structure

   of the Categories table.

If you have the Database Analyzer library loaded, you can use these

commands to build your own object-analysis tool, or you can

incorporate these commands into your application to make it self-

documenting.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmOthr


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: Programming with the Object Analyzer Engine and Utilities

Article ID: Q88620

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

When the Database Analyzer library is loaded into memory, you not only

have access to the Database Analyzer tool, but also to all the core

commands that do the actual analysis. This article discusses these core

commands, and describes how you can use them to include data analysis in

your custom application or create your own database-object analysis tool.

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

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

The Database Analyzer tool is included with Microsoft Access. You can use

this tool to retrieve information on the design of objects (such as

tables, queries, and forms) in your database. For more information on the

Database Analyzer tool, including instructions on how to install the

Database Analyzer, see the following file that is shipped with Microsoft

Access and is located in your ACCESS directory:

   Microsoft Access version 1.0: PSSKB.TXT (Question 23)

   Microsoft Access version 1.1: ANALYZER.TXT

Once you have loaded the Database Analyzer library into memory (by

following the instructions in the file named above), you not only have

access to the Database Analyzer tool, but also to all the core commands

that do the actual analysis.

The Database Analyzer consists of three pieces:

 - Database Analyzer

   This is the "front-end" form that you see when you start the

   Database Analyzer tool. It includes the code that gives it the

   ability to display and select objects for analysis.

 - Object Analyzer

   This is the core engine that actually creates the object tables,

   performs the analyses, and writes the resulting information to the

   object tables.

 - Object Analyzer Utilities

   This piece contains global procedures and functions that support

   some of the commands in the Object Analyzer.

Once you have specified an object to be analyzed, the Database Analyzer

calls the Object Analyzer, which performs the analysis using one of the

following core commands:

   DumpTableInfo

   DumpQueryInfo

   DumpFormOrReport

   DumpMacroInfo

   DumpModuleInfo

Assuming you have loaded the Database Analyzer library into memory, these

commands are available to you in the Immediate window. To try one of

these commands, do the following:

1. Open the sample database NWIND.MDB.

2. Open the Introduction To Programming module.

3. From the View menu, choose Immediate Window.

4. In the Immediate window, type the following command, then press

   ENTER:

      DumpTableInfo "NWIND.MDB", "MyTableInfo", "Employees", False

A new table called MyTableInfo will be created. This table will contain the

structure information for the Employees table.

The following lists the syntax for the Database Analyzer commands:

DumpTableInfo <TargetDB>, <DetailsTable>, <ObjectName>, <IsAttached>

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

   Formal Parameter   Definition

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

   TargetDB$          The name of the database that will receive the

                      table.

   DetailsTable$      The name of the table that will receive the

                      information.

   ObjectName$        The name of the table to report on.

   IsAttached%        True if the table being reported is an

                      Attached Table; otherwise False.

DumpQueryInfo <TargetDB>, <SQLTable>, <DetailsTable>, <ObjectName>

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

   Formal Parameter   Definition

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

   TargetDB$          The name of the database that will receive

                      the table. SQLTable is the name of the table that

                      will receive the SQL representation of the

                      query.

   DetailsTable$      The name of the table that will receive the

                      detailed information of the query.

   ObjectName$        The name of the query to report on.

DumpFormOrReport <TargetDB>, <PropsTable>, <DetailsTable>,

   <ObjectName>, <IsForm>

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

   Formal Parameter   Definition

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

   TargetDB$          The name of the database that will receive the

                      table.

   PropsTable$        The name of the table that will receive the

                      information on the form's or report's properties.

   DetailsTable$      The name of the table that will receive the

                      detail information about the form or report.

   ObjectName$        The name of the form or report.

   IsForm%            True if reporting on a form, False if on a

                      report.

DumpMacroInfo <TargetDB>, <DetailsTable>, <ObjectName>

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

   Formal Parameter   Definition

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

   TargetDB$          The name of the database that will receive the

                      table.

   DetailsTable$      The name of the table that will receive the

                      information.

   ObjectName$        The name of the macro to report on.

DumpModuleInfo <TargetDB>, <ProcsTable>, <VarsTable>, <ObjectName>

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

   Formal Parameter   Definition

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

   TargetDB$          The name of the database that will receive the

                      table.

   ProcsTable$        The name of the table that will receive the

                      listing of procedures.

   VarsTable$         The name of the table that will receive the

                      listing of variables.

   ObjectName$        The name of the module to report on.

   NOTE: DumpModuleInfo will not work if it is run from an Immediate

   window.

REFERENCES

==========

For more information on the Database Analyzer commands, query on the

following words here in the Microsoft Knowledge Base:

   practice and using and object and analyzer and commands

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmOthr


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: Querying Questions & Answers

Article ID: Q104390

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

                 WX0639: QUERYING QUESTIONS & ANSWERS

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

                                                                  9/93

                                                      No Disk Included

The following information applies to Microsoft Access(R), versions

1.0, and 1.1.

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

| 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) 1992-1993 Microsoft Corporation.  All Rights Reserved |

| Microsoft, FoxPro, Microsoft Access, and MS-DOS are registered      |

| trademarks                                                          |

| and Windows is a trademark of Microsoft Corporation.                |

| dBASE III PLUS, dBASE IV, and Paradox are registered trademarks of  |

| Borland International, Inc.                                         |

| Btrieve is a registered trademark of Novell, Inc.                   |

| Sybase is a registered trademark of Sybase, Inc.                    |

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

1.  Q. How can I export the results of a query?

    A. To export the results of a query, you can either create a table

       that contains the results or create a macro to export the query

       itself.

       METHOD 1: To create a table that contains the results of the

       query, change the select query to a make-table query by opening

       it in Design view and choosing Make Table from the Query menu.

       The resulting table will contain the data to be exported. Then

       choose Export from the File menu to export the data in the

       format you want. For more information, please refer to Chapter

       4 of the "Microsoft Access User's Guide."

       METHOD 2: To create a macro to export the query, use the

       TransferText macro action to export the data in text file

       format or use the TransferSpreadsheet macro action to export

       the data in spreadsheet format. Using the name of a query in

       the TableName parameter of these macro actions allows you to

       export the query in either file format.

        NOTE: This feature is undocumented. To export a parameter

        query, you must use Method 1. For specific instructions on

        using the TransferText or TransferSpreadsheet macro actions,

        search for "TransferText" or "TransferSpreadsheet" using the

        Help menu.

2.  Q. Can I join tables from different databases into one query?

    A. Yes, you can join tables from different databases into one

       query by choosing Attach Table from the File menu. Using these

       remotely-attached tables, you can generate queries from any

       supported data source (for example, Btrieve(R), dBASE III

       PLUS(R), dBASE IV(R), FoxPro(R), or Paradox(R)).

3.  Q. Is data in tables stored in a sorted order? How can I view my

       data in sorted order?

    A. Data in tables is not stored in sorted order. Data is stored in

       the order in which it was entered. To view data in sorted

       order, create either a query or a form based on a query that

       uses the Sort field on the query grid. By default, if the table

       includes a primary key, the Datasheet view of the table will

       display the data sorted by the primary key. To view the data

       sorted by something other than the primary key alone, use a

       query, as previously described.

4.  Q. How can I create computed columns in tables?

    A. You can create computed columns or expressions with queries.

       Within the query, create a column that is defined as an

       expression. In general, it is helpful to think of queries as

       virtual tables; you can use a query wherever you can use a

       table. If you're familiar with SQL terminology, this is very

       similar to creating a view. Unlike most implementations of

       views, however, Microsoft Access views can be updated even if

       they involve joins from different data sources, such as

       Paradox, Btrieve, or separate Microsoft Access data sources.

5.  Q. What is the difference between the keywords DISTINCT and

       DISTINCTROW?

    A. DISTINCT is part of the SQL standard and causes a query to

       return unique data, rather than unique records. For example,

       even if there are 10 customers named Jones, the query "SELECT

       DISTINCT Name FROM Customer" returns only one row containing

       Jones. With Microsoft Access queries, you specify DISTINCT by

       choosing Query Properties from the View menu and then selecting

       the Unique Values Only check box.

       DISTINCTROW is unique to Microsoft Access and is not part of

       the SQL standard. It causes a query to return unique records,

       rather than unique data values. For example, if there are 10

       customers named Jones, the query "SELECT DISTINCTROW Name FROM

       Customer" returns all 10 rows containing Jones.

       The main reason for adding the DISTINCTROW keyword to Microsoft

       Access SQL is to support semi-joins that can be updated (for

       example, one-to-many joins in which the output columns all come

       from the one-sided table). DISTINCTROW is specified by default

       in Microsoft Access queries and is ignored in queries for which

       it has no effect.

6.  Q. Why do queries change the order of my columns?

    A. When you close a query, Microsoft Access moves the sorted

       fields to the leftmost columns in the Query-By-Example

       (QBE) grid. For example, if you open an existing query in

       Design view, revise it, and save your changes, Microsoft Access

       displays the sorted fields to the left of the datasheet. You

       can rearrange the fields if necessary.

7.  Q. I am sending a query to Microsoft SQL Server or Sybase(R) SQL

       Server through Microsoft Access, but the query runs very

       slowly. Why does this occur, and how can I increase the query

       speed?

    A. The query speed most often decreases when you send implicit,

       instead of explicit, parameters to the remote server.

       Query parameters can be either implicit or explicit. A

       parameter entry made only in the Query-By-Example (QBE) grid is

       called an implicit parameter. A parameter entry made in both

       the QBE grid and the Query Parameters dialog box is called an

       explicit parameter.

       When you use implicit parameters in your query, Microsoft

       Access does not send the query to the remote server, because

       Microsoft Access cannot verify what implicit conversions the

       remote server provides. As a result, Microsoft Access processes

       the query locally, which can noticeably reduce the query speed.

       However, when you use explicit parameters in your query,

       Microsoft Access knows the data types of the parameters.

       Subsequently, Microsoft Access sends the query to the remote

       server for processing, which speeds up the query.

       Note also that Microsoft Access automatically treats

       unrecognized or misspelled names and expressions as implicit

       parameters, rather than as errors. Microsoft Access then makes

       a "best guess" about the implicit parameter's data type. If

       Microsoft Access guesses the wrong data type, a query can

       return unexpected results or values, either when you enter a

       parameter value or when you execute queries on a remote server.

       For additional optimization tips for attached SQL Server

       tables, please obtain Technical Note #99321. You can order this

       technical note by selecting the FastTips Technical Library

       option from the Fast Tips Main Menu.

Additional reference words: 1.00 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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: Recovering MDB File Larger Than the 128- Megabyte Limit

Article ID: Q96550

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

The information in this article applies to:

 - Microsoft Access version 1.0

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

SUMMARY

=======

A Microsoft Access version 1.0 database (.MDB file) is limited to a maximum

size of 128 megabytes (MB). However, you can exceed this limit by importing

large amounts of data or by creating objects that cause the limit to be

exceeded.

MORE INFORMATION

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

In the event a Microsoft Access database exceeds the limit, here are two

options you can use to attempt to remedy the situation:

1. If you are able to open the database, export some of the objects to

   another database, and then delete them from the current database.

2. If you are unable to open the database, try to compact the database by

   using the Compact utility. It will work on files larger than 128 MB,

   unlike the Repair utility.

Unfortunately, there are situations where neither one of these options will

work. If this is the case, you will be unable to recover the data using

Microsoft Access.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Appendix A, page 663

Additional reference words: 1.00 checkpage

KBCategory:

KBSubcategory: GnlCmp


INF: Relationships Between Attached Microsoft Access Tables

Article ID: Q109322

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Although relationships cannot be established between attached tables in

Microsoft Access, referential integrity can be enforced if the attached

tables reside in another Microsoft Access database, and if relationships

have been established in that Microsoft Access database.

MORE INFORMATION

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

The following example demonstrates the use of referential integrity between

attached Microsoft Access tables:

1. Create a new database in Microsoft Access.

2. From the File menu, choose Attach Table. Select Microsoft Access in

   the Data Source box, and then choose OK.

3. In the File Name box, select the sample database NWIND.MDB, and then

   choose OK.

4. Attach the Categories and Products tables, and then choose Close.

5. Open the Categories table in Datasheet view.

6. Try to delete any record in the table. You will receive the following

   error message:

      Can't delete or change record. Since related records exist in table

      'Products', referential integrity rules would be violated.

7. Open the Products table in Datasheet view.

8. Try to add a record whose Category ID does not exist in the Categories

   table. You will receive the following error message:

      Can't add or change record. Referential integrity rules require a

      related record in table 'Categories.'

Note that you cannot define relationships for the attached tables in the

Edit Relationships dialog box; the relationship must be established by

a join in a query. If you do create a query using the attached tables, make

sure that any join lines join fields with the same data type.

REFERENCES

==========

For more information on creating relationships between attached tables,

query on the following words here in the Microsoft Knowledge Base:

   create and relationships and attached

Additional reference words: 1.00 1.10 relate attach

KBCategory:

KBSubcategory:  RltOthr


INF: Repeat Group Name at the Top of New Column or Page

Article ID: Q93927

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to create a report that prints "continued" or

"Group Name continued" at the top of each new column or page when grouped

information flows from one column or page to another. At the end of this

article, you will find sources for additional information on multiple-page

and multiple-column report formats.

MORE INFORMATION

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

Microsoft Access prints a single group header at the beginning of a group

to identify the beginning of the group. It does not repeat the header at

the top of subsequent columns or pages. However, you can use the procedure

described below to force a report to repeat the group name if the detail

records in a group span several columns or pages. This article uses

the report List Of Products By Category from the sample database

NWIND.MDB.

Three-step Process

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

The report uses macros to identify the group. It uses the Top property to

determine whether a detail section is being formatted at the top

of a column or page. If it is, the report shows the contents of the text

box that contains the group name and "continued," and it hides the other

controls in the detail section. It is a three-step process.

Step One: Create a New Macro Group Containing Three Macros

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

You need a macro group (Continued) containing three macros (Page Reset, Set

Top1, and Print) to check for certain conditions and perform specific

actions based on those conditions. By setting conditions, you give the

macro the branching characteristics of a program without using a

programming language.

The Page Reset macro sets the value of the Top1 text box to the value of

the Top property if the current value of Top1 is 0 when Microsoft Access

formats the group header.

The Set Top1 macro sets the value of the Top1 text box to 0 when

Microsoft Access formats the page header.

The Print macro sets the value of the Top1 text box to the value of

the Top property if the value of Top1 is 0 when Microsoft Access

formats a detail section. Or, if the Top property is equal to the value

of the Top1 text box, it sets the Visible property of the Continued

text box to Yes and the Visible property for each of the controls in

the detail section to No. In the List Of Products By Category report,

there are four controls to hide in the detail section. It also sets

the NextRecord property to False. Otherwise, it hides the message and

prints the detail record.

To create the macro group:

1. Create a new macro.

2. From the View menu, choose Macro Names or choose the Macro Names button

   on the toolbar.

3. From the View menu, choose Conditions or choose the Conditions button

   on the toolbar.

   Microsoft Access displays the complete grid in the Macro window,

   including the Macro Name, Condition, and Action columns.

4. Enter the macro names, conditions, actions, and action arguments using

   the following two tables as a guide. Use the first table to fill the

   grid and use the second to add action arguments to each action. Do not

   enter the reference letters: [a], [b], [c], and so on. These reference

   letters are there to help you associate the actions shown in the first

   table with the action arguments shown in the second table.

      Macro Name   Condition    Action       Reference

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

      Page Reset                SetValue     [a]

      Set Top1     [Top1]=0     SetValue     [b]

      Print        [Top1]=0     SetValue     [c]

                   Top=[Top1]   SetValue     [d]

                   ...          SetValue     [e] -- repeat for

                   ...          SetValue     [e] -- each control

                   ...          SetValue     [e] -- in the

                   ...          SetValue     [e] -- detail section

                   ...          SetValue     [f]

                   ...          StopMacro    [g]

                                SetValue     [h]

                                SetValue     [i] -- repeat for

                                SetValue     [i] -- each control

                                SetValue     [i] -- in the

                                SetValue     [i] -- detail section

   The ellipses in the Condition column are required for lines e, f, and g;

   enter them exactly as shown. 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. The

   ellipses in the Condition column force Microsoft Access to perform the

   action on that line if the condition on the preceding line is true.

   Here is the second table. It gives the action arguments for each action:

      Reference   Action       Action Arguments

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

      [a]         SetValue     Item: [Top1]

                               Expression: 0

      [b]         SetValue     Item: [Top1]

                               Expression: Top

      [c]         SetValue     Item: [Top1]

                               Expression: Top

      [d]         SetValue     Item: [Continued].Visible

                               Expression: Yes

      [e]         SetValue     Item: [Product Name].Visible

                               Expression: No

      [e]         SetValue     Item: [Product Id].Visible

                               Expression: No

      [e]         SetValue     Item: [Quantity Per Unit].Visible

                               Expression: No

      [e]         SetValue     Item: [Units In Stock].Visible

                               Expression: No

      [f]         SetValue     Item: NextRecord

                               Expression: False

      [g]         StopMacro

      [h]         SetValue     Item: [Continued].Visible

                               Expression: No

      [i]         SetValue     Item: [Product Name].Visible

                               Expression: Yes

      [i]         SetValue     Item: [Product Id].Visible

                               Expression: Yes

      [i]         SetValue     Item: [Quantity Per Unit].Visible

                               Expression: Yes

      [i]         SetValue     Item: [Units In Stock].Visible

                               Expression: Yes

5. The SetValue actions in lines e and i are used to hide the controls

   in the detail section of your report. The List Of Products By

   Category report has 4 controls in the detail section: Product Name,

   Product Id, Quantity Per Unit, and Units In Stock. You should

   repeat lines e and i for the number of controls in your detail

   section. For example, if you have only one control in the detail

   section, you need only one e and one i.

6. Save the macro group and specify Continued as the name. This makes

   Continued the name of the macro group. It now appears in the list of

   macros and macro groups in the Database window. Use the following syntax

   to specify each macro in the macro group when you attach a macro to a

   property on the report:

      macrogroupname.macroname

   For example, the following specifies the Print macro: continued.print.

Step Two: Attach the Macros to the Report

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

1. Open the report in Design view.

2. Set the following properties for the specified sections by selecting

   each section with the mouse and viewing its properties:

      Section Name           Property     Expression

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

      Page Header            OnFormat     Continued.Page Reset

      Category Name Header   OnFormat     Continued.Set Top1

      Detail                 OnFormat     Continued.Print

                             CanShrink    Yes

      Category Name Footer   OnFormat     Continued.Set Top1

   This sets the Top1 control to the current value of the Top expression

   to keep track of the current twip value (position) of the top.

Step Three: Add Controls to the Report and Set Properties

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

1. Open the report in Design view.

2. Create an unbound text box control named Top1.

3. Place the Top1 text box control in the Category Name header section.

4. Assign the following property values to the Top1 text box control:

      Property         Expression

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

      ControlName:     Top1

      Visible:         No

5. In the detail section, create a text box bound to an expression. Locate

   it near the top in the same vertical location as that of the group

   header label. Assign the following property values to the text box:

      Property         Expression

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

      ControlName:     Continued

      ControlSource:   =[Category Name] & " continued"

      Visible:         No

      CanShrink:       Yes

   NOTE: Replace Category Name with the name of the field being

   grouped.

6. Save and run the report.

The approach described here works well for both single-column and

multiple-column reports, but there is a simpler method you can use

for a single-column, multiple-page report.

For more information about the simpler method, query on the following words

here in the Microsoft Knowledge Base:

   continued and groups

REFERENCES

==========

For more information about how to make the page header span the full width

of a multiple-column report, query on the following words here in the

Microsoft Knowledge Base:

   span and width

For information about how to create multiple-page reports with snaking

column, search on "multiple-column reports" then "Creating Snaking Columns

on a Report" using the Microsoft Access Help menu.

Also, see the Microsoft Access "User's Guide," version 1.0, Chapter 19,

"Sorting and Grouping Data."

Additional reference words: 1.00 1.10 multicolumn snake snaking-column

KBCategory:

KBSubcategory: RptSort


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: Reports Questions & Answers

Article ID: Q104388

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

                  WX0640: REPORTS QUESTIONS & ANSWERS

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

                                                   Revision Date: 9/93

                                                      No Disk Included

The following information applies to Microsoft Access(R), versions 1.0,

and 1.1.

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

| 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) 1992-1993 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 every other page of my report blank? How can I correct

       this problem?

    A. This problem commonly occurs when the width of your report

       combined with the left and right margins is greater than the

       width of your paper. Adjust the width of your report and the

       margins so that your report fits on the page.

       For additional information on preventing blank pages, please

       obtain Technical Note #95920. You can order this technical note

       by selecting the FastTips Technical Library option from the

       FastTips Main Menu.

2.  Q. How can I convert a form to a report?

    A. To convert a form to a report, open the form in Design view and

       choose Save As Report from the File menu.

3.  Q. How can I sort the data in a report by a field not displayed on

       the report?

    A. To sort report data by a field in a separate table, create a

       query that includes the field from the other table, then base

       the report on the query. If you have already created the

       report, verify that the query includes all the fields used in

       the report and change the RecordSource property of the report

       to refer to the new query. Now you can adjust the Sorting and

       Grouping properties of the report to sort on the new field.

4.  Q. How can I prevent a page break from occurring in the middle of

       a group?

    A. The KeepTogether property keeps all the controls for one record

       together within a particular section of a report. However, it

       does not keep multiple records together, nor does it keep a

       group header and its detail records together.

       The following methods can prevent page breaks from occurring in

       the middle of groups:

        - Set the ForceNewPage property of the report's Group Header

          section to Before Section. This ensures that each group will

          start on a new page and that as many detail records as possible

          will fit on one page.

        - Repeat the group name, or place a "Continued" label at the top

          of each consecutive page.

          For additional information on how to create these labels

          for consecutive pages of a group, please obtain Technical

          Notes #88156 and #93927. You can order these technical notes

          by selecting the FastTips Technical Library option from the

          FastTips Main Menu.

        - Before placing the group header on the current page, create an

          Access Basic function that calculates how much space is left on

          the page.

Additional reference words: 1.00 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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 Check Whether an Entry Exists

Article ID: Q109374

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article demonstrates a sample function called CheckPrimaryKey() that

you can use to check whether an entry in a text box already exists in the

form's underlying 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.

MORE INFORMATION

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

In the following example, the CheckPrimaryKey() function checks whether the

entry in the Customer ID field on the Customers form already exists in the

Customers table. The function is attached to the BeforeUpdate event of the

Customer ID text box on the form.

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. Create a new module.

2. In the Declarations section, type the following:

      Option Explicit

3. Enter the following code in the module:

      Function CheckPrimaryKey(MyCustID)

         Dim MyDB As Database, MyDyna As Dynaset

      ' Create a dynaset of Customer IDs from the Customers table. The

      ' function may encounter an empty dynaset. If so, the function will

      ' fail attempting to move to the first record of the dynaset, and

      ' execute the error handling routine labeled MyCustErrTrap.

         Set MyDB = CurrentDB()

         Set MyDyna = MyDB.CreateDynaset("SELECT [Customer ID] FROM _

            Customers WHERE [Customer ID] = '" & MyCustID & "';")

         On Error GoTo MyCustErrTrap:

         MyDyna.MoveFirst

      ' The Customer ID entered in the form is compared to the Customer IDs

      ' in the dynaset. If there is a match, display a message saying so,

      ' then cancel the event of updating the text box, and send the Escape

      ' (ESC) keystroke to undo the data entry. If there is no match, leave

      ' the Customer ID in the text box and select the next control on the

      ' form.

         If MyDyna![Customer ID] = MyCustID Then

            MsgBox "You've entered an existing Customer ID, please enter _

               a new one"

            DoCmd CancelEvent

            SendKeys "{ESC}"

         End If

      ' This is the Error trap routine.

      MyCustErrTrap:

         Exit Function

      End Function

4. Save the module as Customer ID Test Module.

5. Open the Customers form in Design view, and select the Customer ID text

   box.

6. Add the following expression to the BeforeUpdate event:

      =CheckPrimaryKey([Customer ID])

7. Switch to Form view and choose Go To from the Records Menu, then choose

   New.

8. Type "ALWAO" (without quotation marks) in the Customer ID text box. The

   message box will appear, and when you select OK your data entry will be

   undone.

9. Type "ZZZZZ" (without quotation marks) in the Customer ID text box. The

   message box will not appear, and Microsoft Access will accept the data

   entry.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 88, 311, and

432

Additional reference words: 1.00 1.10

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 Insert CR/LF in Fixed-Width Files

Article ID: Q109938

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Fixed-width text files imported into Microsoft Access must have a

carriage return/line feed character at the end of each line. This article

describes a sample Access Basic function to add carriage return/line feed

characters to the end of each line in a 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.

MORE INFORMATION

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

The following sample function will add a carriage return/line feed

character to the end of each line in a file that does not have one. This

function can process files with records larger than 255 bytes.

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 AddCRLF (InFile As String, OutFile As String, _

      RecLen As Integer)

      Dim InFileNo As Integer, OutFileNo As Integer, Rec As String

      ' Get an open file handle and open the input file.

      InFileNo = FreeFile

      Open InFile For Input As #InFileNo

      ' Get an open file handle and open the output file.

      OutFileNo = FreeFile

      Open OutFile For Output As #OutFileNo

      ' Process the file.

      Do While Not EOF(InFileNo)

         ' Read one fixed-width record, RecLen in size.

         Rec = Input$(RecLen, InFileNo)

         ' Output the record to the output file.

         ' NOTE: Print automatically places a carriage return/line feed

         ' character at the end of the line.

         Print #OutFileNo, Rec

      Loop

      ' Close the files.

      Close #InFileNo

      Close #OutFileNo

   End Function

To add carriage return/line feed characters to a file in the Microsoft

Access directory called X300.TXT that has 30-byte records, type the

following in the Immediate window:

   ? AddCRLF("C:\ACCESS\X300.TXT", "C:\ACCESS\X300CRLF.TXT", 30)

Note that the output file will be called X300CRLF.TXT.

Additional reference words: 1.00 1.10 Import Fixed Width FreeFile

KBCategory:

KBSubcategory: IsmTxtfx


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 Current User's Groups

Article ID: Q109721

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes a sample Access Basic function to get a list of

groups the current user belongs to in the current Microsoft Access system.

Notes

-----

 - The technique described below relies on the use of system tables

   stored with your database. These tables are undocumented and are

   subject to change in future versions of Microsoft Access.

 - 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

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

The following function returns a comma-separated list of the groups in the

Microsoft Access system to which the current user belongs. The function

takes one argument that lists the complete path and filename for the

SYSTEM.MDA file you want to query:

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

   ' Declarations Section of the Module

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

   Option Explicit

   '=========================================================

   ' The following CurrentUserGroup() function returns a list

   ' of groups to which the current user belongs.

   '=========================================================

   Function CurrentUsersGroups (SysDB As String)

      Dim DB As Database

      Dim QD As QueryDef

      Dim DS As Dynaset

      Dim CurrUser As String, Groups As String

      Dim Counter As Integer

      Set DB = OpenDatabase(SysDB)

      Set QD = DB.OpenQueryDef("MSysUserMemberships")

      QD![UserName] = User()

      Set DS = QD.CreateDynaset()

      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

      CurrentUsersGroups = Groups

   End Function

To run the function where the SYSTEM.MDA file is located in the ACCESS

directory on the C drive, type the following in the module's Immediate

window and press ENTER:

   ? CurrentUsersGroups("C:\ACCESS\SYSTEM.MDA")

If you are logged into the Microsoft Access system as the Admin user, and

you have not changed the default groups to which the Admin user belongs,

you will receive the following list when the above function is run:

   Admins,Users

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 88- 90, 198-199,

311-312, 352-354, and 390-391

Microsoft Access "Introduction to Programming," version 1.0, Chapter 8,

"Manipulating Data," pages 137-138

Additional reference words: 1.00 1.10 security

KBCategory:

KBSubcategory: ScrtOthr


INF: Sample Function to Return Users in Current System

Article ID: Q109722

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes a sample Access Basic function to use to return a

list of users in the current Microsoft Access system.

Notes

-----

 - The technique described below relies on the use of system tables

   stored with your database. These tables are undocumented and are

   subject to change in future versions of Microsoft Access.

 - 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

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

The following function returns a comma-separated list of users in the

current Microsoft Access system database. The function takes one argument

that specifies the complete path and filename for the SYSTEM.MDA file you

want to 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 CurrentUsers (SysDB As String)

      Dim DB As Database

      Dim DS As Dynaset

      Dim CurrUser As String, Users As String

      Dim Counter As Integer

      On Error GoTo FileError

      Set DB = OpenDatabase(SysDB)

      Set DS = DB.CreateDynaset("MSysUserList")

      DS.MoveLast

      DS.MoveFirst

      For Counter = 1 To DS.RecordCount

         Users = Users & IIf(Len(Users) > 0, ",", "") & DS![Name]

         DS.MoveNext

      Next Counter

      DS.Close

      DB.Close

      CurrentUsers = Users

      Exit Function

   FileError:

      MsgBox "The Following Error Occurred:" & Chr$(13) & Chr$(10) &_

      Chr$(13) & Chr$(10) & Error$

      Exit Function

   End Function

To run this function on a system where the SYSTEM.MDA file is located in

the ACCESS directory on the C drive, type the following in the module's

Immediate window, and then press ENTER:

   ? CurrentUsers("C:\ACCESS\SYSTEM.MDA")

If the Microsoft Access system has no users added to it, you will receive

the following list:

   admin,Creator,Engine,guest

REFERENCES

==========

Microsoft Access "Language Reference," versions 1.0 and 1.1, pages 88-90,

198-199, 311-312, and 390-391

Additional reference words: 1.00 1.10 security

KBCategory:

KBSubcategory: ScrtOthr


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: Sample Timer DLL for MS Access 1.x Available on MSL

Article ID: Q113561

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

There is a sample dynamic-link library (DLL) available in the Microsoft

Software Library (MSL) that demonstrates how to implement a timer in

Microsoft Access version 1.x.

You can download TIMER.EXE, a self-extracting file, from the MSL on the

following services:

 - CompuServe

      GO MSL

      Search for TIMER.EXE

      Display results and download

 - Microsoft Download Service (MSDL)

      Dial (206) 936-6735 to connect to MSDL

      Download TIMER.EXE

 - Internet (anonymous FTP)

      ftp ftp.microsoft.com

      Change to the \softlib\mslfiles directory

      Get TIMER.EXE

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlOthr


INF: Sample Version 1.1 MSACCESS.INI File

Article ID: Q109712

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

The information in this article applies to:

 - Microsoft Access version 1.1

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

SUMMARY

=======

This article lists a generic MSACCESS.INI file for Microsoft Access version

1.1. The MSACCESS.INI file is created by the Microsoft Access Setup

program. If the MSACCESS.INI file in your Windows directory is damaged or

removed, you can run the Setup program again, or re-create the file

yourself using the information in this article.

MORE INFORMATION

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

To create a new MSACCESS.INI file, follow these steps:

1. Open any text editor such as Windows Notepad.

2. Enter the following text in a new file. Note that you must use

   the appropriate directory names for your system in the [Options]

   section of the file:

   ;=====================================================

   ;This is a generic MSACCESS.INI file for version 1.1

   ;=====================================================

   [Options]

   SystemDB=C:\ACCESS\SYSTEM.MDA      ;path may differ

   UtilityDB=C:\ACCESS\UTILITY.MDA    ;use path for your installation

   [Paradox 3.X]

   Filter=Paradox (*.db)|*.db|All Files (*.*)|*.*|

   Extension=db

   OneTablePerFile=Yes

   IndexDialog=No

   [dBASE III]

   Filter=dBASE III (*.dbf)|*.dbf|All Files (*.*)|*.*|

   Extension=dbf

   OneTablePerFile=Yes

   IndexDialog=Yes

   IndexFilter=dBASE Index (*.ndx)|*.ndx|All Files (*.*)|*.*|

   IndexExtension=ndx

   [dBASE IV]

   Filter=dBASE IV (*.dbf)|*.dbf|All Files (*.*)|*.*|

   Extension=dbf

   OneTablePerFile=Yes

   IndexDialog=Yes

   IndexFilter=dBASE Index (*.ndx;*.mdx)|*.ndx;*.mdx|All Files (*.*)|*.*|

   [FoxPro 2.5]

   Filter=FoxPro 2.5(*.dbf)|*.dbf|All Files (*.*)|*.*|

   Extension=dbf

   OneTablePerFile=Yes

   IndexDialog=Yes

   IndexFilter=FoxPro Index (*.idx;*.cdx)|*.idx;*.cdx|All Files

   (*.*)|*.*|

   [FoxPro 2.0]

   Filter=FoxPro 2.0 (*.dbf)|*.dbf|All Files (*.*)|*.*|

   Extension=dbf

   OneTablePerFile=Yes

   IndexDialog=Yes

   IndexFilter=FoxPro Index (*.idx;*.cdx)|*.idx;*.cdx|All Files

   (*.*)|*.*|

   [Btrieve]

   Filter=Btrieve (file.ddf)|file.ddf|

   Extension=ddf

   OneTablePerFile=No

   IndexDialog=No

   [Microsoft Access]

   Filter=Microsoft Access (*.mdb)|*.mdb|All Files (*.*)|*.*|

   Extension=mdb

   OneTablePerFile=No

   IndexDialog=No

   Maximized=1

   Tutorial=1

   [Delimited Text]

   Filter=Delimited Text (*.txt)|*.txt|All Files (*.*)|*.*|

   Extension=txt

   OneTablePerFile=Yes

   IndexDialog=No

   [Fixed Width Text]

   Filter=Fixed Width Text (*.txt)|*.txt|All Files (*.*)|*.*|

   Extension=txt

   OneTablePerFile=Yes

   IndexDialog=No

   [Word for Windows Merge]

   Filter=Text (*.txt)|*.txt|All Files (*.*)|*.*|

   Extension=txt

   OneTablePerFile=Yes

   IndexDialog=No

   [Microsoft Excel]

   Filter=Microsoft Excel (*.xls)|*.xls|All Files (*.*)|*.*|

   Extension=xls

   OneTablePerFile=Yes

   IndexDialog=No

   [Lotus WKS]

   Filter=Lotus 1-2-3 (*.wks)|*.wks|All Files (*.*)|*.*|

   Extension=wks

   OneTablePerFile=Yes

   IndexDialog=No

   [Lotus WK1]

   Filter=Lotus 1-2-3 (*.wk1)|*.wk1|All Files (*.*)|*.*|

   Extension=wk1

   OneTablePerFile=Yes

   IndexDialog=No

   [Lotus WK3]

   Filter=Lotus 1-2-3 (*.wk3)|*.wk3|All Files (*.*)|*.*|

   Extension=wk3

   OneTablePerFile=Yes

   IndexDialog=No

   [ODBC]

   QueryTimeout=60

   LoginTimeout=20

   [Libraries]

   wizard.mda=ro

   [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

3. Save the file as MSACCESS.INI in your Windows directory.

REFERENCES

==========

For more information on the MSACCESS.INI file, search for "MSACCESS.INI"

then "Customizing MSACCESS.INI Settings" using the Microsoft Access Help

menu.

Additional reference words: 1.10

KBCategory:

KBSubcategory: GnlOthr


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: Sending the Current Record to Word for Windows with DDE

Article ID: Q99570

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to send the current record in Microsoft Access

version 1.x to Microsoft Word version 2.0 or 6.0 for Windows to be merged

into a prewritten letter and printed.

This article assumes that you are familiar with dynamic data exchange

(DDE), setting bookmarks in Word for Windows, and creating modules and

using Access Basic in Microsoft Access.

MORE INFORMATION

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

Step One: Create the Word for Windows Document

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

1. Start Word for Windows and open a new document.

2. Enter the following in the blank document:

      CompanyName

      Address

      City, Region, PostalCode

      Country

      Dear ContactName,

         Northwind Traders would like to thank you for

         your business during the past year. Enclosed

         you will find several samples of new products

         that we are excited to announce.

      Sincerely,

      Northwind Traders.

3. Save this document as C:\DDEMERGE.DOC.

4. To create the bookmarks, select CompanyName, and choose Bookmark from

   the Insert menu in Word 2.0, or from the Edit menu in Word 6.0. Name

   the bookmark CompanyName.

5. Repeat step 4 to create bookmarks for each of the fields (Address,

   City, Region, PostalCode, Country, and ContactName). Make sure to

   give each bookmark the appropriate name.

Step Two: Create the Access Basic Module

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

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new module.

3. Enter the following in the module's Declarations section:

      Option Explicit

      Global MergeChan As Integer

      Const ID_YES = 6

4. Enter the following functions 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 Initiate_Word ()

         Dim Chan As Variant

         Dim WordTopics As Variant

         Chan = StartApp("Winword", "System")

         'StartApp is already in the NWIND database. To find it,

         'Choose Modules, then Design in the Database Window.

         'Choose StartUp from the Procedure list box

         On Error GoTo AlertUser:

         WordTopics = DDERequest(Chan, "Topics")

         If InStr(1, WordTopics, "DDEMERGE.DOC") = 0 Then

           DDEExecute Chan, "[FILEOPEN ""C:\DDEMERGE.DOC""]"

         End If

         DDETerminate Chan

         Mergechan = DDEInitiate("Winword", "C:\DDEMERGE.DOC")

      Exit Function

      AlertUser:

         MsgBox "MS Access is unable to initiate a DDE _

              channel with the document DDEMERGE.DOC"

         Resume Next

      End Function

      Function Send_Record ()

         On Error GoTo CatchBlanks

         DDEPoke Mergechan, "CompanyName",_

            Forms![Customers]![Company Name]

         DDEPoke Mergechan, "ContactName", _

            Forms![Customers]![Contact Name]

         DDEPoke Mergechan, "Address", _

            Forms![Customers]![Address]

         DDEPoke Mergechan, "City", _

            Forms![Customers]![City]

         DDEPoke Mergechan, "Region", _

            Forms![Customers]![Region]

         DDEPoke Mergechan, "PostalCode", _

            Forms![Customers]![Postal Code]

         DDEExecute Mergechan, "[FilePrint]"

         Exit Function

      CatchBlanks:

         If MsgBox("Error sending one field, it may be blank._

               Would you like to continue?", 52) = ID_YES Then

           Resume Next

         Else

           Exit Function

         End If

      End Function

      Function Terminate_MergeChan ()

         DDETerminate MergeChan

      End Function

5. From the Run menu, choose Compile All.

6. Save the module as Print Merge, and then close it.

Step Three: Create the Form

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

1. Open the Customers form in Design view.

2. Set the form's OnOpen property to:

      =Initiate_Word()

3. Add a command button with the following properties to the form:

      Caption: Print Letter

      OnPush: =Send_Record()

4. Set the form's OnClose property to:

      =Terminate_MergeChan()

5. Save the form, and then view it in Form view.

6. Choose the Print Letter button on the form. The current customer record

   will be sent to Word for Windows, merged into the DDEMERGE.DOC document,

   and printed.

REFERENCES

==========

Microsoft Access "Introduction to Programming," versions 1.0 and 1.1,

Chapter 9, "Dynamic Data Exchange"

Additional reference words: 1.00 1.10 merge printmerge browse

KBCategory:

KBSubcategory: IntpDde


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 Form's Dynaset Property Puts Bookmark at EOF

Article ID: Q90850

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

In Access Basic, you can make a copy of the dynaset that a

form may currently be using for data manipulation.

The syntax to accomplish this is:

   Dim MyDB as Database

   Dim MyDyn as Dynaset

   Set MyDB = OpenDatabase("NWIND.MDB")

   Set MyDyn = Forms!Categories.Dynaset

In this case, you may assume that the bookmark is at the beginning of

the Categories dynaset. However, the bookmark is at the end-of-file

(EOF) marker. In fact, after a variable is set to the dynaset of a

form, there is no current record because the bookmark is actually at

the EOF marker.

MORE INFORMATION

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

Before doing any further actions, the two dynasets should either be

synchronized or the bookmark should be set to the first record. This

is done with the following statement:

   MyDyn.Bookmark = Forms!Categories.Bookmark  ' Synch dynasets.

   -or-

   MyDyn.MoveFirst   ' Move to first record.

After one of these statements has been issued, there will be a current

record and the bookmark will be pointing at this current record.

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 8

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmObj


INF: Setup Files Utility Appears to Hang

Article ID: Q100965

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

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

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

SUMMARY

=======

After you install the Microsoft Access Distribution Kit (ADK), you should

run the Setup Files utility (SUFiles). This utility compresses files from

various directories, including the Windows and Access directories, into

the SUFILES directory so that when you build your distribution disks, the

SetupWizard only needs to copy the compressed files to the disk

directories and does not have to recompress each time a distribution disk

is built.

MORE INFORMATION

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

When you run this utility, it appears to stop responding (hang). The

cursor remains a pointer; it does not become an hourglass to indicate

that progress is occurring. The progress meter remains at zero percent

(0%), and you do not see any hard disk activity. Eventually, the screen

is updated.

This process requires varying amounts of time depending on your

computer type and the amount of memory available. The average time is

approximately 20 minutes. Here are two examples:

   Processor/Speed  Memory   Time Required

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

   486/50           16 MB    10 minutes

   386/16            4 MB    45 minutes

This utility is designed so that you can choose Cancel. If the pointer

were to change to an hourglass, you would lose that ability.

Additional reference words: 1.10

KBCategory:

KBSubcategory: StpOthr


INF: Setup Questions & Answers

Article ID: Q104391

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

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

  Microsoft(R) Product Support Services Application Note (Text File)

                   WX0812: SETUP QUESTIONS & ANSWERS

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

                                                   Revision Date: 9/93

                                                      No Disk Included

The following information applies to Microsoft Access(R), versions

1.0 and 1.1.

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

| 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) 1993 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

| Quicken is a registered trademark of Intuit.                        |

|---------------------------------------------------------------------|

1.  Q. Why does Microsoft recommend that I remove SHARE.EXE from my

       AUTOEXEC.BAT file if I run Microsoft Windows for Workgroups?

    A. We recommend that you remove SHARE.EXE from your AUTOEXEC.BAT

       file only if you run Microsoft Windows for Workgroups in 386

       enhanced mode. When Windows for Workgroups is run in 386

       enhanced mode loads and uses a file-sharing program called

       VSHARE.386, which replaces SHARE.EXE. There is an entry for

       VSHARE.386 in the SYSTEM.INI file.

       If you plan to run Windows for Workgroups exclusively in 386

       enhanced mode and not run other applications that require

       SHARE.EXE, you can save approximately 5 kilobytes (K) of

       conventional memory by not loading VSHARE.386 at all. If you

       have already loaded SHARE.EXE, delete it from your AUTOEXEC.BAT

       file and restart your computer.

       You are likely to find SHARE.EXE in your AUTOEXEC.BAT file

       because SETUP.EXE automatically inserts the following MS-DOS

       command in your AUTOEXEC.BAT file when you install Microsoft

       Access

          <directory>\share.exe /l:500

       where <directory> is the name of your MS-DOS directory.

       If you load VSHARE.386 and SHARE.EXE is already present,

       VSHARE.386 temporarily disables it. VSHARE.386 takes over file-

       sharing tasks until you exit Windows for Workgroups. VSHARE.386

       then transfers the tasks back to SHARE.EXE, so file sharing is

       available to your MS-DOS-based applications.

       Microsoft Access runs correctly with either SHARE.EXE or

       VSHARE.386, but SHARE.EXE limits the number of available locks

       to the number you specified when you loaded the file

       originally. The /L parameter specifies the number of locks; the

       default is 20. VSHARE.386, on the other hand, dynamically

       allocates the number of locks available, based on demand. The

       number of locks available is especially important if you are

       running Windows for Workgroups in a client-server environment.

       For additional information on the SHARE.EXE file, please obtain

       Technical Note #95047. You can order this technical note by

       selecting the FastTips Technical Library option from the

       FastTips Main Menu.

 2. Q. Why do I get the error message "Outdated 'COMMDLG.DLL' found.

       Please reinstall Microsoft Access" when I install Microsoft

       Access?

    A. This error can occur for a number of reasons. To isolate the

       cause, check the following:

        NOTE: This example uses the COMMDLG.DLL file. The same problem

        can occur with other .DLL files. These steps can be used to

        resolve any problems with outdated .DLL files.

        - Make sure that you have no more than one COMMDLG.DLL file on your

          hard disk. If you have several earlier versions of this file,

          either delete or rename the earlier COMMDLG.DLL files and keep

only

          the latest one.

          If you are running MS-DOS version 5.0 or later, use the

          following two steps to search for all occurrences of the

          COMMDLG.DLL file:

          1. Quit Windows.

          2. At the MS-DOS prompt, type the following command for all

             logical drives

                dir <drive>:\commdlg.dll /s

             where <drive> is the drive on which your Windows

             directory is located, the drive on which you installed

             Microsoft Access, and each drive located in the PATH

             statement in your AUTOEXEC.BAT file.

          For versions of MS-DOS earlier than 5.0, you must either go

          into each directory and execute the above DIR command

          without the /S parameter, or use a utility to search for all

          occurrences of the COMMDLG.DLL file.

        - Make sure that the COMMDLG.DLL file is located in your Windows

          SYSTEM subdirectory only.

        - Make sure that the COMMDLG.DLL file is up to date. The file

should

          have one of the three dates below, or later:

             03/10/92    (for Microsoft Windows 3.1)

             10/01/92    (for Microsoft Windows for Workgroups)

             10/25/92    (for Microsoft Access)

        - Make sure that you are not using a third-party, incompatible

          COMMDLG.DLL file.

        - Make sure that no other applications are running with Windows

          before you run Microsoft Access Setup.

          You cannot update the COMMDLG.DLL file during installation

          if another application is currently using the file. To

          ensure that all other Windows-based applications are closed,

          use the following five steps:

          1. Create a temporary Program Manager group.

          2. Move all the icons from the Startup group into the

             temporary group.

          3. Back up your WIN.INI file. In the original copy, delete

             all the items from both the run= and the load= lines to

             read:

                [windows]

                run=

                load=

          4. Restart Windows.

          5. After installing Microsoft Access, move the icons from

             the temporary group back into the Startup group and

             restore the WIN.INI file from your backup. Quit and

             restart Windows.

       If you follow all the previous instructions and you still get

       an "Outdated DLL" error message, your copy of the COMMDLG.DLL

       file may be corrupt or damaged. To solve this problem,

       reinstall a new copy of this file from your Microsoft Access

       package using the following three steps:

       1. Copy the COMMDLG.DL_ file from Disk 1 of your Microsoft

          Access package to a directory on your hard disk.

           NOTE: Be sure to copy the COMMDLG.DL_ file, not the

           COMMDLG.DL$ file.

       2. Copy the EXPAND.EXE file from the appropriate Windows setup

          disk to the same directory you used in step 1.

       3. Use EXPAND.EXE to unpack the COMMDLG.DL_ file and place it

          in your Windows SYSTEM subdirectory. The syntax to complete

          this action is as follows

             <drive>:\<directory>\expand commdlg.dl_

             <destination>\commdlg.dll

          where <drive> and <directory> correspond to the location of

          EXPAND.EXE and <destination> is the drive and location of

          your Windows SYSTEM subdirectory.

       For additional information about outdated DLLs, please obtain

       Technical Notes #93694 and #90863. You can order these

       technical notes by selecting the FastTips Technical Library

       option from the Fast Tips Main Menu.

3.  Q. When I try to install Microsoft Access, Setup fails. What

       should I do?

    A. Setup problems are often caused by terminate-and-stay-resident

       (TSR) programs that are loaded at the

       MS-DOS level and/or at the Microsoft Windows level.

       To determine if TSRs are causing Setup to fail, remove all

       unnecessary TSRs and device drivers from the CONFIG.SYS and the

       AUTOEXEC.BAT files, remove all icons from the Startup group in

       Program Manager, and delete all entries under the load= and

       run= lines in your WIN.INI file.

        NOTE: Be sure to back up your CONFIG.SYS, AUTOEXEC.BAT, and

        WIN.INI files before modifying them.

       The table below describes some TSRs that are known to cause

       problems with the Microsoft Access Setup program:

          Filename       Description

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

          APPEND.EXE     An MS-DOS TSR loaded in the AUTOEXEC.BAT file

          SUBST.EXE      An MS-DOS TSR loaded in the AUTOEXEC.BAT file

          BILLMNDR.EXE   An automated bill reminder loaded with Quicken(R)

                         that can reside on the load= line of the

                         WIN.INI file

       For additional troubleshooting steps to resolve Setup problems,

       please obtain Technical Note #96109. You can order this

       technical note by selecting the FastTips Technical Library

       option from the FastTips Main Menu.

 4. Q. A directory called MS-SETUP.T is left on my hard disk after I

       install Microsoft Access. Can I safely delete this directory?

    A. Yes. After Microsoft Access installation is complete, it is

       okay to delete the MS-SETUP.T directory and all the files in

       it.

       This directory is not deleted automatically because of a known

       problem that occurs in Microsoft Access Setup when you choose

       the Reboot Your System After Completing Setup option. If you

       choose the Return To Windows After Setup option instead,

       Microsoft Access automatically deletes the

       MS-SETUP.T directory and its contents.

5.  Q. Why do I get a general protection (GP) fault when I run Setup?

    A. Running the Microsoft Access version 1.1 Setup program in

       Windows standard mode results in a GP fault. To run Setup

       correctly, run it in Windows 386 enhanced mode instead. To

       start Windows in 386 enhanced mode, type the following at the

       MS-DOS prompt:

          win /3

6.  Q. The AccessWizards are unavailable after I upgrade to Microsoft

       Access version 1.1. How do I get the AccessWizards to work?

    A. If the AccessWizards button is unavailable when you create a

       new form or report, it is likely that the MSACCESS.INI file was

       not properly updated. To solve this problem, use the following

       three steps:

       1. Rename your current MSACCESS.INI file to a different name,

          such as MSACCESS.BAK. The MSACCESS.INI file is located in

          your Windows program directory.

       2. Back up any database (.MDB) files that you have created.

       3. Run the Microsoft Access Setup program again.

       The MSACCESS.INI file should now be correctly updated.

Additional reference words: 1.00 1.10 appnote

KBCategory:

KBSubcategory: FstQa


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: 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: 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: 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 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 for Library Being Opened Before Database

Article ID: Q109738

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

If you try to open a Microsoft Access library without first opening a

database, the following error message is displayed:

   A Run-Time error occurred in Database: <Library Name>.

   You don't have permission to view the Modules in this Database.

This article discusses a technique for handling this situation using error

trapping in 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.

MORE INFORMATION

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

You can have a function in your Library determine whether a database is

open by trapping for an error. For example, if a function in the library

tries to open a form without a database first being opened, error number

2046 will be returned with the error message "Command Not Available:

OpenForm."

You can trap this error message and display a more useful error message

using the method demonstrated in the following sample error handler:

   On Error GoTo Errhand

   Errhand:

      'Display error number with error meaning

      MsgBox "Error # - " & Str(Err) & " - " & Error$

      If Err = 2046 Then

         'Display user-customized error message

         MsgBox "Please open a database first"

         Exit Function

      End If

REFERENCES

==========

Microsoft Access "Introduction to Programming," version 1.0, Chapter 6,

"Handling Run-Time Errors," pages 69-78

For more information on libraries, search for "library databases" then

"Customizing MSACCESS.INI Settings" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: MdlLib


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: 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: Two Users Can Open the Same dBASE Database Exclusively

Article ID: Q90882

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

Two Microsoft Access users can attach the same dBASE file over a network,

even though one or both open the database using the Exclusive option in the

Open Database dialog box.

MORE INFORMATION

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

If more than one user attempts to attach a dBASE database file

using the Exclusive option in the Open Database dialog box, the

attach action completes successfully, even though another user may

already have attached that database exclusively.

However, even though both users are able to attach the table, only

one of the attached users is able to open the table. If the second user

attempts to open the table, he or she receives the error message:

   Couldn't Open File <filename>

If you start two sessions of Microsoft Access on the same computer and

attempt the procedure above, you get the same response, except that

you receive the error message:

   Database Exclusively Locked

There is no exclusive database lock in dBASE; records in files are locked,

not the entire file. In other words, one user can open a database

exclusively, and a second user can open it shared or exclusively.

Therefore, the exclusive database lock can only be recognized by Microsoft

Access when it controls both attempts to open the same file from the same

computer.

REFERENCES

==========

For more information about attaching dBASE files, search for "dBASE files"

using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 locking

KBCategory:

KBSubcategory: IsmXbase


INF: Two Ways to Edit Forms Without Adding New Records

Article ID: Q103256

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article demonstrates two methods for creating a form to edit data

without adding new records.

The first method uses a macro to move the insertion point to the last

record when you try to go to a new record. The second method uses a query

that makes it impossible to add a new record and also prevents a blank new

record.

MORE INFORMATION

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

Method 1: Macro Method

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

1. Create a new macro called EditOnlyMacro:

      Condition:               Action

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

      [Product ID] Is Null     DoMenuItem

                                  Menu Bar: Form

                                  Menu Name: Records

                                  Command: GoTo

                                  Subcommand: Last

2. Open the Products form in Design view. In the OnCurrent property,

   add the name of the macro that you created above.

Method 2: Query Method

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

Editing the Products Table Without Adding New Records:

This example makes it possible to edit records in the Products table

without adding any new records. The Categories table is the "one" side

(also called the "parent") and the Products table is the "many" side of

this one-to-many relationship. The linked field, Category ID, is from the

Categories table.

If the table in which you want to edit records is not on the "many" side of

the one-to-many relationship, one method you can use to create a parent

table is shown below:

1. Create a new query called EditOnlyQuery:

      Type: Select Query

      Join: Categories.[Category ID] <-> Products.[Category ID]

      Field: Category ID

         Table: Categories

      Field: Product ID

         Table: Products

      Field: Supplier ID

         Table: Products

      Field: Product Name

         Table: Products

      Drag the rest of the fields down from the Products table

   NOTE: The Category ID field is from the Categories table, not the

   Products table.

2. Open the Products form in Design view. Change the RecordSource

   property of the Products form from Products to EditOnlyQuery.

Editing the Categories Table Without Adding New Records:

The above method depends on using the ID field of the parent table in a one-

to-many relationship. If the table you want to edit does not have a parent

table, you can create one. For instance, if you want to edit data in the

Categories table, but not add new records, do the following:

1. Create a new table called NewParent as follows with one primary key

   field:

      FieldName: ID

         DataType: Number

         FieldSize: Byte

2. Save the table, then switch to Datasheet view.

3. Type "1" (without quotation marks) in the first record, then close the

   table.

4. Open the table that you want to edit in Design view, and add the

   following field:

      FieldName: EditOnlyJoin

         DataType: Number

         FieldSize: Byte

5. Now type "1" (without quotation marks) in every record. Hint: Use an

   update query to do this.

6. Establish a relationship between the NewParent table and the

   Categories table. The NewParent table is the "one" side and the

   Categories table is the "many" side of the one-to-many

   relationship. (In the Database window, choose Edit Relationships

   from the Edit menu to establish the relationship.)

7. Add the NewParent and Categories tables in a query (see Method 2

   above). Be sure that this new query has the ID field from the NewParent

   table and does not have the EditOnlyJoin field from the Categories

   table.

Additional reference words: 1.00 1.10 Forms

KBCategory:

KBSubcategory: GnlDe


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 a Separate Table When a Value Changes on a Form

Article ID: Q95445

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article shows by example how to have Microsoft Access automatically

update a field in a table when you use a form to change a related field

in a different table. In other words, you can have Microsoft Access post

your changes to a separate table that is not bound to the form.

To set this up, you need to:

 - Add a text box control to the form.

 - Create a new macro group (UpdateOther) that contains two macros

   (SaveValue and ChgValue) to run the update query.

 - Create an update query (IDChgQuery in this example).

 - Change several properties to execute the macros.

MORE INFORMATION

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

This example uses the Products form in the sample database NWIND.MDB. Here

is the step-by-step procedure:

1. Open the NWIND.MDB database, and make a few modifications to set it up

   for this example. First, delete the relationship between the Products

   and Order Detail tables. Then, because you cannot update fields that

   have a Counter data type, change the following properties of the Product

   ID field in the Products table:

      Table: Products

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

      Field Name: Product ID

         DataType: Number

         FieldSize: Long Integer

2. Open the Products form in Design view, and display the property sheet.

   Set the following form and control properties:

      Form: Products

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

      OnCurrent: UpdateOther.SaveValue

      AfterUpdate: UpdateOther.ChgValue

      Field: Product ID

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

      Locked: No

   These actions activate the macros, which in turn run the update query.

3. Add an unbound text box control to the form, and give it the following

   properties:

      Control: Text box

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

      ControlName: Previous ID

      Visible: No

4. Create a new macro group (UpdateOther) to hold two macros (SaveValue and

   ChgValue) by first choosing to create a new macro. Next, choose Macro

   Names from the View menu or click the Macro Names button on the toolbar.

   Microsoft Access displays the Macro Name column.

5. Enter the two macro names along with their actions and action arguments.

   Each macro in the macro group begins on the line that contains that

   macro's name. Use the following table as a guide:

      Macro Name   Action and Action Arguments

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

      SaveValue    SetValue

                      Item:        [Previous ID]

                      Expression:  [Product ID]

      ChgValue     SetWarnings

                      Warnings On: No

                   OpenQuery

                      Query Name:  IDChgQuery

                      View:        Datasheet

                      Data Mode:   Edit

                   SetValue

                      Item:        [Previous ID]

                      Expression:  [Product ID]

6. Save the macro group, and name it UpdateOther. Now UpdateOther appears

   in the list of macros in the Database window. You can use the following

   syntax to specify each macro in the macro group:

      macrogroupname.macroname

   For example, UpdateOther.SaveValue specifies the save value macro.

7. Create a new update query called IDChgQuery. Add the table Order Details

   to the query. In the Field cell, enter Product ID. In the Update To

   cell, enter Forms![Products]![Product ID]. In the Criteria cell, enter

   Forms![Products]![Previous ID]. Here is a SUMMARY

      Query: IDChgQuery

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

      Tables: Orders Detail

         Field:     Product ID

         Update To: Forms![Products]![Product ID]

         Criteria:  Forms![Products]![Previous ID]

Now, when using the Products form, which is bound to the Products table, if

you enter a new value in the Product ID field, Microsoft Access updates the

Product ID column in the Orders Detail table automatically. It does it by

running the UpdateOther.SaveValue macro to save the previous value to use

as criteria and then the UpdateOther.ChgValue macro to run the IDChgQuery

update query. The IDChgQuery query updates the Product ID column in the

Orders Detail table overwriting the previous old value with the new value.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsEvnt


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 of Constants as Field Names in a Query

Article ID: Q98792

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

If you use a constant (Yes, No, True, False, On, Off, or Null) as a

field name in a table and then create a query that uses any of those

fields, you receive the following error message:

   Invalid use of '.', '!', or '()' in query expression <Table>.<Field>

where <Table> is the name of the table you are using in the query and

<Field> is the name of the field in question.

A constant represents a numeric or string value that does not change.

In some respects, a constant is like a variable or a reserved word.

Unlike a variable, however, the value of a constant cannot change

during program execution.

If you receive the above error message, you must change your field

name at the table level.

REFERENCES

==========

For more information, search for "Constants" using the Help menu.

Additional reference words: 1.00 1.10 Queries ErrMsg

KBCategory:

KBSubcategory: QryOthr


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 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 a Subtract Query to Find Unmatched Records

Article ID: Q95326

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to create a Subtract query to compare two

tables and return a dynaset that includes only those records from the

first table that do not have matching records in the second table.

MORE INFORMATION

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

The following example demonstrates how to create a query on two joined

tables that subtracts the matching records, returning only those records

that do not match on the joined field:

NOTE: The following example assumes that you have two tables in your

database called Table1 and Table2 that can be joined on at least one

field.

1. Create a new query based on Table1 and Table2.

2. Join the two tables on the appropriate field. Microsoft Access will

   join the tables automatically if there is an underlying relationship

   between them.

3. Double-click the join line between the tables. In the Join Properties

   dialog box, select either type 2 or type 3, whichever is most

   appropriate for your data. For this example, you want all the records

   from Table1 and only those that match from Table2--a type 2 join.

4. Drag the joined field from Table2 to the query grid. Clear the Show

   check box. Set the Criteria field to "Is Null" (without quotation

   marks).

5. Drag any other needed fields from Table1, such as the primary key

   field, to the query grid. These are the columns that identify

   unmatched records.

6. Run the query. The Is Null condition in the first column ensures that

   only those records from Table1 that do not have a match in Table2

   will be returned.

The following is a sample SQL SELECT statement that uses the sample

database NWIND.MDB. It returns all the customers who have not placed an

order:

   SELECT DISTINCTROW Customers.[Company Name]

   FROM Orders, Customers,

   Customers LEFT JOIN Orders

   ON Customers.[Customer ID] = Orders.[Customer ID]

   WHERE ((Orders.[Customer ID] Is Null));

REFERENCES

==========

For more information about unmatched records in version 2.0, search for

"Find Unmatched Query Wizard" then "Creating a Query with a Wizard" using

the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 unmatched differences

KBCategory:

KBSubcategory: QryJoin


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 Indexes in Microsoft Access

Article ID: Q104828

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article discusses how and when Microsoft Access uses indexes. This

information is provided to assist you in designing tables, indexes, and

queries that can be executed quickly.

MORE INFORMATION

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

This article is divided into three parts, as follows:

1. General Information (storage of Microsoft Access tables and indexes)

2. Rules and Limitations (when indexes can be used)

3. Examples (example queries and their associated indexes)

GENERAL INFORMATION

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

Table Storage

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

Microsoft Access stores information in 2K pages. Each table is made up

of a 2K header page and as many 2K data pages as are needed to store

the data in the table. Records are placed in a table in the order in

which they are entered.

Index Storage

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

Indexes are also stored in 2K pages. Each index consists of a header

page and leaf pages. Leaf pages contain a key generated from the value

of the field that is indexed and a pointer to the 2K page on which

that record resides.

Table Statistics

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

Microsoft Access maintains information on the approximate number of

records in each table and the number of data pages on which that table

resides. This information is used to determine the most effective

way to locate or retrieve data in a table.

Query Optimization

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

The process of determining the fastest method to access data is called

query optimization. Records in a single table can be retrieved using a

base table scan or an indexed search, as described below:

Base Table Scan:

A base table scan involves reading each record in the table and

determining whether or not it matches the criteria.

The drawback to this method is that each 2K data page must be loaded

into memory and then each record examined. However, when the query

includes most of the data in the table, or at least one record each

from a majority of the data pages, a base table scan can be faster

than an indexed search.

Indexed Search:

When an index is used, Microsoft Access searches the index for the

first occurrence of the specified data and then loads into memory the

2K data page that contains the record to which the index points.

The drawback to this method is that both index pages and data pages

must be loaded and read. In addition, an entire 2K page must be loaded

into memory for each record reference by the index. However, when the

criteria in the query restricts the results to a relatively small

group of records, an indexed search may be much faster than a base

table scan.

RULES AND LIMITATIONS

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

Microsoft Access can use indexes to perform the following three tasks:

1. To order records in a query.

   NOTE: Adding an index does not mean that your records are automatically

   sorted. The only way to ensure that the records in a query are sorted is

   to add an ORDER BY clause.

2. To select records that meet a specific criteria. That criteria must

   be in one of the following formats:

    - = "value"

    - IN (valuelist)

      or the equivalent: = "value" OR = "value" OR = "value"

    - like "string*"

    - between

    - >=  >  <  <=

3. To join two tables.

Will an Index Always Be Used?

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

The process of query optimization in Microsoft Access includes

determining the fastest way to retrieve records from each table in the

query. Each method available to Microsoft Access is considered and

assigned a cost. That cost is based on several factors, including the

following:

 - How will the data be used?

 - How many records total are there in the table?

 - How large is the index?

To understand why one method might be preferable over another,

consider the following scenario:

   The user wishes to view all records in the Orders table, sorted

   by order date. There is an index on the Order Date field. There are

   approximately 50 records on each 2K page in the Orders table.

   The total time to read each page and then to sort the records using

   a base table scan may actually be faster than using the index on

   the Order Date field. To use the index, Microsoft Access must load

   the first page of the index, load one 2K page for each record to

   which the index points, then move to the next page in the index.

   However, Microsoft Access has the ability to display the first

   screen of data while completing the remainder of the query in the

   background. For this form, Microsoft Access would likely use the

   index to quickly retrieve the first 30 or so records, populate the

   form so that the user can start working, and then retrieve the

   remaining records as they are needed.

EXAMPLES

========

NOTE: Specific tables listed in the examples below can be found in the

sample database NWIND.MDB.

1. Q. How can I speed up a query that joins two tables?

   A. By indexing the fields that are being joined in each of the tables.

      This action allows Microsoft Access to quickly find all records

      in the second table that match each primary key in the first

      table. Microsoft Access then uses the statistics from each table

      to determine the order in which to access them. For example,

      if you are joining the Customers and Orders tables, verify that

      the fields Customers.Customer ID and Orders.Customer ID are

      indexed.

2. Q. Example: SELECT [orders].* FROM orders ORDER BY [order id],

      [customer id];

      If there is a primary key on the Order ID field, would it help to

      have an index on the Customer ID field?

   A. In this case, all records from the Orders table are being

      retrieved; thus, it would not be beneficial to use the Primary

      Key index. However, it would be helpful, if the query is used to

      browse data, to have a compound index on the Order ID and

      Customer ID fields.

3. Q. Assuming a compound primary key on the Order ID, Customer ID,

      Employee ID fields, would the following syntax be used in the

      queries below?

   A. 1) SELECT [orders].* FROM orders ORDER BY [order id],

         [customer id], [employee ID];

         If you are browsing, yes, because the goal is to fill the

         first screen quickly and an index allows you to do that. If you

         are reporting, no, because the goal is to complete the report

         quickly and sorting is generally faster than traversing an

         entire index.

      2) SELECT [orders].* FROM orders ORDER BY [order id],

         [customer id];

         The answer to #1 applies to this query also. Microsoft Access

         can use one of several keys of an index, as long as it is the

         first part of the key that is used.

      3) SELECT [orders].* FROM orders ORDER BY [customer id],

         [employee ID];

         No, the index would not be used because the first field in

         the index is not included.

4. Q. Assuming a primary key on the Order ID field and an index on the

      Customer ID and Order Date fields, would either be used to execute

      the following queries?

   A. 1) SELECT [orders].* FROM orders ORDER BY [order id]

         WHERE [customer id] = "AAA"?

         Assuming the restriction is fairly comprehensive, Microsoft

         Access would use the Customer ID/Order Date index to solve

         the restriction and then to sort. Using the index on the

         Order ID field would be wasteful. It is possible to traverse

         the entire Order ID index, looking at each row to evaluate

         the restriction; however, this method is extremely slow,

         unless many records meet the criteria (Customer ID = "AAA").

      2) SELECT [orders].* FROM orders ORDER BY [order id] WHERE

         [customer id] = "AAA" And [Order Date] = "5/5/92".

         The answer to #1 applies to this query also. Assuming you use

         the Customer ID/Order Date index, Microsoft Access includes

         the Order Date restriction in the index seek.

      3) SELECT [orders].* FROM orders ORDER BY [order id] WHERE

         [customer id] = "AAA" OR [Order Date] = "5/5/92"

         Microsoft Access cannot use the index to solve the Order Date

         restriction.

      4) SELECT [orders].* FROM orders ORDER BY [order id] WHERE

         [customer id] = "AAA" and [Order Date] LIKE "5/5/*"

         The answer to #1 and #2 applies to this example as well.

      5) SELECT [orders].* FROM orders ORDER BY [order id] WHERE

         [customer id] = "AAA" Or [Order Date] like "5/5/*"

         No, as in #3, the index cannot be used.

5. Example: WHERE col1 > value1 and col1 < value2

   Microsoft Access can use an index on col1 to retrieve only those

   records that meet the specific criteria.

6. Example: WHERE col1 < value and col2 > value

   Microsoft Access must decide between the index on col1 or the index

   on col2.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: QryOthr


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 PrtDevMode Property to Set Print Setup Dialog Box

Article ID: Q109828

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes the PrtDevMode property. While this property is

documented in the Microsoft Access Distribution Kit (ADK) documentation,

the information applies to the retail product as well.

MORE INFORMATION

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

The PrtDevMode property sets or returns the device mode information

specified in the Print Setup dialog box for a datasheet, form, report, or

module.

The PrtDevMode property setting is a 64-byte structure that mirrors the

DEVMODE structure defined in the Microsoft Windows Software Development Kit

(SDK). The PrtDevMode property has the following members:

 - DeviceName: A 32-character string that specifies the name of the device

   the driver supports--for example, "HP LaserJet IIISi" in the case of the

   Hewlett-Packard LaserJet IIISi. Each driver has a unique string.

 - SpecVersion: An integer that specifies the version number of the DEVMODE

   structure in the SDK. For Microsoft Windows version 3.1, this value

   should be 0x30A.

 - DriverVersion: An integer that specifies the printer driver version

   number assigned by the printer driver developer.

 - Size: An integer that specifies the size, in bytes, of the DEVMODE

   structure. (This value does not include the optional dmDriverData member

   for device-specific data, which can follow this structure.) If an

   application manipulates only the driver-independent portion of the data,

   you can use this member to find out the length of this structure without

   having to account for different versions.

 - DriverExtra: An integer that specifies the size, in bytes, of the

   optional dmDriverData member for device-specific data, which can follow

   this structure. If an application does not use device-specific

   information, you should set this member to 0.

 - Fields: A Long value that specifies which of the remaining members in

   the DEVMODE structure have been initialized. It can be any combination

   (or it can be none) of the following values:

      Constant         Value

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

      DM_ORIENTATION   &H0000001

      DM_PAPERSIZE     &H0000002

      DM_PAPERLENGTH   &H0000004

      DM_PAPERWIDTH    &H0000008

      DM_SCALE         &H0000010

      DM_COPIES        &H0000100

      DM_DEFAULTSOURCE &H0000200

      DM_PRINTQUALITY  &H0000400

      DM_COLOR         &H0000800

      DM_DUPLEX        &H0001000

      DM_YRESOLUTION   &H0002000

      DM_TTOPTION      &H0004000

   A printer driver supports only those members that are appropriate for

   the printer technology.

 - Orientation: An integer that specifies the orientation of the paper. It

   can be either 1 (portrait) or 2 (landscape).

 - PaperSize: An integer that specifies the size of the paper to print on.

   You can set this member to 0 if the length and width of the paper are

   specified by the PaperLength and PaperWidth members, respectively.

   Otherwise, the PaperSize member can be set to one of the following

   predefined values:

      Value   Meaning

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

      1       Letter (8.5 x 11 in.)

      2       Letter Small (8.5 x 11 in.)

      3       Tabloid (11 x 17 in.)

      4       Ledger (17 x 11 in.)

      5       Legal (8.5 x 14 in.)

      6       Statement (5.5 x 8.5 in.)

      7       Executive (7.25 x 10.5 in.)

      8       A3 (297 x 420 mm)

      9       A4 (210 x 297 mm)

      10      A4 Small (210 x 297 mm)

      11      A5 (148 x 210 mm)

      12      B4 (250 x 354)

      13      B5 (182 x 257 mm)

      14      Folio (8.5 x 13 in.)

      15      Quarto (215 x 275 mm)

      16      11 x 17 in.

      18      Note (8.5 x 11 in.)

      19      Envelope #9 (3.875 x 8.875 in.)

      20      Envelope #10 (4.125 x 9.5 in.)

      21      Envelope #11 (4.5 x 10.375 in.)

      22      Envelope #12 (4.25 x 11 in.)

      23      Envelope #14 (5 x 11.5 in.)

      24      C size sheet (17 x 22 in.)

      25      D size sheet (22 x 34 in.)

      26      E size sheet (34 x 44 in.)

      27      Envelope DL (110 x 220 mm)

      28      Envelope C5 (162 x 229 mm)

      29      Envelope C3 (324 x 458 mm)

      30      Envelope C4 (229 x 324 mm)

      31      Envelope C6 (114 x 162 mm)

      32      Envelope C65 (114 x 229 mm)

      33      Envelope B4 (250 x 353 mm)

      34      Envelope B5 (176 x 250 mm

      35      Envelope B6 (176 x 125 mm)

      36      Envelope (110 x 230 mm)

      37      Envelope Monarch (3.875 x 7.5 in.)

      38      6-3/4 Envelope (3.625 x 6.5 in.)

      39      US Std Fanfold (14.875 x 11 in.)

      40      German Std Fanfold (8.5 x 12 in.)

      41      German Legal Fanfold (8.5 x 13 in.)

      256     User-defined

 - PaperLength: An integer that specifies the paper length in tenths of a

   millimeter. This member overrides the paper length specified by the

   PaperSize member, either for custom paper sizes or for devices such as

   dot-matrix printers that can print on a variety of paper sizes.

 - PaperWidth: An integer that specifies the paper width in tenths of a

   millimeter. This member overrides the paper width specified by the

   PaperSize member.

 - Scale: An integer that specifies the factor by which the printed output

   is to be scaled. The apparent page size is scaled from the physical page

   size by a factor of Scale/100. For example, a letter-size paper with a

   Scale value of 50 contains as much data as a page measuring 17 by

   22 inches, because the output text and graphics are half their

   original height and width.

 - Copies: An integer that specifies the number of copies printed if the

   printing device supports multiple-page copies.

 - DefaultSource: An integer that specifies the default bin from which the

   paper is fed. This member can be one of the following values:

      Value   Meaning

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

      1       Upper or only one bin

      2       Lower bin

      3       Middle bin

      4       Manual bin

      5       Envelope bin

      6       Envelope manual bin

      7       Automatic bin

      8       Tractor bin

      9       Small-format bin

      10      Large-format bin

      11      Large-capacity bin

      14      Cassette bin

      256     Device-specific bins start here

 - PrintQuality: The printer resolution. Following are the four predefined

   device-independent values:

      Value   Meaning

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

      -4      High resolution

      -3      Medium resolution

      -2      Low resolution

      -1      Draft resolution

 - Color: An integer that defines whether a color printer is to render

   color or monochrome output. Possible values are:

      Value   Meaning

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

      1       Color

      2       Monochrome

 - Duplex: An integer. For a printer capable of duplex printing, specifies

   whether the output is printed on both sides of the paper. This member

   can be set to one of the following values:

      Value   Meaning

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

      1       Simplex

      2       Horizontal

      3       Vertical

Only drivers that are fully updated for Windows version 3.0 and later and

that export the ExtDeviceMode function use the DEVMODE structure. An

application can retrieve the paper sizes and names supported by a printer

by calling the DeviceCapabilities() function with the DC_PAPERS,

DC_PAPERSIZE, and DC_PAPERNAMES values.

Drivers can add device-specific data immediately following the DEVMODE

structure.

The following example demonstrates how to use the PrtDevMode property to

specify the number of copies to print for a report:

   Function SetCopies (MyReport As String, Copies As Integer)

      Dim dm As zwtDevModeStr

      Dim DevMode As zwtDeviceMode

        DoCmd Echo False

      DoCmd OpenReport MyReport, A_DESIGN

      If Not IsNull(Reports(MyReport).PrtDevMode) Then

         dm.rgb = Reports(MyReport).PrtDevMode

         LSet DevMode = dm

         DevMode.dmCopies = Copies

         LSet dm = DevMode

         Reports(MyReport).PrtDevMode = dm.rgb

         DoCmd SetWarnings False

         DoCmd DoMenuItem 7, A_FILE, 2

         DoCmd Close A_REPORT, MyReport

         DoCmd SetWarnings True

      End If

      DoCmd Echo True

   End Function

The next example demonstrates how to set the paper size for a report:

   Sub SetPaperSize (MyReport As String, MyPaperSize As Integer)

      Dim dm As zwtDevModeStr

      Dim DevMode As zwtDeviceMode

           DoCmd Echo False

      DoCmd OpenReport MyReport, A_DESIGN

      If Not IsNull(Reports(MyReport).PrtDevMode) Then

         dm.rgb = Reports(MyReport).PrtDevMode

         LSet DevMode = dm

         DevMode.dmPaperSize = MyPaperSize

         LSet dm = DevMode

         Reports(MyReport).PrtDevMode = dm.rgb

         DoCmd SetWarnings False

         DoCmd DoMenuItem 7, A_FILE, 2

         DoCmd Close A_REPORT, MyReport

         DoCmd SetWarnings True

      End If

           DoCmd Echo True

   End Sub

REFERENCES

==========

Microsoft Access "The Secrets of AccessWizards," pages 21-26 (NOTE: This

manual is available from Microsoft Sales Information Center at

1 (800) 426-9400. It is part number 077-050-039, and costs $9.95.)

Additional reference words: 1.00 1.10 PtrIss

KBCategory:

KBSubcategory: PrtaccOthr


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

Article ID: Q95047

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

MS-DOS, Microsoft Windows, and Windows-based applications use

SHARE.EXE to provide a file locking mechanism so that Windows-based

tasks can communicate with each other. The tasks use SHARE.EXE to sort

out file read/write conflicts. Therefore, it is important that you

load SHARE.EXE before starting Windows. Without SHARE.EXE loaded, you

may experience data corruption in applications.

Using SHARE.EXE with Microsoft Access allows multiple users to access a

database at the same time while protecting them from updating the same

record at the same time. If a database is opened exclusively by one

user, no other users will be able to use the database until the first

user releases it. However, if all users open the database in a shared

mode, SHARE.EXE allows all users to read and write to the database

simultaneously, with the exception of locked records. For example, if

a user has record 100 open on a particular database, that record is

considered locked, and no other users will be able to change any data

in record 100 until the first user finishes changing it.

For this reason, while it is possible to run Microsoft Access without

first loading SHARE.EXE, Microsoft does not recommend it. If you choose

not to use SHARE.EXE, you must ensure that only one Windows-based task

writes to a database record at any given moment.

MORE INFORMATION

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

MS-DOS uses SHARE.EXE to lock files as requested by applications.

SHARE.EXE controls updates and prevents data corruption in files.

An application can request a deny-read lock (exclusive), a deny-write

lock, or both. Deny-write locks allow other applications to read data,

but prevent two different applications from updating the same file at

the same time.

SHARE.EXE also provides byte-range locks. When a range of bytes is

locked, other applications cannot read, write, or lock those bytes.

Other, unlocked bytes, in the file are not affected. An application

can use byte-range locks to place exclusive locks on records for

record-level locking.

In single-user environments, SHARE.EXE prevents file contention

accidents when multiple instances of a program attempt to write to the

same database or database record at the same time. In multiple-user

environments such as networks, SHARE.EXE prevents possible database

corruption when several different network users attempt to write to

the same database or database record at the same time.

Microsoft Windows for Workgroups

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

The only time you do not have to use SHARE.EXE is when you run

Microsoft Windows for Workgroups in Enhanced mode. Microsoft Windows

for Workgroups in Enhanced mode loads and uses a file-sharing program

called VSHARE.386, which is a replacement for SHARE.EXE. There is an

entry for VSHARE.386 in the SYSTEM.INI file.

If you plan on running Windows for Workgroups exclusively in Enhanced

mode and do not run other applications that require SHARE.EXE, you can

save approximately 5K of conventional memory by not loading SHARE.EXE. To

do this, remove the SHARE.EXE line from your AUTOEXEC.BAT file and

restart your computer.

SHARE.EXE is likely to be in your AUTOEXEC.BAT file because during the

Microsoft Access installation process, the SETUP.EXE program

automatically inserts the following MS-DOS command in your AUTOEXEC.BAT

file:

   <MS-DOS directory>\SHARE.EXE /L:500

If SHARE.EXE is already present before running Microsoft Windows for

Workgroups in Enhanced mode, VSHARE.386 loads in addition to SHARE.EXE,

temporarily disabling SHARE.EXE. Then VSHARE.386 takes over file sharing

tasks until you exit Microsoft Windows for Workgroups. After you exit

Windows for Workgroups, VSHARE.386 passes file-sharing control back to

SHARE.EXE for use by MS-DOS applications that require it.

Microsoft Access runs correctly with either SHARE.EXE or VSHARE.386,

but SHARE.EXE limits the number of available locks to the number

specified when SHARE.EXE was loaded. The /L parameter specifies the

number of share locks; the default is 20. VSHARE.386, on the other

hand, dynamically allocates the number of locks available based on the

demand for locks. The number of locks available is especially

important if the computer running Microsoft Windows for Workgroups

acts as a server in a client-server environment.

Additional reference words: 1.00 1.10 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 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 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 TransferDatabase Macro to Attach to SQL Server Data

Article ID: Q88658

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

This article describes how to use the TransferDatabase macro action to

attach data in backend SQL tables.

MORE INFORMATION

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

You can use the TransferDatabase macro action to import from, export to,

or attach an external data source. This article describes how to attach

data in a SQL Server table.

When you create a macro that uses the TransferDatabase macro action, you

need to supply the following macro-specific arguments:

Transfer Type:  For this type of transfer, choose ATTACH.

Database Type:  This is the type of the external database source that

                is being attached. In this case, select <SQL DATABASE>.

Database Name:  With SQL Server, a connect string supplies the

                necessary information.

Object Type:    The type of object being attached in this case is a

                TABLE.

Source:         The name of the table in the SQL Server table goes

                here.

Destination:    This is the name of the table as it is seen in the

                Microsoft Access Database window.

Structure Only: Depends on whether the data should be attached, also.

                In most cases (as well as this case) this should be

                NO.

The connect string (Database Name) is a string of items or parameters

that defines the remote data source and the user's identification. The

connect string includes the following items:

DATA SOURCE NAME (DSN):        The name of the SQL Server computer.

DATABASE QUALIFIER (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 will prompt the user with a dialog box to enter this

information at the time the macro is executed. Note that password

information is case sensitive in SQL Server.

The following is a sample connect string to SQL Server. Note that it

begins with "ODBC", which tells the system that it will use the ODBC

driver (as opposed to an installable ISAM driver):

   ODBC;DSN=ServerX;Database=Pubs;WSID=wrkstn1;UID=JohnDoe;PWD=MARCH

This string would be placed in the Database Name argument of the

TransferDatabase action.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ObcOthr


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 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: Validating Data with Values From Another Table

Article ID: Q96973

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SUMMARY

=======

The text below presents two examples that demonstrate setting the

ValidationRule property to use values in a different table. You must

use either the DCount() or DLookup() function to do this.

You can use a validation expression to compare the value entered by

the user with a value in one or more other tables. You can create a

validation rule to accept only values that exist in a second table or

to reject values that exist in a second table.

MORE INFORMATION

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

Example 1: Using the DCount() Function

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

In the following example, the user can enter into "Table1" only those

values that exist in the "Field" field of "Table2."

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

continuation character. Remove the underscores when re-creating these

examples.

   Table: Table1

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

   Field Name: Field Name

   DataType:  Text

   Validation Rule: DCount("[Field]","Table2","[Field]='" &_

                          [Field in Table1] & "'") > 0

In the following example, the user can enter into "Table1" only those

values that do not exist in the "Field" field of "Table2."

   Table: Table1

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

   Field Name: Field Name

   DataType:  Text

   Validation Rule: DCount("[Field]","Table2","[Field]='" &_

                          [Field in Table1] & "'") = 0

Example 2: Using the DLookup() Function

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

In the following example, the user can enter into "Table1" only those

values that exist in the "Field" field of "Table2."

   Table: Table1

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

   Field Name: Field Name

   DataType:  Text

   Validation Rule: DLookup("[Field]","Table2","[Field]='" &_

                         [Field in Table1] & "'")Is Not Null

In the following example, the user can enter into "Table1" only those

values that do not exist in the "Field" field of "Table2."

   Table: Table1

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

   Field Name: Field Name

   DataType:  Text

   Validation Rule: DLookup("[Field]","Table2","[Field]='" &_

                         [Field in Table1] & "'")Is Null

Replace "Field" with the appropriate field name in your database (be

sure to preserve the quotation marks and square brackets). Replace

"Table2" with the name of the validation table in your database and

replace "Table1" with the name of the table in which you are entering

data.

DCount() searches through the specified field in the validation table

and counts all records where the field name is equal to the value

entered in the table. If the function returns a value greater than

zero, the function found one or more matching records.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 45 and 652

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlValid


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: Version 1.1 Online Help and Text Files

Article ID: Q103989

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

The information in this article applies to:

 - Microsoft Access version 1.1

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

SUMMARY

=======

This article lists all the online Help and text files included with

Microsoft Access version 1.1. The information in the text files is not in

the printed documentation that ships with Microsoft Access.

MORE INFORMATION

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

The table below lists the filename, whether the file is installed by the

Upgrade or full package, whether the file is installed in the Access

directory or the Windows SYSTEM directory, and a description of the file.

Filename      Package   Directory     Description

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

MSA110.HLP    Upgrade   Access        What's new in 1.1?

README.TXT    Both      Access        Supplement to documentation

NOTE: Slightly different versions of the README.TXT file are installed by

the Upgrade and full Microsoft Access packages.

ANALYZER.TXT  Full      Access        Database Analyzer

ERRATA.TXT    Full      Access        Errors in documentation

ORDENTRY.TXT  Full      Access        Order entry information

ORDENTRY.HLP  Full      Access        Order entry information

PIM.HLP       Full      Access        PIM help information

MSACCESS.HLP  Full      Access        Includes 1.0 and 1.1 Help

BTRIEVE.TXT   Both      Access        Btrieve information

PERFORM.TXT   Both      Access        Enhancing performance

NOTE: the following four files are installed only when you run the ODBC

Setup program that is shipped on a separate disk with both the Upgrade and

full packages.

DRVSSRVR.HLP  Both      System        SQL Server access information

DRVORACL.HLP  Both      System        Oracle access information

ORACLE.TXT    Both      System        Oracle access information

ODBCINST.HLP  Both      System        ODBC Driver Manager install Help

Note that if the Microsoft Access Setup program detects that you are not

using the most current version of the Windows for Workgroups driver, Setup

will stop and refer you to the WFWDRV.TXT file. This file is on Disk 1, and

is not installed to your hard disk.

Additional reference words: 1.10

KBCategory:

KBSubcategory: StpOthr


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: "Database Already in Use" Error After Running Query

Article ID: Q109353

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SYMPTOMS

========

You receive the error message "Couldn't use '<database name>'; database

already in use" when you close a database after running a query containing

a subquery or crosstab query based on an empty table or another query.

You must quit Microsoft Access and restart it in order to restore proper

operation. In some cases, the database may become corrupt, and may result

in a database that remains corrupt even after you run the Repair Database

command and receive notification that the database was repaired

successfully.

RESOLUTION

==========

To work around this problem, add some records to the empty underlying

table. Or, you can use a DLookUp() function to make sure all referenced

tables contain records before running the query.

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.

MORE INFORMATION

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

If a parameter query is the subquery for a query, and you do not enter

anything in the parameter box, the subquery will return an empty set, and

will cause the error stated above.

Steps to Reproduce Problem

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

 1. Start Microsoft Access and either create a new database or open one

    of your choosing.

 2. Create a new table called Table1 with the following structure:

      Field   Type

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

      f1      text

      f2      text

      f3      text

      z1      long integer

 3. Create another new table called Table2 with the following

    structure:

       Field   Type

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

       f4      text

       f5      text

       z2      long integer

 4. Create a new query called Query1 based on Table1.

 5. Click the Totals button.

 6. Drag all fields from Table1 to the query grid.

 7. Choose Group By in the Total row for all fields. The SQL

    statement (choose SQL from the View menu) should look like:

       SELECT DISTINCTROW Table1.f1, Table1.f2, Table1.f3, Table1.z1

       FROM Table1

       GROUP BY Table1.f1, Table1.f2, Table1.f3, Table1.z1

       WITH OWNERACCESS OPTION;

 8. Create a second query called Query2. Add Query1 and Table2 to the

    new query.

 9. Place a join line between field z1 in Query1 and field z2 in

    Table2.

10. Drag the f1 and f2 fields from Query1 to the query grid. The

    SQL statement should look like:

       SELECT  DISTINCTROW Query1.f1, Query1.f2

       FROM Query1, Table2,

       Query1 INNER JOIN Table2 ON Query1.z1 = Table2.z2

       WITH OWNERACCESS OPTION;

11. Do not enter any data. Instead, open Query2 and close the database

    from the Control menu of the Database window.

Additional reference words: 1.00 1.10 Queries

KBCategory:

KBSubcategory: QryOthr


PRA: "Illegal Function Call" Error When Exporting Module

Article ID: Q109951

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SYMPTOMS

========

When you run an Access Basic procedure to export a module from one

Microsoft Access database to another containing a module of the same name,

you receive the error message "Illegal function call."

RESOLUTION

==========

There are two methods for working around this problem:

 - Use a macro with the TransferDatabase action to export the module.

 - Verify that no module in the destination database has the same name

   as the module you want to export. If necessary, change the name of

   the module before exporting it.

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.

MORE INFORMATION

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

Steps to Reproduce Problem

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

1. Create a copy of the sample database NWIND.MDB. Name the copy

   DEST.MDB.

2. Open the NWIND.MDB database.

3. Create a new module with the following sample code, and then save

   the module as SourceMod.

   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

      Function ExportSourceMod ()

         DoCmd TransferDatabase A_EXPORT, "Microsoft Access", "DEST.MDB",_

            A_MODULE, "SourceMod", "DestMod"

      End Function

4. In the module's Immediate window, type the following, and then press

   ENTER:

      ? ExportSourceMod ()

   The SourceMod module will be exported to the DEST.MDB database.

5. Repeat step 4. This time, you will receive the error message stated

   above, since the module already exists in the destination database.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, "TransferDatabase

Action," pages 473-476

Microsoft Access "User's Guide," version 1.0, pages 525 and 583

Microsoft Access "User's Guide," version 1.1, pages 529 and 587

For more information about the TransferDatabase action, search for

"TransferDatabase" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: PgmOthr


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 Argument" Error Message Exporting Table

Article ID: Q109375

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

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

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

SYMPTOMS

========

The error message "Invalid argument" is displayed when you export a table

from Microsoft Access with either the Word For Windows Merge or the "Text

(Delimited") format.

CAUSE

=====

The table you are exporting is an attached SQL table that contains a field

with a Text data type, which is equivalent to a Microsoft Access Memo

field.

RESOLUTION

==========

To work around this problem you can:

 - Choose a different format to export to, such as dBASE.

 - Use a make-table query to copy the SQL table to a local Microsoft

   Access table, and then export the new table.

 - Export only fields from the SQL table that do not have a Text data

   type. To do this, create a select query that contains only fields

   that do not have a Text data type, then use the TransferText macro

   action to export the query results.

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.

MORE INFORMATION

================

You can use the SQL Server sp_help stored procedure to determine which

fields in the attached SQL Server table have a Text data type.

For example, for a SQL table called MyAddressList that contains a field

called Notes that has a Text data type, the sample command

   sp_help MyAddressList

would return a listing similar to:

   Name             Owner        Type

   ----------------------------------------

   MyAddressList    dbo          user table

   Column_name      Type         Length  Nulls

   -------------------------------------------

   EntryNumber      int          4

   Name             varchar      30

   ... other fields ...

   Notes            text         16

Note that "text" appears in the Type column for the Notes field.

Steps to Reproduce Problem

--------------------------

NOTE: This article assumes that you are familiar with Microsoft SQL Server

and the tools used to administer a Microsoft SQL Server database and

tables.

1. Use the following sample SQL statements to create a table called

   "MyAddressList" on the SQL Server:

      USE <A valid SQL database name here>

      CREATE TABLE MyAddressList

         (

         EntryNumber int null,

         Name varchar(30) null,

         Notes text null

         )

      CREATE UNIQUE NONCLUSTERED INDEX I_EntryNumber

      ON MyAddressList (EntryNumber)

2. Attach the MyAddressList table to a Microsoft Access database by

   choosing Attach from the File menu in Microsoft Access.

3. Export the attached table with either the Word For Windows Merge or

   the "Text (Delimited)" format.

An error message will be displayed.

REFERENCES

==========

For more information on exporting queries, query on the following words

here in the Microsoft Knowledge Base:

   export and query and transfer

Microsoft Access "User's Guide," version 1.0, pages 66-68 and page 163

Microsoft Access "User's Guide," version 1.1, pages 67-68, 84-87, and

page 167

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmTxtd


PRA: "Invalid Reference to Field in Query" Error Message

Article ID: Q105657

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The message

   Invalid reference to field 'Field Name' in query

occurs when you are printing or previewing a graph from Form view, or when

you are printing a graph on a report from print preview.

CAUSE

=====

The data source for the graph is a parameter query. The parameter query is

run one time to collect the values required to display the graph in Form

view or print preview. Once the parameters are collected through the Enter

Parameter Value box, they no longer exist. When you try to print the graph,

the graph must be regenerated from the underlying data. Since the

parameters are no longer available and are not prompted for again, the

error message stated above is generated.

RESOLUTION

==========

Rather than enter the parameters using the Enter Parameter Value box, the

parameters for the query should come from a source that is available while

the form is active. Modify the query so that the parameters are referenced

directly from a second form.

The following example demonstrates how to use a second form to collect the

values:

1. Open the sample database NWIND.MDB. Create a blank, unbound form called

   Parameter Form with the following controls and properties:

      Form: Parameter Form

      Text box

         ControlName: Beginning Date

      Text box

         ControlName: Ending Date

      Command button

         Caption: Open Graph Form

         OnPush: Graph Form.Open

2. Create a new macro called Graph Form with the following actions:

      MacroName      Action         Defined Below

      -------------------------------------------

      Open           SetValue             1

                     OpenForm             2

      Close          Close                3

      Graph Form Actions

      ------------------------------------------

      1. SetValue

            Item: Forms![Parameter Form].Visible

            Expression: False

      2. OpenForm

            Form Name: Graph Form

            View: Form

            Filter Name: <leave empty>

            Where Condition: <leave empty>

            Data Mode: Edit

            Window Mode: Normal

      3. Close

            Object Type: Form

            Object Name: Parameter Form

3. Open the Employee Sales By Country (Parameter) query in Design view.

4. Change the criteria row for the Shipping Date column from

      Between [Beginning Date] And [Ending Date]

   to:

      NOTE: In the following example, an underscore (_) is used as a line-

      continuation character. Remove the underscore when re-creating this

      example.

      Between Forms![Parameter Form]![Beginning Date] And _

      Forms![Parameter Form]![Ending Date]

5. From the Query menu, choose Parameters. Change the parameters to be:

      Parameter                                    Data type

      ------------------------------------------------------

      Forms![Parameter Form]![Beginning Date]      Date/Time

      Forms![Parameter Form]![Ending Date]         Date/Time

   NOTE: Your query may not have parameters explicitly defined in the

   Parameters dialog box; however, it is good practice to do so.

6. Open the Graph Form and alter the OnClose property to be:

      OnClose: Graph Form.Close

7. Open the Parameter Form form and type "1/1/92" (without the quotation

   marks) in the first box, and type "12/31/92" (without the quotation

   marks) in the second box. Choose the Open Graph Form button.

   Note that when you choose the Open Graph Form button, a macro hides the

   parameter form and then opens the graph form. Although the parameter

   form is hidden, it is still open, and the values on it are still

   available for the query that the graph is based on.

8. From the File menu, choose Print Preview.

Since the parameter form remains open, and the values on it are still

available, the graph can be regenerated for printing. In contrast, the

Enter Parameter Value box values are available only at the time the

parameter is entered.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. Open the sample database NWIND.MDB. Create a blank, unbound form and

    save it with the name Graph Form.

 2. Click the graphing tool in the toolbox, and then click in the blank

    form to start the GraphWizard.

 3. In the "Also, Select a Data Source for Your Graph" box, select

    Employee Sales By Country (Parameter).

 4. Choose Next to advance to the next screen.

 5. In the Available Fields box, select Sale Amount. Choose the ">" button

    to add it to the Fields For Graph box.

 6. In the Available Fields box, select Salesperson, and then choose ">".

 7. Choose Next to advance to the next screen.

 8. Choose the Design button.

 9. From the View menu, choose Form.

10. Type "1/1/92" (without the quotation marks) in the Beginning Date

    parameter value box, and then choose OK.

11. Type "12/31/92" (without the quotation marks) in the Ending Date

    parameter value box, and then choose OK. A bar graph will be displayed.

12. From the File menu, choose Print Preview.

The error message: "Invalid reference to field 'Beginning Date' in query"

will be displayed.

REFERENCES

==========

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IntpGrph


PRA: "Table Does Not Exist" Error Message When Deleting Table

Article ID: Q101370

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

In Microsoft Access version 1.x, if an Access Basic function creates a

table with a QueryDef() function, and then attempts to delete that table,

the following error message appears:

   Table does not exist.

The new table does not get deleted, and is not displayed in the Database

window until the window is refreshed.

CAUSE

=====

If the Database window is displaying the tables while the function is

being run, the Database window must be refreshed to display the

new table before it can be deleted.

RESOLUTION

==========

Refresh the Database window before attempting to delete the table. To

do this, choose another object (for example, forms) in the Database window,

then display the tables again.

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.

MORE INFORMATION

================

The following function uses the sample database NWIND.MDB to

demonstrate how to create the table and then successfully delete it.

Make sure that you choose Table in the Database window before you run

the function 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.

   Function DeleteThisTable ()

      Dim mydb As Database, myq As QueryDef

      Set mydb = CurrentDB()

      Set myq = mydb.CreateQueryDef("createtablequery")

      'Create the Table

      myq.sql = "SELECT  DISTINCTROW Customers.[Customer ID], _

                   Customers.[Company Name] INTO test FROM Customers;"

      myq.Execute

      'Choose any object other than Table to refresh Database

      'window.

      'NOTE: Omit the following line to reproduce the problem:

      DoCmd SelectObject A_FORM, "Customers", True

      'Delete the table

      DoCmd SelectObject A_TABLE, "test", True

      DoCmd DoMenuItem A_DATABASE, A_EDIT, A_DELETE

   End Function

Additional reference words: 1.00 1.10 QueryDef refresh errmsg

KBCategory:

KBSubcategory: TblModfy


PRA: 255-Char String Displays Only 254 Characters with ODBC

Article ID: Q100658

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you attach a remote table using ODBC, data in 255-character fields in

the attached table appears to be truncated after the 254th character.

CAUSE

=====

A data buffer is set one character too small to display all the data in

the field. Note that only the display is being truncated, the data itself

is unchanged.

RESOLUTION

==========

Create a Memo or Note field to contain data that is 255 characters long.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.1. This problem no longer occurs in Microsoft Access version 2.0.

Steps to Reproduce Problem

--------------------------

1. Create a table in ORACLE or Microsoft SQL Server containing the

   following SQL statements:

    In Oracle:      CREATE TABLE Bug (Id NUMBER(10,0),

                           Field1 CHAR(255))

                    CREATE UNIQUE INDEX BugPK ON Bug(ID)

    In SQL Server:  CREATE TABLE Bug (Id INT, Field1 CHAR(255))

                    CREATE UNIQUE INDEX BugPK ON Bug(ID)

2. Attach and view the table in Microsoft Access.

3. In the ID field, enter the number 1. In Field1, enter 255 characters.

4. Commit the record.

   Result: Only 254 characters are displayed in Field1.

An easy way to test this procedure is to create a macro called

AutoKey, as follows:

   MacroName     Action

   ----------------------

   ^A            SendKeys

   AutoKey Actions

   ---------------

   SendKeys

      Keystrokes: {TAB}{a 255}

      Wait: No

If you reopen the table, move to the 255-character column, and press

CTRL+A, the SendKeys action automatically enters the letter "a" 255

times.

ORACLE is manufactured by Oracle Corporation, a vendor independent of

Microsoft; we make no warranty, implied or otherwise, regarding this

product's performance or reliability.

Additional reference words: 1.10 ODBC Oracle truncate

KBCategory:

KBSubcategory: ObcOthr


PRA: Access Hangs Importing Big Lotus 1-2-3 Spreadsheets

Article ID: Q96972

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

Your computer stops responding ("hangs") when you are attempting to

import a large spreadsheet (more than 64,000 cells) into Microsoft Access.

CAUSE

=====

The Lotus 1-2-3 spreadsheet import option in Microsoft Access is

limited to 64,000 formatted cells. By default, Lotus 1-2-3 formats

all cells with the general format if they are not explicitly set to

some other format by the user. As a result, if a Lotus 1-2-3

spreadsheet to be imported has more than 64,000 cells, then

Microsoft Access cannot import it and the system may hang during

the import process.

RESOLUTION

==========

To import a Lotus 1-2-3 spreadsheet with more than 64,000 cells,

you must first split the spreadsheet into separate spreadsheets

so that the number of cells in each does not exceed 64,000.

The spreadsheet must be split--importing subranges from large

spreadsheets does not eliminate the problem.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

version 1.0. This problem was corrected in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: IsmLotus


PRA: ApplyFilter Action Causes Form to be Read- Only

Article ID: Q99318

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

Running a macro that contains an ApplyFilter action may cause a form

to become read-only. This problem occurs if the form is based on a

query that contains two tables with a one-to-many relationship and

only records from the one side are included in the output of the

query.

RESOLUTION

==========

There is no way to prevent the ApplyFilter action from making the form

read-only. However, you can use one of the following methods to filter

the records displayed in a form:

 - Base the form on a parameter query. The user will then be prompted

   for the criteria with which to filter the records each time the form

   is opened. For more information on parameter queries, refer to pages

   178-181 in the Microsoft Access "User's Guide."

 - Place the form in another form as a subform. Set up the LinkMaster

   and LinkChild properties so that one or more fields in the main form

   filter the data in the subform. For more information on subforms,

   refer to the pages 272-278 in the Microsoft Access "User's Guide."

 - Use Access Basic code to control the records displayed in the form.

   For more information, refer to pages 106-107 in the Microsoft Access

   "Introduction to Programming" manual.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

version 1.0. This problem no longer occurs in version 1.1.

Steps to Reproduce Problem

--------------------------

1. In the sample database NWIND.MDB, create a new query based on the

   Customers and Orders tables. Join the tables on [Customer ID].

2. Drag all fields from the Customers table to the query grid. Drag

   down [Order ID] from the Order table. Add the criteria: >10080 and

   clear the Show box.

3. Save the query and create a new form based on it. Drag several

   fields from the field list to the form.

4. Create a macro with an ApplyFilter action. Set the macro's Where

   Condition argument to:

      [Company Name] Like "c*"

5. Save the macro and drag it onto the form.

6. Switch to Form view. Verify that you can edit fields.

7. Press the macro button to apply the filter.

You can no longer edit or add records.

Additional reference words: 1.00 dynaset lock query

KBCategory:

KBSubcategory: McrActn


PRA: Cannot Add Counter Columns to Tables with > 4 MB Data

Article ID: Q97003

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You cannot add Counter data type columns to existing tables

containing roughly greater than 4 megabytes (MB) of data.

CAUSE

=====

This problem occurs because of a limitation in the Microsoft Access

transaction model, which is limited to a transaction size of about 4 MB.

The problem occurs with Counter columns because the table data for

columns is updated when the new column is added. The update takes

place in a transaction, and with large tables (greater than 4 MB),

the update encounters the Microsoft Access transaction size limit.

When this happens, the transaction rolls back and the Counter

column is not successfully added.

RESOLUTION

==========

Use the following steps to add a Counter column to a large table:

1. Copy and paste the table's structure (not the table's data) to a

   new table.

2. Add a Counter data type column to the new table.

3. Create an append query that transfers the data from the old table

   to the new table.

4. Verify that the new table has the correct data.

5. Delete the old table.

6. Rename the new table to the name of the old table.

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.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlOthr


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 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: Cannot Paste Data from Clipboard Using DDE

Article ID: Q104682

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to paste data into a dynamic data exchange (DDE) server

application from Microsoft Access, the process does not complete correctly

and the following error message is generated:

   The other application won't perform the DDE method or operation you

   attempted.

If you are using Microsoft Word for Windows as your DDE server application,

the error message "WordBASIC Err=102 Command failed" will appear in Word

for Windows.

If you are using Microsoft Excel as your DDE server application, the error

message "Cannot paste data" will appear in Microsoft Excel.

CAUSE

=====

Microsoft Access does not "render," or place, the data on the Clipboard

until an application requests the data for pasting. (This technique

provides improved performance with large pieces of data.) When Microsoft

Access issues the DDEExecute command to tell the DDE server application to

paste the data, it waits for that command to finish before allowing any

other operation to take place. When the DDE server application receives the

paste command, it requests that Microsoft Access place the data on the

Clipboard. However, Microsoft Access will not do this because it is

waiting for the DDEExecute command to finish.

RESOLUTION

==========

The following sample Access Basic function called RenderClipboard() can be

called to force Microsoft Access to render the data to the Clipboard before

issuing the DDEExecute command:

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.

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.

   '*********************************************************

   ' MODULE DECLARATION SECTION

   '*********************************************************

   Declare Function OpenClipboard% Lib "User" (ByVal hWnd%)

   Declare Function GetClipboardData% Lib "User" (ByVal wFormat%)

   Declare Function CloseClipboard% Lib "User" ()

   Global Const CF_TEXT = 1

   Function RenderClipboard ()

       Dim RetVal As Integer

       RetVal = OpenClipboard(0)

       RetVal = GetClipboardData(CF_TEXT)

       RetVal = CloseClipboard()

   End Function

The following example demonstrates how to use the RenderClipboard()

function:

1. Start Microsoft Word for Windows. The default document Document1 should

   be open.

2. Start Microsoft Access. Open the sample database NWIND.MDB.

3. Create a new module, and enter the following Access Basic function:

      Function CopyRecordToWinword ()

         Dim RetVal, Chan

         ' Copy the current record to the clipboard

         DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_SELECTRECORD

         DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_COPY

         RetVal = RenderClipboard()

         Chan = DDEInitiate("winword", "Document1")

         DDEExecute Chan, "[EditPaste]"

         DDETerminate Chan

      End Function

4. Open the Customers form in Design view and add a command button with the

   following properties:

      Caption: Copy to Record

      OnPush: =CopyRecordToWinword()

5. Change to Form view, and choose the Copy To Winword button. The record

   will be pasted into the Word for Windows document.

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.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Word for Windows. The default document Document1 should

   be open.

2. Start Microsoft Access. Open the sample database NWIND.MDB.

3. Create a new module, and enter the following Access Basic function:

      Option Explicit

      Function CopyRecordToWinword ()

         Dim RetVal, Chan

         ' Copy the current record to the clipboard

         DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_SELECTRECORD

         DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_COPY

         Chan = DDEInitiate("winword", "Document1")

         DDEExecute Chan, "[EditPaste]"

         DDETerminate Chan

      End Function

4. Open the Customers form in Design view and add a command button with the

   following properties:

      Caption: Copy to Record

      OnPush: =CopyRecordToWinword()

5. Change to Form view, and choose the Copy To Winword button. Word for

   Windows will generate the error message: "WordBASIC Err=102 Command

   failed."

NOTE: To reproduce the problem with Microsoft Excel, use the following

Access Basic function instead of the function listed above:

   Option Explicit

   Function CopyRecordToExcel ()

      Dim RetVal, Chan

      ' Copy the current record to the clipboard

      DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_SELECTRECORD

      DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_COPY

      Chan = DDEInitiate("Excel", "Sheet1")

      DDEExecute Chan, "[Paste()]"

      DDETerminate Chan

   End Function

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IntpDde


PRA: Cannot Unhide Windows After "Out of Memory" Message

Article ID: Q90147

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

If you receive an "Out Of Memory" error message after you have hidden many

Microsoft Access windows you may be unable to unhide, or Show, any of the

hidden windows. You will still be able to continue to hide additional

windows.

CAUSE

=====

In order for Microsoft Access to show hidden windows, the Windows "Unhide

Windows" dialog box must be brought up. This requires memory. If Windows

has previously detected insufficient memory and generated an "Out of

Memory" error message this dialog box cannot be called. Therefore, you will

not be able to choose Show from the Microsoft Access Window menu to unhide

your windows.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem no longer occurs in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: PgmErr


PRA: Combo or List Box Column Not Formatted

Article ID: Q106307

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A column in a combo or list box displays information without the formatting

you specified for the field in the underlying table or query.

CAUSE

=====

Microsoft Access does not use the format specified in the Format property

for a field in a table or query when the data is being displayed in a combo

or list box. Information contained in a table field will be displayed with

the default format for the data type when the data is being displayed in a

combo or list box. For example, Date/Time fields will display with the

General Date format, and numbers will display with the General Number

format.

RESOLUTION

==========

Base the combo or list box on a query, and format the field using the

Format() function in a calculated query. The following example demonstrates

how to use the Format() function in a query to format a field:

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Orders table:

      Query: Order Date Query

      -------------------------------------------------------------

      Type: Select Query

         Field: New Order Date: Format([Order Date], "Medium Date")

         Table: Orders

3. Run the query. Note that the date is formatted with the Medium Date

   format.

4. Save the query as Order Date Query, and then close the query.

5. Create a new, blank, unbound form. Add a combo box with the

   following properties:

      Combo Box: Order Dates

      ---------------------------

      RowSourceType: Table/Query

      RowSource: Order Date Query

      ColumnCount: 1

6. View the form in Form view.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create the following new query based on the Orders table:

      Query: Order Date Query

      -----------------------

      Type: Select Query

      Field: Order Date

         Table: Orders

3. Run the query. Note that the date is formatted with the Medium Date

   format.

4. Save the query as Order Date Query, and then close the query.

5. Create a new, blank, unbound form. Add a combo box with the

   following properties:

      Combo Box: Order Dates

      ---------------------------

      RowSourceType: Table/Query

      RowSource: Order Date Query

      ColumnCount: 1

6. View the form in Form view.

Note that the date is displayed with the General Date format.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 126-128

Microsoft Access "User's Guide," version 1.1, pages 130-132

Microsoft Access "Language Reference," version 1.0, pages 202-219

Additional reference words: 1.00 1.10 listbox combobox ADK

KBCategory:

KBSubcategory: FmsCmbo


PRA: Control Still Appears on Page After GotoPage Action

Article ID: Q104825

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

After the GotoPage macro action runs and a new page is displayed, the

contents of the last control on the source page still appear on the new

page.

CAUSE

=====

The GotoPage macro action was run from a macro that is attached to the

AfterUpdate property of a control.

RESOLUTION

==========

Do not include a GotoPage macro action in a macro attached to the

AfterUpdate property of a control. Instead, use the GotoPage action in

a macro attached to the control's OnExit property.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a new macro with the following action, and then save it with the

   name GotoPage2:

      GotoPage

         PageNumber: 2

2. Create a new, unbound form.

3. Size the detail section of the form to be 4 inches tall.

4. Place a page break control in the form's detail section at the vertical

   2-inch mark.

5. Place a combo box with the following properties in the upper half of the

   detail section, above the page break control:

      RowSourceType: Value list

      RowSource: 1;2;3;4

      AfterUpdate: GotoPage2

6. Place a text box in the lower half of the form's detail section, below

   the page break control.

7. Size the Form window so that only the upper half of the detail section

   is visible.

8. View the form in Form view.

9. Make a selection in the combo box.

The form will advance to page 2, and the text box will be selected, as it

should be. However, the combo box will still be visible on the page and may

overlap the text box.

Additional reference words: 1.00 1.10 gotocontrol ghost

KBCategory:

KBSubcategory: PgmOthr


PRA: Creating Unbound Object Frame with CreateControl()

Article ID: Q104711

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you use the CreateControl() function with a controltype argument of

114 to create an unbound object frame, Microsoft Access causes a general

protection (GP) fault when you view the form in Form view.

CAUSE

=====

The CreateControl() function does not provide any method for specifying the

object to embed in the new control. Instead, an empty, unbound object frame

is created. Note that you cannot create an empty, unbound object frame when

you create the frame manually, since Microsoft Access displays an Insert

Object dialog box in which you must select the object to embed.

RESOLUTION

==========

The GP fault occurs because Microsoft Access does not expect to run with an

empty, unbound object frame. The CreateControl() function does not provide

any method of specifying the object to embed.

The following example demonstrates how to use the sample function

CreateUnboundObjectFrame() to create an unbound object frame using a

DoMenuItem action:

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, and enter the following:

      Function CreateUnboundObjectFrame (ByVal sFormName$, _

                                         ByVal sObjectPath$)

         A_FORMDESIGNBAR = 3

         A_INSERTOBJECT = 10

         DoCmd SelectObject A_FORM, sFormName

         SendKeys "%f" & sObjectPath & "{ENTER}"

         DoCmd DoMenuItem A_FORMDESIGNBAR, A_EDIT, A_INSERTOBJECT

      End Function

2. Create a new, unbound form. Save the form as Chess.

3. With the form open, select the Database window.

4. Create a new module.

5. In the module's Immediate window, type the following, and then press

   ENTER:

      ? CreateUnboundOjbectFrame("Chess", "c:\windows\chess.bmp")

NOTE: This example assumes that the CHESS.BMP file supplied with Microsoft

Windows is located in the C:\WINDOWS directory.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a new, unbound form. Save the form as CreateControlTest.

2. With the form open, select the Database window.

3. Create a new module. Enter the following sample function:

      Function CreateUnboundObjectFrame ()

         Dim C As Control

         Set C = CreateControl("CreateControlTest", 114)

      End Function

4. In the module's Immediate window, type the following, and then press

   ENTER:

      ? CreateUnboundObjectFrame()

5. View the CreateControlTest form in Form view. The following error

   message will occur:

      An error has occurred in your application. If you choose Ignore, you

      should save your work in a new file. If you choose Close, your

      application will terminate.

If you choose Close or Ignore several times, the following error message

will occur:

   MSACCESS caused a General Protection Fault in module MSACCESS.EXE at

   0096:50B6.

REFERENCES

==========

Microsoft Access "The Secrets of AccessWizards," pages 12-14

Microsoft Access "Language Reference," pages 151-152 and 433-434

Additional reference words: 1.00 1.10 ADK GPF

KBCategory:

KBSubcategory: PgmOthr


PRA: Crosstab Query with DLL Reference Fails

Article ID: Q104914

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

A crosstab query that calls a dynamic link library (DLL) from one of the

FormWizards will result in the error message "GPF in MSABC100.DLL at

0004:7BBC."

CAUSE

=====

DLL functions that are called from forms, macros, or queries that are

opened by Access Basic code will cause this problem.

Note that the financial functions in Microsoft Access call DLLs and will

frequently cause this problem. The problem occurs when you are trying to

use the ListFields method on a crosstab query that calls a DLL from the

wizard's Access Basic code. This problem can also be encountered when you

are referencing a crosstab query that calls a DLL from a CreateDynaset

method.

RESOLUTION

==========

The workaround for this problem is to put the function contained in the DLL

into an Access Basic function. Then, call the Access Basic function instead

of calling the DLL.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem was corrected in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: QryCross


PRA: Cue Cards Cannot Be Started from Workstation

Article ID: Q97625

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you try to run Cue Cards from a workstation set up for a network

installation of Microsoft Access, you receive the following error

message:

   Cue Cards Couldn't Be Started Because of Incomplete Setup.

CAUSE

=====

Microsoft Access has been set up to run from a network drive and the

path used to execute MSACCESS.EXE uses the universal naming convention

(UNC).

RESOLUTION

==========

For Cue Cards to run on a workstation, the path used to execute

MSACCESS.EXE from Program Manager must use the complete conventional

path, including the drive letter. To correct this problem, use the

following steps:

1. In Program Manager, select the Microsoft Access icon.

2. From Program Manager's File menu, choose Properties.

3. In the Command Line text box, type the complete path, including the

   drive letter for MSACCESS.EXE (for example, F:\ACCESS\MSACCESS.EXE).

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.

Additional reference words: 1.00 1.10 cuecards errmsg

KBCategory:

KBSubcategory: StpOthr


PRA: Dashed Lines in Graph Print as Solid Lines

Article ID: Q109373

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Graphs modified in Microsoft Graph so that they will display dashed value

lines will print with solid lines when you are using the HP LaserJet IIISi

version 2.1 printer driver that uses the universal printer driver

UNIDRV.DLL version 3.1.2.

CAUSE

=====

The problem is due to an interaction between Microsoft Access, the HP

LaserJet version 2.x printer drivers (which were written by Microsoft), and

the UNIDRV.DLL printer driver. The version 3.x printer drivers written by

Hewlett-Packard do not use the UNIDRV.DLL driver and do not exhibit this

problem.

RESOLUTION

==========

You can obtain the latest version of the Hewlett-Packard LaserJet printer

drivers from the Hewlett-Packard forum on CompuServe (type GO HPPER), or

contact Hewlett-Packard at (303) 353-7650.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

NOTE: You must install an HP LaserJet version 2.x printer driver in

Microsoft Windows in order to reproduce this problem.

1. Open the sample database NWIND.MDB.

2. Open the Sales By Category report in Design view.

3. Double-click the graph object to open the graph in Microsoft Graph.

4. From the Gallery menu, choose Line. Select graph 4, and then choose OK.

5. Double-click the value line in the graph, and then select a dashed

   line in the Style box. Choose OK.

6. Close Microsoft Graph. Choose Yes to update the report.

7. Print one or more pages of the report. Note that the dashed line prints

   as a solid line.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: DcmNwd


PRA: Database Corruption Error After Large Action Query

Article ID: Q104827

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Running a large action query, or importing a large number of records

(resulting in a table size of approximately 80 MB or more), results in the

error message:

   '|' is corrupt or isn't a Microsoft Access database

CAUSE

=====

This error occurs if Microsoft Access runs out of the memory it has

allocated to keep track of a table's indexes while you are inserting keys

into an index.

RESOLUTION

==========

When this memory space is completely filled, Microsoft Access cannot

proceed with the append, and it cannot discard the new information that has

been temporarily stored. Microsoft Access knows that the task has not been

completed successfully, and assumes that the database is corrupt. However,

because nothing was actually written to the database, the data is not

damaged. You can compact the database to make the data usable again.

For example, to carry out a large append, remove the table's indexes,

complete the append, and then add the indexes again. Be sure not to remove

the primary key if it is a Counter, because you could encounter the 4-MB

transaction limit when you attempt to add the Counter key back to the

table.

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.

Additional reference words: 1.00 1.10 errmsg pagedescriptors

KBCategory:

KBSubcategory: QryMktbl


PRA: DDEInitiate from Word Fails When Access Not Running

Article ID: Q106300

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to initiate a DDE conversation from Microsoft Word to

Microsoft Access, the DDEInitiate function will fail if Microsoft

Access is not already running.

CAUSE

=====

If the DDE connect request is sent by Microsoft Word before Microsoft

Access is fully initialized, the connect request is rejected.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Enter the following code in a new macro in Microsoft Word:

      iChan = DDEInitiate("MSAccess", "System")

      DDETerminate iChan

2. Save and run the macro. Be sure that Microsoft Access is in the

   PATH statement in the AUTOEXEC.BAT file, but not currently running.

3. Answer Yes to the message:

      The remote data (System) is not accessible. Do you

      want to start the application MSAccess?

You get the error message:

   WordBASIC Err=500

   Cannot Initiate Link

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IntpDde


PRA: DoMenuItem Run Macro Causes GP Fault

Article ID: Q105518

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Access Distribution Kit version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you run a macro that has a DoMenuItem that contains the Macro Run

commands, a general protection (GP) fault or "Out Of Stack Space" error

will occur.

RESOLUTION

==========

Use the RunMacro action instead of the DoMenuItem action to run a macro.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create the following macro:

      Macro Name    Action

      ------------------------

      RunMe         DoMenuItem

      RunMe Actions

      -------------

      DoMenuItem

         Menu Bar: Macro

         Menu Name: Macro

         Command: Run

2. Save and then close the macro.

3. Run the macro.

A GP fault will occur. If the macro is still open in Design view when you

run it, an "Out Of Stack Space" error will occur.

Additional reference words: 1.00 1.10 GPF ADK

KBCategory:

KBSubcategory: McrActn


PRA: Duplicate Control Menus and Restore Buttons on Form

Article ID: Q108440

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A maximized, continuous form has two Control (system) menus and two Restore

buttons.

CAUSE

=====

Duplicate Control menus and Restore buttons will appear on a form under the

following conditions:

 - The form is a maximized, continuous form.

 - The form's detail section is short, so multiple records are

   displayed in Form view.

 - A record in the lower part of the Form window is selected.

 - The form has a custom menu that activates another form.

 - The other form is activated from the custom menu and then closed.

RESOLUTION

==========

Add the following macro action to the beginning of the macro attached to

the custom menu that opens the second form:

    Action

    -------------------------

    DoMenuItem

       MenuMar: Form

       MenuName: Edit

       Command: Select Record

       Subcommand:

This macro action will select the current continuous form before opening

the second form. For example, to open a second form called Test2, use the

following macro actions:

    Action

    -------------------------

    DoMenuItem

       MenuMar: Form

       MenuName: Edit

       Command: Select Record

       Subcommand:

    OpenForm

       FormName: Test2

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. Open the sample database NWIND.MDB.

 2. Create the following new macro. Save it as Test Menu:

      Action

      --------------------------------

      AddMenu

         MenuName: View

         MenuMacroName: Test Menu View

 3. Create the following new macro. Save it as Test Menu View:

      Action

      ------------------

      OpenForm

         FormName: Test2

 4. Create a blank, unbound form. Add a text box to the form, and

    then save the form as Test2.

 5. Create a new form bound to the Customers table. Add the following

    properties to the form, and then save the form as Test:

      OnMenu: Test Menu

      DefaultView: Continuous Forms

 6. Create a text box bound to the Company Name field at the top of

    the Test form's detail section.

 7. Size the Test form's detail section so that it is as short

    (vertically) as possible.

 8. View the Test form in Form view.

 9. Maximize the form.

10. Click in the Company Name box in the record closest to the horizontal

    scroll bar (which is the lowest record visible on the form).

    NOTE: If you select a record closer to the top of the window, the

    problem will not occur.

11. From the View menu, choose Test2.

12. From the File menu, choose Close.

Note that the Test form now has two Control menus and two Restore buttons.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsProp


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 Message Using Access Basic to Import File

Article ID: Q109952

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You receive an "Application Error" message or a general protection (GP)

fault when you use Access Basic code to import files into Microsoft

Access.

CAUSE

=====

This problem occurs if you use the DoMenuItem action to open the Import

dialog box.

RESOLUTION

==========

Use the TransferDatabase, TransferSpreadsheet, or TransferText action

instead of the DoMenuItem action.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

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.

1. Create a module with the following in the Declarations section:

      Option Explicit

2. Create and run the following sample function:

      Function TestImport()

         DoCmd DoMenuItem 1,0,5

      End Function

The error message will occur as soon as you choose OK in the Import

dialog box.

The following sample function demonstrates how to use the TransferText

action to import a Text (Delimited) file:

1. Create a module with the following in the Declarations section:

      Option Explicit

2. Create and then run the following sample function:

      Function ImpText()

         DoCmd TransferText A_ImportDelim,,"ATABLE","C:\TEST.TXT"

      End Function

References

==========

Microsoft Access "Language Reference," version 1.1, pages 479-481

Additional reference words: 1.00 1.10 gpf errmsg transfer text

KBCategory:

KBSubcategory: IntpOthr


PRA: Error Msg: Data Has Changed, Operation Aborted

Article ID: Q93146

--------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

--------------------------------------------------------------------

SYMPTOMS

========

When a user (User1) attempts to commit a record in an attached Paradox

table and that record has been changed by another user (User2), User1

sees this error message:

   Data has changed; operation aborted.

After User1 chooses the OK button, a second error message appears:

   This record has been changed by another user since you

   began editing it...  Save Record, Copy to Clipboard,

   Drop Changes.

If User1 selects the Save Record option, the first error message is

repeated. User1 is caught in a continuous loop, unable to commit the

record.

RESOLUTION

==========

To save the changes made to the current record, User1 must:

1. Select the Copy to Clipboard option.

2. Select the record User1 was attempting to change.

3. Choose Paste from the Edit menu.

4. Commit the record.

User1 can prevent User2 from changing a record while User1 is editing

it by changing the multiuser option to Edited Records.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem no longer occurs in Microsoft Access version 1.1.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

These steps require either two users or two instances of Microsoft

Access.

1. Both users attach to a Paradox Table.

2. Both users set their multiuser options to No Locks.

3. User1 starts to edit a field but does not commit the record.

4. User2 changes and commits the same record by choosing Save Record from

   the File menu or by moving the cursor to the next record.

5. User1 attempts to commit the changed record.

   Error Message #1: Data has changed; operation stopped.

   Error Message #2: This record has been changed by another user since you

   began editing it... Save Record, Copy to Clipboard, Drop Changes.

Additional reference words: 1.00 Misc multi-user transaction errmsg

KBCategory:

KBSubcategory: IsmPdox


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: Error: Not Enough System Resources in Access

Article ID: Q96471

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

Running a Microsoft Access query can result in this error:

   Not enough system resources to update display.

CAUSE

=====

Changing the Row Height and Font after initially running a query causes

this error to occur the next time that query is run.

RESOLUTION

==========

Choose the OK button when you get the above error message. The query

runs and displays its results with the default settings. The next time

you run the query, no error will appear.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem was corrected in Microsoft Access version 1.1.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Run the Category List query. To run a query, choose the Query

   button in the Database window. Select the desired query, and then

   choose the Open button.

3. From the Layout menu, choose Row Height.

4. Change the setting to 12.0.

5. Choose Font from the Layout menu and change the font to Microsoft Serif

   and the font size to 10.

6. Switch the query to Design view and choose Run from the Query menu.

7. From the File menu, choose Close.

8. From the Database window, select the Category List query and

   choose Open.

The error message appears. After choosing the OK button (your only

option), you will see the query with the default row height, font, and

font point size. The next time you run the query, no error message

will appear.

REFERENCES

==========

For more information on changing the row height in a query, search for

"Row Height command" then "Row Height Command (Layout Menu)" using

the Help menu.

For more information on changing the font in a query, search for "Font

command" then "Font Command (Layout Menu)" using the Help menu.

Additional reference words: 1.00

KBCategory:

KBSubcategory: QryOthr


PRA: Formatted Memo Truncates Data at 255 Characters

Article ID: Q103998

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you apply formatting, such as a closing or opening angle bracket

(> or <), to a field with the Memo data type, the data in the field

appears truncated after the 255th character.

CAUSE

=====

When you apply formatting to a Memo field, it is treated as a Text

field, which has a 255-character limit. The data is not physically

truncated, but only 255 characters are viewable.

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.

Additional reference words: 1.00 1.10 Tables

KBCategory:

KBSubcategory: TblFldp


PRA: GP Fault Importing Multiuser Microsoft Excel Spreadsheet

Article ID: Q109342

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If you are importing a multiuser Microsoft Excel spreadsheet and someone

else tries to open the spreadsheet from Microsoft Excel during the import

process, you will receive a general protection (GP) fault error message,

such as:

   General Protection Fault in MSAJU110.DLL at 0007:006E2

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Import data from any Microsoft Excel spreadsheet. Use the default

   choice to create a new table in Microsoft Access.

3. While the data is being imported, attempt to open the same spreadsheet

   from Microsoft Excel on a different computer.

Additional reference words: 1.00 1.10 gpf adk

KBCategory:

KBSubcategory: IsmExl4


PRA: GP Fault in Datasheet View of a Form

Article ID: Q96467

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error messages when you switch a form to

Datasheet view:

 - An error has occurred in your application. If you choose Ignore, you

   should save your work in a new file. If you choose Close, your

   application will terminate.

 - MSACCESS caused a general protection fault in MSACCESS.EXE.

CAUSE

=====

A macro is assigned to the form's OnCurrent property, and the macro

includes a GoToControl action that sets the focus on a control located

in the page header section. There is no visible page header section

when you view the form in Datasheet view.

RESOLUTION

==========

If you are using a macro that includes a GoToControl action that sets

the focus on a control located in the page header section of the form,

do not view the form in Datasheet view.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a GoToControl macro that goes to any control on a form, and

   then assign the macro to the OnCurrent property of the form.

2. Place this control in the page header section of the form.

3. View the form in Datasheet view.

Additional reference words: 1.00 1.10 GPF

KBCategory:

KBSubcategory: FmsEvnt


PRA: GP Fault Printing Large Report with Low Disk Space

Article ID: Q102526

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You get a general protection (GP) fault when you try to print a large

report and have very little free hard disk space.

RESOLUTION

==========

Either free up hard disk space or reduce the size of your report.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Make sure that you have 12K or less of free disk space on your

   computer.

2. Start Microsoft Access and open the sample database NWIND.MDB.

3. Print the Customer Mailing Labels report.

   You receive a GP fault.

Additional reference words: 1.00 1.10 GPF Printing

KBCategory:

KBSubcategory: PtrOthr


PRA: GP Fault When Allocating Huge Arrays

Article ID: Q100175

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you try to allocate a huge array, you may receive a general

protection (GP) fault. The following error message appears:

   An error has occurred in your application. If you choose

   Ignore, you should save your work in a new file. If you choose

   Close, your application will terminate.

CAUSE

=====

If you have allocated an array element that includes a string or

variant data type and the size of the array exceeds 64K, you may

receive the error message described above, if the following criteria

are met:

 - The array must be huge and span two or more data segments.

 - Each array element must contain at least one dynamic string or

   variant.

 - The number and size of the array elements must cause the last

   segment of data to be exactly the same size as the first segment of

   data.

RESOLUTION

==========

Declare the array so that the last data segment contains a different

number of elements from the first data segment.

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.

MORE INFORMATION

================

Access Basic has the ability to define huge arrays, larger than the

normal 64K data segment. Any element or index of a huge array may not

extend across the 64K-segment boundary. If all elements of the array

cannot be allocated within the 64K segment, only the elements of the

array that fit evenly in the segment are allocated. Microsoft Access

then allocates another 64K segment to the array and continues to fill

the new segment with the remaining elements.

If the size of the data type defined in the array is a power of 2, the

64K segment is completely full. If the size is not a power of 2, the

segment contains wasted space, since Microsoft Access cannot place a

portion of one element in one segment and the rest of that element in

the next segment.

Example

-------

   Type Foosball

      A(3000) As double

      d As String

   End Type

The size of this structure is 24,012 bytes (3000 * 8 bytes/double +

12 bytes/string). If you declare this array with three elements, you

have two data segments, as follows:

   Data Segment  #1      Data Segment  #2

   -----------------     -----------------

   Free space 17512      Free space 41524

   Array(1)   24012      Array(3)   24012

   Array(2)   24012

In Microsoft Access, you may receive a GP fault if the number of

elements in the first segment is equal to the number of elements in

the last segment and the data structure used to define the array is

made up of either a string or variant data type. If you define the

data structure above with six elements, your memory map looks like the

following:

   Data Segment  #1      Data Segment  #2        Data Segment  #3

   -----------------     -----------------       -----------------

   Free space 17512      Free space 17512        Free space 17512

   Array(1)   24012      Array(3)   24012        Array(5)   24012

   Array(2)   24012      Array(4)   24012        Array(6)   24012

The actual dimension statement looks like the following:

   Function Sample()

      Redim Array(6) As Foosball

   End Function

To work around this problem, declare the array so that the last data

segment does not contain the same number of elements as the first data

segment. In addition to the example above, you may choose to define

the array with seven elements instead of six. This causes Microsoft

Access to allocate four data segments, in which the first data segment

contains two elements of the array and the last data segment contains

only one element.

This example is very easy to duplicate with large data structures, but

is more difficult to duplicate with smaller data structures. With an

element size of 24,012 bytes, 4, 6, or 8 elements may cause a problem.

With a data size of 1K, numbers of elements that duplicate this

problem are 128, 192, 256, and so forth.

Additional reference words: 1.00 1.10 GP fault GPF array

KBCategory:

KBSubcategory: PgmOthr


PRA: GP Fault when Creating a Dynaset from Form Dynaset

Article ID: Q98672

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When attempting to create a dynaset based on a form's dynaset, you

will get a general protection (GP) fault similar to:

   Application Error

   MSACCESS caused a General Protection Fault in module

   MSACCESS.EXE at 00B0:09B5

CAUSE

=====

This functionality is unsupported. Instead of returning an error

message explaining this, Microsoft Access causes a GP fault.

Microsoft Access does not support creating a dynaset based on a

form's dynaset.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem no longer occurs in Microsoft Access version 1.1.

MORE INFORMATION

================

In Microsoft Access version 1.0, the following steps will reproduce a

GP fault.

In Microsoft Access version 1.1, the following steps will correctly

return the following error message, indicating that this functionality

is not supported:

   Can't perform operation; it is illegal

Steps to Reproduce Problem

--------------------------

In the following example, the Clone method is used to create a

duplicate dynaset based on a form's dynaset. This is incorrect usage

of the Clone method.

1. Open the Categories form in the sample database NWIND.MDB.

2. Create a new module, with the following Declarations section:

'*********************************************************

      'Declarations Section of the module.

'*********************************************************

      Option Compare database

      Dim DS as Dynaset, DS2 as Dynaset, F as Form

3. From the View menu, choose the Immediate window.

4. Type the following lines in the Immediate window, pressing ENTER

   after each line:

      Set F=Forms!Categories![Categories Subform].Form

      Set DS=F.Dynaset.Clone()

      Set DS2=DS.CreateDynaset()

The error will occur after the third line.

REFERENCES

==========

For more information, search for "clone," then "Clone Method" using

the Microsoft Access Help menu.

Additional reference words: 1.00 gpf createdynaset

KBCategory:

KBSubcategory: PgmObj


PRA: GP Fault When Passing User-Defined Type with Array

Article ID: Q105647

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You get the error message "MSACCESS caused a General Protection Fault

(GP Fault) in module MSABC110.DLL at 000D:1AD4" when you attempt to

pass a user-defined type to a function or Sub procedure in which one

of the components of the user-defined type is an array.

This happens only under the following conditions:

 - The user-defined type contains an array.

 - You attempt to pass an array element of the user-defined type to

   a Sub procedure or function.

RESOLUTION

==========

A workaround for Microsoft Access version 1.1 is to explicitly cast

the data type of the array. For the example below, instead of

   Call GPFTest(Testing.StrArry())

you would explicitly cast the array as a string array by placing the

"$" character at the end of the array reference, such as:

   Call GPFTest(Testing.StrArry$())

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and create a new database and module.

2. In the Declarations section of the module, type the following:

      Type TestType

          StrArry(10) as String

      End Type

      Dim Testing as TestType

3. Create a Sub procedure called Start as follows:

      Sub Start()

         Testing.StrArry(1) = ""

         Call GPFTest(Testing.StrArry())

      End Sub

4. Create a Sub procedure called GPFTest as follows:

      Sub GPFTest(Testing() as String)

         For x=1 to 10

            Debug.Print Testing(x)   ' This line causes a GP Fault.

         Next

      End Sub

5. Start the code by running the Sub Start() function. To do this,

   give the focus to the Immediate window, type "Start," and press

   ENTER.

   You get the following error message:

      MSACCESS caused a General Protection Fault in module

      MSABC110.DLL at 000D:1AD4

Additional reference words: 1.00 1.10 Programming GPF

KBCategory:

KBSubcategory: PgmOthr


PRA: GP Fault When RunningSum Tries to Evaluate #ERROR

Article ID: Q97530

------------------------------------------------------------

---------

The information in this article applies to:

 - Microsoft Access version 1.0

------------------------------------------------------------

---------

SYMPTOMS

========

If a report contains a control whose expression evaluates to

a #ERROR

message, changing the RunningSum property to Over Group or

Over All

causes a general protection (GP) fault.

CAUSE

=====

This problem commonly occurs if you place the Sum() function

in a text

box that appears in the Page Footer section of your report.

Aggregate

functions, like Sum(), Count(), Avg(), and so forth, are not

supported

in page headers and footers and return a #ERROR message if

placed

there. Adding the RunningSum property to a control using the

aggregate

of the Sum() function causes the above GP fault, as does

adding the

RunningSum property to any control that returns a #ERROR

message.

RESOLUTION

==========

Either correct the expression in the ControlSource property

so that

it evaluates correctly, or move the location of the control

on the

report form.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft

Access

version 1.0. This problem was corrected in Microsoft Access

version

1.1.

REFERENCES

==========

For an example of how to place totals in page headers and

footers, see

pages 576-579 of the "User's Guide" for version 1.0.

Additional reference words: 1.00

KBCategory:

KBSubcategory: RptProp


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 Declaring New Object Variable During Break Mode

Article ID: Q97533

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When you declare a new object variable such as a form or table while your

code is in break mode (when you are debugging your Access Basic code) and

then recompile the code, a general protection (GP) fault occurs. The

following are examples of object variable declarations:

   Dim F as Form

   Dim T as Table

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem was corrected in Microsoft Access version 1.1.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. In a new or existing module, enter the following sample function:

      Function GP_Fault()

         z=Forms!Form!X

      End Function

2. Save and then close the module.

3. Create a new form. In the form's OnOpen property, enter:

      =GP_Fault()

4. Save and then close the form.

5. Open the form in Form view. You will receive the error message

   "Invalid reference to form 'Form'". Choose OK.

6. The module will open and the line "z=Forms!Form!X" will be selected.

   Add the following lines below the selected line:

      Dim T as Form

      Set T = Forms![GPF]

7. From the Run menu, choose Compile All.

8. Save and then close the module. When prompted to reset the halted

   code, choose OK.

Additional reference words: 1.00 WinIss

KBCategory:

KBSubcategory: EvnGpf


PRA: Group Footer Controls Calculate Twice at Page Break

Article ID: Q104980

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A group footer control that references a calculated detail control

returns incorrect results if the page break and group break occur at

the same time. The group footer control is off by the value of the

last detail record.

CAUSE

=====

Reference to a control with the RunningSum property applied from a

higher-level group footer causes the control's value to be added again

for the last cached running sum and to return incorrect data. All

cached field values are validated when you advance the page; this

occurs before the record is advanced, determining the end of the

group. Thus, the last record in a group is added twice.

RESOLUTION

==========

From the OnPrint event of the Detail section, call a macro that uses

the SetValue action to place the detail control's value in an unbound

group footer control.

The Detail section has the following OnPrint properties and control:

   OnPrint: Macro1

   ControlName: DetailTotal

      RunningSum: OverGroup

The Group Footer section has the following unbound control:

   ControlName: FooterTotal

   ControlSource: <blank>

Macro1 is called from the OnPrint event of the Detail section and has

the following action:

    SetValue

       Item=[FooterTotal]

       Expression=[DetailTotal]

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a grouping report.

2. Locate an unbound text box in the Detail section.

3. Set the ControlSource property of the text box to =1 and the

   RunningSum property to OverGroups.

4. Locate a second unbound text box in the Group Footer section.

5. Set the ControlSource property for the second text box to the

   ControlName of the first text box.

   When the last detail record for a group prints on page 1 and the

   group footer prints on page 2, the group footer control adds the

   value for the last record in the group twice.

   If the totals are derived from a user-defined function, you may be

   able to test this procedure (for instance, if the FormatCount or

   PrintCount properties of the report have been set to 2 and, if

   true, return 0 to the function). Another option may be to change

   the data type from Variant to Double.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, page 568

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RptTotal


PRA: Hang Importing .DBF Files Longer Than dBASE IV Max.

Article ID: Q97521

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

CodeBase++ version 1.07 allows you to create .DBF files where the

record length exceeds the dBASE IV maximum record length. Microsoft

Access may hang (stop responding) when trying to import this type

of .DBF file.

RESOLUTION

==========

Export the CodeBase++ .DBF file to delimited text, then import the

ASCII file into Microsoft Access.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

version 1.0. This problem was corrected in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: IsmXbase


PRA: Hard-Coded and Passed Wildcards Different in Query

Article ID: Q102431

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The Like operator treats hard-coded asterisk (*) wildcard characters

in queries differently from asterisks passed as query parameters.

With the asterisk as a parameter value, queries do not display records

with null values for the field in which the Like criteria is set.

However, with the asterisk as a hard-coded criteria value (for

example, Like "*"), null values do appear for the field with the Like

condition.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

How to Create TestQuery:

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a new query based on the Employees table.

3. Add the Last Name and Region fields to the query grid.

4. In the Criteria cell in the Region field of the query grid, type

   the following:

      Like "*"

5. Run the query.

   The result is a dynaset containing nine records, including four

   records without values in the Region column (Buchanan, Suyama, King

   and Dodsworth). The wildcard character hard-coded with the Like

   operator in the query returns all records, whether or not there are

   null values in the field.

6. Change the Like operator in step 4 above to the following:

      Like [Forms]![TestForm]![Field0]

   This operator instructs the Like criteria to look in Field0 on a

   form called TestForm for the value it will use in the operation.

7. Save the query as TestQuery.

How to Create TestForm:

1. In the Database window, create a new, unbound form.

2. Place a text box control on the form.

3. Save the form as TestForm.

How to Pass the Asterisk Wildcard Character as a Parameter:

1. Open TestForm in Form view and TestQuery in Design view. Arrange

   the windows so that you can see both the form and the query.

2. Type "*" (without the quotation marks) in the text box on TestForm

   and press ENTER. This asterisk will be passed as a parameter for

   the Like operator in TestQuery.

3. Run TestQuery.

   Note that the query dynaset now contains only five records: those

   containing non-null values in the Region field. When the asterisk

   is passed as a parameter to the query, Microsoft Access displays

   only records with non-null values in the field using the Like

   operator (in this case, the Region field).

REFERENCES

==========

For more information on returning null records, query the Microsoft

Knowledge Base on the following words:

   null and parameter and records

Additional reference words: 1.00 1.10 queries

KBCategory:

KBSubcategory: QryParm


PRA: Help Context ID Property Does Not Work in Subform

Article ID: Q100157

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

If you press the F1 key to invoke the Help system when the insertion

point is in a subform control, Microsoft Access invokes the main form's

Help file Contents window, rather than invoking the appropriate Help

topic for the subform control.

CAUSE

=====

Microsoft Access ignores the Help ContextID property of the subform

control.

RESOLUTION

==========

As a workaround for this problem, you can follow the steps below to

create a custom Help function that will test to determine which control

is active on a form, and then call the Microsoft Windows Help() API

function to invoke the appropriate Help topic for that control:

1. Create the following macro and save it as AutoKeys:

      MacroName     Action

      ---------------------

      {F1}          RunCode

      AutoKeys Actions

      --------------------------------------------------

      RunCode

         Function Name: =Help("<c:\access\yourhlp.hlp>")

      NOTE: Substitute the correct drive, path, and filename for the

      Help file you want to use in the example above.

2. Create a module with the following 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.

'*************************************************************

   'Declarations section of the module

'*************************************************************

   Option Explicit

   Declare Function WinHelp% Lib "User" (ByVal hwnd%, ByVal lpHelpFile$,_

                                         ByVal wCmd%, ByVal dwData As

   Any)

   Global Const HELP_CONTEXT = &H1

   Global Const HELP_CONTENTS = &H3

'*************************************************************

   ' FUNCTION NAME: Help()

   '

   ' PURPOSE:

   '   Based on the currently active control, the Windows Help() API

   '   function is called to invoke Help on a predefined ContextID for

   '   the control. If the ControlName is not represented, a

   '   message appears, indicating no Help topic is available.

   '   If there is no active form available, the contents of the

   '   Help file are invoked.

   '

   ' INPUT PARAMETERS:

   '   HelpFile: Path and filename of Help file to use

   '

   ' RETURN

   '   None

'*************************************************************

   Function Help (HelpFile As String)

      Dim ContextID As Long

      Dim Ret As Integer

      On Error GoTo HelpError

      ' Determine which control needs Help and set the

      ' .. appropriate ContextID for the control.

      Select Case Screen.ActiveControl.ControlName

   'NOTE: You must customize the Case statements that follow

   '      for your specific control names and the ContextID to call

   '      for the control name.

         Case "Category ID"

           ContextID = 1

         Case "Category Name"

           ContextID = 1

         Case "Description"

           ContextID = 1

         Case "Product ID"

           ContextID = 2

         Case "Product Name"

           ContextID = 2

         Case "Unit Price"

           ContextID = 2

         Case "Picture"

           ContextID = 2

         Case Else

            MsgBox "No help for " & Screen.ActiveControl.ControlName

            ContextID = -1

      End Select

      ' Call the Help file with the appropriate ContextID.

      If ContextID > -1 Then

         Ret = WinHelp(Screen.ActiveForm.hwnd, HelpFile, _

                       HELP_CONTEXT, ContextID)

      End If

      GoTo ByeHelp

   HelpError:

      ' Display the Contents window of the Help file.

      Ret = WinHelp(0, HelpFile, HELP_CONTENTS, 0&)

      Resume ByeHelp

   ByeHelp:

   End Function

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem no longer occurs in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: FmsSubf


PRA: Hidden Subform Maximized If Main Form Is Maximized

Article ID: Q99935

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

In a main/subform combination where the main form is maximized and the

subform is hidden, the subform returns maximized when it is made

visible. This results in covering the entire main form.

RESOLUTION

==========

Since the visible property is usually changed through a macro or

function, work around this problem by adding steps to the process to

restore the main form before the subform is made visible. Then,

maximize the main form. An example of this workaround is detailed

after the "Steps to Reproduce Problem" section below.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

You can reproduce this problem by using the Orders form in the

NWIND.MDB sample database. The following steps detail the macros

necessary to reproduce this problem. The resolution to this sample

problem is listed after the steps.

Steps to Reproduce Problem

--------------------------

1. Create a macro group that contains two macros. Name one "Hidden"

   and the other "Visible."

      Macro Name         Action

      ---------------------------

      Hidden             Setvalue

      Visible            Setvalue

      Hidden Macro Actions

      --------------------

      Setvalue

         Item: Forms![orders]![orders subform].Form.Visible

         Expression: 0

      Visible Macro Actions

      ---------------------

      Setvalue

         Item: Forms![orders]![orders subform].Form.Visible

         Expression: -1

2. Close and save the macro as "Show."

3. Open the Orders form and add two command buttons.

4. Set the following properties on the command buttons:

     Command Button: Button1

        Caption: Hide

        OnPush:  Show.Hidden

     Command Button: Button2

        Caption: Show

        OnPush:  Show.Visible

5. Choose View, then choose Form to open the Orders Form in Form view.

6. Maximize the Orders form by using the Maximize button in the forms

   upper-right corner.

7. Choose the Hide button to hide the subform.

8. Choose the Show button to show the subform maximized.

The main form is no longer visible.

To workaround this problem, change the Visible macro actions as

follows:

   Visible Macro Actions

   ---------------------

   Echo

      Echo On: No

   Restore

   Setvalue

      Item: Forms![orders]![orders subform].Form.Visible

      Expression: -1

   Maximize

   Echo

      Echo On: Yes

REFERENCES

==========

Microsoft Access "User's Guide," Chapter 22, "Using Macros with Forms"

Additional reference words: 1.00 1.10 Macros

KBCategory:

KBSubcategory: FmsSubf


PRA: Import/Append Actions Return Errors for Each Record

Article ID: Q100922

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Executing import and append actions that cause every record to return

an import error generates the following error message:

   Couldn't Import. No records found or all records contained errors.

After this error message is displayed, an empty Import Errors table is

created. Also, the Help jump for this error message does not display a

Help topic, but instead takes you to the Microsoft Access Help Table

of Contents.

RESOLUTION

==========

To avoid returning an import error for all records, either modify the

existing table's structure or modify the file itself. If at least one

record imports correctly, you will not receive the above error message

and the Import Errors table will include the correct error

descriptions for each error.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.1. This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. From the File menu, choose Export. Select Text [Delimited].

3. Select the Customers table. Name the file CUSTOMER.TXT.

4. In the Export Text Options box, choose OK.

5. From the File menu, choose Import. Select Text [Delimited] again.

6. Select the CUSTOMER.TXT file.

7. Choose Append to Existing Table, select the Customers table, and

   choose OK.

     NOTE: Due to an indexing violation, trying to use a import

     and append actions to move the CUSTOMER.TXT file back to the

     Customers table causes an error for each record.

   After a few seconds, the above error message is displayed. Note

   that the Help jump has taken you only to the Help Table of

   Contents. At the same time, an empty Import Errors table has been

   created.

table of contents

Additional reference words: 1.10 Help table jump import append TOC

KBCategory:

KBSubcategory: IntpOthr


PRA: Importing Delimited Text Files Strips Off Decimals

Article ID: Q95446

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

You import a delimited text file that contains numbers with decimal places,

and the resulting table does not show the decimal places.

CAUSE

=====

When Microsoft Access creates the table, it looks at the first record in

the file to decide which data type to assign to the field. If the first

record contains a .00 decimal value in a field, Microsoft Access gives the

field a Number, Long Integer data type. Then it strips all the decimal

values when importing the file because the Number, Long Integer data type

does not support decimal values.

RESOLUTION

==========

There are two workarounds. The first is to create a destination table that

already has the fields defined. Choose Number, Double as the data type. It

supports decimal places. When you import the text file, append it to the

existing destination table rather than allowing Microsoft Access to create

a new table.

Alternatively, you can work around the problem by making sure the number

fields in the first record do not contain .00 as decimal values.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem was corrected in Microsoft Access version 1.1.

MORE INFORMATION

================

If any of the fields in the first record contain numbers that have decimal

values of .00, Microsoft Access strips the decimal places from all the

records for the corresponding fields in the resulting table.

Steps to Reproduce Behavior

---------------------------

1. Use a text editor such as Notepad or MS-DOS Edit to create two text

   files (FILE1.TXT and FILE2.TXT) using the following as a guide:

      FILE1.TXT

      ---------

      234.50

      350.75

      FILE2.TXT

      ---------

      100.00

      276.93

2. Import the first file as a delimited text file and have Microsoft Access

   create a new table. Notice that the resulting table has the numbers in

   the correct format. The data type for this field was defined as Number,

   Double.

3. Import the second file as a delimited text file and have Microsoft

   Access create a new table. Notice that the resulting table imports the

   numbers as follows:

      100

      276

Microsoft Access stripped the decimal places from the second file because

the data type for the field was defined as Number, Long Integer--a data

type that does not support decimal values.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 4, "Importing,

Exporting, and Attaching," pages 72-78

Additional reference words: 1.00

KBCategory:

KBSubcategory: IsmTxtd


PRA: Importing Numeric Column Names in Spreadsheets

Article ID: Q100128

------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Excel for Windows, version 4.x

------------------------------------------------------------

SYMPTOMS

========

If you import a Microsoft Excel spreadsheet using the First Row Contains

Field Names option, and the spreadsheet's first row contains numeric

values, Microsoft Access will substitute sequential values starting with 1

for the values in the first row of the spreadsheet.

RESOLUTION

==========

Before you import the spreadsheet, format the column names (the values in

the first row) as text by typing a single quotation mark (') at the

beginning of each value. Or, after you import the spreadsheet to a

Microsoft Access table, switch the table to Design view and change the

field names.

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.

MORE INFORMATION

================

Numeric column names in imported spreadsheets are ignored, regardless of

the spreadsheet format. Microsoft Access will replace any numeric column

names with column numbers in the destination table.

Steps to Reproduce Problem

--------------------------

1. In Microsoft Excel, create a new spreadsheet with the following entries,

   and then save the spreadsheet as TEST.XLS:

           Col 1  Col 2  Col 3

          ---------------------

   Row 1: |5000 | 6000 | 7000 |

           -------------------

   Row 2: | 201 |  202 |  203 |

           -------------------

   Row 3: | 301 |  302 |  303 |

          ---------------------

2. Start Microsoft Access and open any database.

3. From the File menu, choose Import.

4. In the Data Source box, select Microsoft Excel, and then

   choose OK.

5. In the File Name box, select TEST.XLS. Choose Import.

6. In the Import Spreadsheet Options dialog box, select the

   First Row Contains Field Names check box. Choose OK. The spreadsheet

   will be imported.

7. In the message box stating that 2 records were processed, choose OK.

8. Choose Close.

9. Open the new Test table in Datasheet view. Note that the

   field headings are 1, 2, and 3, rather than 5000, 6000,

   and 7000.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmExl4


PRA: Incorrect Action Query Message Box Text

Article ID: Q94598

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

An error message generated by an action query (that is, a delete,

make-table, update, or append query) may contain the following

incorrect message box text:

   Errors were encountered: The contents of fields in <number>

   record(s) were deleted, <number> record(s) were lost due to

   key violations and <number> record(s) were locked and couldn't

   be modified. Proceed anyway?

CAUSE

=====

This problem is caused by the way Microsoft Access handles errors for

action queries. Microsoft Access uses the same error message for every

action query instead of using a separate error message for each type

of action query.

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.

MORE INFORMATION

================

The portion of the above error message that reports key violations:

   <number> record(s) were lost due to key violations

becomes active whenever referential integrity is violated during a query.

However, this specific information only applies to Append and Make Table

queries. If an update or delete query violates referential integrity, this

portion of the error message erroneously gives the impression that records

have been lost, when in fact they simply were not updated or deleted.

Steps to Reproduce Problem

--------------------------

1. Create the following two tables:

      Table: Table1

      ---------------------------

      FieldName: ID  [PrimaryKey]

         DataType: Text

      FieldName: Name

         DataType: Text

      Table: Table2

      -----------------

      FieldName: ID

         DataType: Text

      FieldName: Hobby

         DataType: Text

2. Create a one-to-many relationship between Table1 and Table2, with

   ID as the matching field. Enforce referential integrity rules.

3. Add two records to each table.

4. Create the following query based on Table1:

      Query: Query1

      -------------

      Field: ID

      Field: Name

5. Change Query1 from a select query to a delete query by choosing

   Delete from the Query menu.

6. Run Query1 by choosing Run from the Query menu.

7. Choose the OK button to delete the records.

The following error message is displayed:

   Errors were encountered: The contents of fields in 0 record(s) were

   deleted, 2 record(s) were lost due to key violations and 0 record(s)

   were locked and couldn't be modified. Proceed anyway?

This message correctly identifies that there were key violations

(because of referential integrity), but it incorrectly indicates the

loss of two records. In actuality, the records were not modified and

therefore not lost.

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: QryMktbl


PRA: Incorrect Install Directory with Workstation Setup

Article ID: Q109372

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you run the Microsoft Access version 1.0 Setup program with the

workstation switch (SETUP /N) from a workstation on a network, Microsoft

Access lists :\ACCESS as the default directory for the installation

directory. If you choose this directory for the installation, you receive

an error message.

If you run the Microsoft Access version 1.1 Setup program with the

workstation switch, Microsoft Access lists C:\ACCESS as the default

directory for the installation directory even if the workstation does not

have a drive C.

CAUSE

=====

These errors occur if you run the Microsoft Access Setup program with the

workstation switch from a diskless workstation.

The Microsoft Access Setup program creates a list of locally available hard

disks. Since, in the case of a diskless workstation, there are no local

hard disks, a null list is created, which leads to the incorrect default

directories listed above.

RESOLUTION

==========

Do not run the Microsoft Access Setup program with the workstation switch

(SETUP /N) from a diskless workstation.

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.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: StpNet


PRA: Invalid Characters Added to IN Clause Arguments

Article ID: Q102523

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you choose OK in the SQL dialog box, you receive the error message

"Syntax error in FROM clause" if the query contains an IN clause.

CAUSE

=====

Microsoft Access version 1.1 incorrectly parses the arguments for the

IN clause (SQL) after saving the SQL statement.

RESOLUTION

==========

If you enter the arguments correctly and then save the query, the

query will run without errors. However, you must correct the parsing

done by Microsoft Access if you make any changes to the SQL statement.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.1. This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB.

2. Attach the sample dBASE IV file, NEWCUST.DBF, located in your

   Access program directory.

3. Create a new query based on the attached table, drag several fields

   to the query grid, and then run the query to verify that it works

   properly.

4. Switch to Design view. From the View menu, choose SQL.

5. After the FROM clause, "FROM NEWCUST", type the following:

      IN "<drive:\path>" "dBASE IV;"

   where <drive:\path> is the drive and directory in which you installed

   Microsoft Access.

6. Choose OK to close the SQL dialog box, then choose OK again.

7. Run the query.

8. Switch back to Design view. From the View menu, choose SQL. Note that

   Microsoft Access has changed your IN clause to:

      IN 'c:\access'["dBASE IV;"]

   If you choose OK, the error message stated above will occur.

You must choose Cancel, or correct the IN clause by removing the square

brackets from the external database name.

REFERENCES

==========

For more information about the IN clause, search for "IN clause (SQL)"

using the Microsoft Access Help menu

Additional reference words: 1.10 errmsg

KBCategory:

KBSubcategory: ObcOthr


PRA: Invalid Results in Subreport When CanGrow = Yes

Article ID: Q98794

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

If a control in a subreport uses an expression or aggregate function

and its CanGrow property is set to Yes, Microsoft Access does not

calculate the value of the field correctly.

For example, assume your database contains a table named Test that

has a text field called TestColumn containing the following values:

   TestColumn

   ----------

   Mickey

   Donald

If you create a report with a single text box (Field1) containing the

expression

   =IIf(IsNull([TestColumn]),"N/A",[TestColumn])

and you set the CanGrow property for Field1 to Yes and then embed that

report as a subreport, you get the following incorrect results:

   Donald

   Donald

If the calculated subreport field contains an aggregate function,

instead of a text-based expression as above, the subreport displays

incorrect numeric values.

RESOLUTION

==========

Make sure that the CanGrow property of subreport fields that use

expressions or calculations is set to No.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem no longer occurs in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: RptSub


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: Microsoft Access Closes Abnormally from a Macro

Article ID: Q109366

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When Microsoft Access is unexpectedly closed by a macro, system resources

are not released, and Microsoft Access remains in the Microsoft Windows

Task List even though the application is no longer available.

CAUSE

=====

The abnormal closing of Microsoft Access is due to event timing in

the macro. The macro opens the Categories table, calls the Replace In

Field dialog box, and then closes the Categories table. However, the

Replace In Field dialog box, by design, functions differently than other

dialog boxes by allowing macros to continue running while the dialog box

is displayed. Because the macro continues running the Categories table

is closed before the replace action is completed. There is no macro

action to pause the macro's execution; macro events occur sequentially

unless a modal dialog box requests input from the user. The fact

that the table is closed before the replace action is completed causes

Microsoft Access to close abnormally.

When Microsoft Access closes abnormally in this way, it does not

relinquish memory or system resources as it should.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

WARNING: Make sure to save any open work on your computer before

following these steps. Following these steps will cause Microsoft

Access to quit; any open work will not be saved.

1. In Program Manager, choose About Program Manager from the Help menu.

   Note the amount of free system resources. Choose OK.

2. Start Microsoft Access.

3. Open the sample database NWIND.MDB.

4. Create the following new macro:

      Action

      -------------------------------

      OpenTable

         Table Name : Categories

         View       : Datasheet

         Data Mode  : Edit

      DoMenuItem

         Menu Bar   : Table Datasheet

         Menu Name  : Edit

         Command    : Replace

      Close

         Object Type: Table

         Object Name: Categories

5. Run the macro.

6. In the Replace In Field dialog box, choose Close. Microsoft Access

   will close abnormally.

7. Press CTRL-ESC to open the Task List. Double-click Microsoft Access.

   Note that you cannot switch to Microsoft Access because it is no

   longer available.

8. Double-click Program Manager.

9. From the Help menu, choose About Program Manager. Note that the system

   resources used by Microsoft Access have not been released.

Additional reference words: 1.00 1.10 abnormal termination close

KBCategory:

KBSubcategory:  McrActn


PRA: Minimize MS Access with Cue Cards, System Hangs

Article ID: Q104978

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are running Microsoft Access Cue Cards in Microsoft Windows

for Workgroups, your computer hangs when you attempt to minimize

Microsoft Access after starting another application.

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.

MORE INFORMATION

================

This problem occurs only under the following conditions:

 - Microsoft Access is running under Microsoft Windows for Workgroups.

 - You choose only the Minimize button in Microsoft Access. If you

   click anywhere else in the Microsoft Access database window, the

   problem does not occur.

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access.

2. Start a Cue Cards topic, such as "Build a database with tables,"

   by choosing Cue Cards from the Help menu and choosing the

   appropriate Cue Card topic.

3. At any gray screen in Cue Cards, switch to Program Manager by

   pressing CTRL+ESC or ALT+ESC, then start Calculator or any other

   application.

4. Minimize Microsoft Access by choosing the Minimize button.

   Result: Your computer hangs.

Additional reference words: 1.00 1.10 winiss ui hung stopped frozen

freezes

KBCategory:

KBSubcategory: EvnGpf


PRA: MS Graph Not Registered Correctly in Network Setup

Article ID: Q109954

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

After you install Microsoft Access to a network drive, you receive the

following error message when you try to use Microsoft Graph within

Microsoft Access:

   Can't start object's source application. Use the Windows

   Registration Info Editor (REGEDIT.EXE) to verify that the

   application is properly installed.

CAUSE

=====

When you install Microsoft Access to a network drive within a Microsoft

Windows session that is running from a network drive as well, the

Microsoft Access Setup program does not insert correct information about

the location of Microsoft Graph in the REG.DAT file.

RESOLUTION

==========

There are two methods for correcting this problem. Note that both of these

methods should be attempted by a network administrator only, and only under

the following conditions:

 - You are using Microsoft Access version 1.x (not version 2.0).

 - Windows is installed as a shared network version, with shared files

   on the network as well.

 - You installed Microsoft Access on the workstation with the SETUP /N

   command, after installing Microsoft Access on the network with

   the SETUP /A command.

 - Graph 3.x is not registered correctly, and you know where the

   MSGRAPH.EXE and MSGRAPH3.REG files are.

Method 1

--------

Run the Windows Registration Information Editor with the /V switch to

modify the settings for Microsoft Graph. Modify the following two lines in

the REG.DAT file so that they contain the correct drive and path for the

shared GRAPH.EXE file:

   MSGraph\protocol\StdExectute\server=<drive>:\<path>\GRAPH.EXE

   MSGraph\protocol\StdFileEditing\server=<drive>:\<path>\GRAPH.EXE

NOTE: The two lines above are examples only; you must modify them to

point to the location of the shared GRAPH.EXE file.

Method 2

--------

Modify the Setup files so that an icon is created when you run Setup that

can be used to automatically correct the REG.DAT file to point to the

shared GRAPH.EXE file. This method is useful in that all future

workstations installations from the network will be correct:

 1. Move to the directory that contains the shared copy of GRAPH.EXE. It

    is usually in an MSAPPS\MSGRAPH directory near the shared copy of

    Microsoft Windows.

 2. Copy the MSGRAPH.REG or MSGRAPH3.REG file to a new file called

    MSGRFIX.REG.

 3. Open the MSGRFIX.REG file in Windows Notepad. Modify all the lines

    in the file that point to the GRAPH.EXE file to point to the

    correct drive and path for the shared copy of the file.

 4. Save and then close the MSGRFIX.REG file.

 5. Move to the network MSACCESS\INSTALL directory.

 6. Copy the STFSETUP.IN_ file to a new file called STFSETUP.ORG. The

    STFSETUP.ORG file is a backup file.

 7. Open the STFSETUP.IN_ file in Windows Write (the file is too large

    to open with Notepad). When you are prompted to convert the file to

    Write format, choose No Conversion.

 8. Move to the [ProgGroup Script] section of the file. Locate the line

    that begins with:

       CreateProgManItem $(AppName), "Microsoft Access Readme"...

 9. Add a new line after the line listed above. The new line should read

    as the sample line below, but modify the drive and path to point to

    the MSGRFIX.REG file created in step 2:

    NOTE: In the following sample line, an underscore (_) is used as a

    line-continuation character. Remove the underscores at the end of each

    line when re-creating this line.

       CreateProgManItem $(AppName), "MS Graph Fix", _

          "F:\PUBLIC\MSAPPS\MSGRAPH\MSGRFIX.REG", , O

10. Save and then close the STFSETUP.IN_ file.

11. Run the Microsoft Access Setup program with the /N switch again

    (SETUP /N). The Setup program will create a new icon called

    MS Graph Fix.

12. Double-click the MS Graph Fix icon. The REG.DAT file will be

    updated to point to the correct location for the shared copy

    of the GRAPH.EXE file.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access versions

1.0 and 1.1.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: StpOthr


PRA: Multiple Users Adding Fields Causes Cross- Linking

Article ID: Q97995

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

Incorrect data appears in tables when multiple users load and modify

the same database within minutes of each other.

The steps below describe a typical scenario in which this problem

occurs:

1. User1 opens a table in a database.

2. User2 opens the same database and makes a change to the design of

   the table User1 has open.

3. Less than one minute later, User1 makes a change to the design of

   the same table.

Either user may then notice data corruption in the table. Corruption

problems may be apparent in one of the following three ways:

 - Data from one field in the table may be displayed in a new field.

 - Data in a new or changed field may be displayed in a second field.

 - Attempting to copy the table containing new or changed fields

   generates an error message.

CAUSE

=====

This problem, called cross-linking, occurs because information about

tables in a database is read from the system tables and is cached into

memory by Microsoft Access when a user opens a database. The information

in a user's cache may become obsolete if another person

has just made a change and Microsoft Access does not read the new

information before the first user makes changes. For example, in the

situation above, User1 has cached the information for the table, User2

makes a change, and then User1 makes a change before the system tables

are reread. If this occurs, the table can become corrupted.

It is not necessary for both users to open or change the same table

for corruption to occur. The information for the table opened by User1

may be on the same page in the system table as the information for the

table modified by User2. If that page is cached by Microsoft Access,

table corruption may occur.

RESOLUTION

==========

Information in the cache for tables not currently in use is discarded

on a regular basis, so problems do not occur unless changes are made

before Microsoft Access has had an opportunity to empty the cache. To

ensure that information in the cache is emptied, wait a minimum of one

to two minutes before opening the table in Design view.

If the database is corrupt, compacting the affected database usually

corrects the problem. To do this, close all databases and choose Compact

Database from the File menu.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem no longer occurs in Microsoft Access version 1.1.

Additional reference words: 1.00 crosslink cross-linked mirrored

KBCategory:

KBSubcategory: GnlMu


PRA: Network Setup (/N) Fails After Network Error

Article ID: Q109817

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If your network experiences a problem while you are running the Microsoft

Access network installation (SETUP /N) you will receive an error message in

Microsoft Access Setup. After you choose the Cancel button you will receive

an error message stating that the system was previously set up, even though

the installation was not completed successfully.

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.

Additional reference words: 1.00 1.10 Setup

KBCategory:

KBSubcategory: StpNet


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: Numeric Column Names Ignored in Spreadsheet Import

Article ID: Q113917

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you import a Microsoft Excel spreadsheet using the First Row Contains

Field Names option, and the spreadsheet's first row contains numeric

values, Microsoft Access ignores the values in the first row. Instead,

sequential values starting with 1 are substituted for the imported values.

RESOLUTION

==========

Before you import the spreadsheet, place an apostrophe (') in front of each

number in the first row of the spreadsheet. This causes Microsoft Excel to

treat the value as a text string instead of a number.

NOTE: The apostrophes will not appear in the spreadsheet or in Microsoft

Access.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a spreadsheet in Microsoft Excel with the following data:

              Col 1  Col 2  Col 3

             ---------------------

      Row 1: |5000 | 6000 | 7000 |

              -------------------

      Row 2: | 201 |  202 |  203 |

              -------------------

      Row 3: | 301 |  302 |  303 |

             ---------------------

   Save the spreadsheet as TEST.XLS.

2. Start Microsoft Access and open any database.

3. From the File menu, choose Import.

4. In the Data Source box, select Microsoft Excel, and then choose OK.

5. In the File Name box, select TEST.XLS. Choose Import.

6. In the Import Spreadsheet Options dialog box, select the First Row

   Contains Field Names check box. Choose OK.

7. The spreadsheet will be imported. In the message box stating that

   2 records were processed, choose OK.

8. Choose Close.

9. Open the new Test table in Datasheet view. Note that the field

   headings are 1, 2, and 3, rather than 5000, 6000, and 7000.

Additional reference words: 1.00 1.10 Importing

KBCategory:

KBSubcategory: DcmNwd


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: 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: Opening Objects in Transactions Can Cause Rollback

Article ID: Q96906

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The following error message is displayed while attempting to open a

second occurrence of a database object (such as a table, dynaset, or

form) in a transaction:

   Invalid database object

CAUSE

=====

This error message results from a new occurrence of a database object

overwriting a previous occurrence of a database object, which

"orphans" the first object (that is, the first object's pointer to the

database is destroyed).

When Microsoft Access detects that an object is orphaned, it attempts

to close it. Because the object is in a transaction, however, the

close fails, and therefore Microsoft Access rolls back all levels of

nested transactions so that the close succeeds.

This implicit rollback causes all objects opened in transactions to be

closed. As a result, any reference to an object closed by this process

results in the "Invalid database object" error message.

RESOLUTION

==========

This problem occurs only when objects are implicitly closed (by the

process mentioned above), and does not occur when the object is

explicitly closed in a transaction.

Thus, the keys to avoiding this problem are:

 - Always open objects outside of transactions.

 - Always explicitly close objects.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0 and 1.1. This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

Create and run the following procedures:

   Sub Sub1()

     Dim db As Database, tb As Table

     Set db = CurrentDB()

     BeginTrans

        Set tb = db.OpenTable("table1") 'Table opened in transaction

        Call Sub2

        Debug.Print tb.recordcount   'Result: "! Invalid database

                                     'object."

        tb.Close

     CommitTrans

     db.Close

   End Sub

   Sub Sub2()

     Dim d as Database

     Set d = CurrentDB()

   End Sub  'd loses scope, does implicit rollback and close of db.

Additional reference words: 1.00 1.10 AB ABC Engine

KBCategory:

KBSubcategory: PgmOthr


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: Orders Form Doesn't Print/Preview SubTotal & Total

Article ID: Q96586

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

You have a main form and a subform, and in the subform you have a

control that uses an aggregate function, such as Sum(), to calculate a

value. On the main form, you have a control set to this

subform control. When the main form is displayed in Form view, the

control on the main form displays the correct value. However, when

you switch the main form to Print or Print Preview, this control is

blank.

For example, look at the Orders form included in the sample

database NWIND.MDB. Note the Subtotal and Total fields. In Form

view, these fields display values. When you switch to Print

Preview, these values do not appear.

CAUSE

=====

If the subform is displayed in Datasheet view, any main form

controls that refer to aggregate calculated subform controls do not

get repainted.

RESOLUTION

==========

Display the subform as a continuous form, or use a domain aggregate

function in the subform control. (See below for more information on

these workarounds.)

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

version 1.0. This problem was corrected in Microsoft Access version 1.1.

MORE INFORMATION

================

To work around this problem, you can either use a continuous form

instead of a datasheet in the subform, or replace the aggregate

function with a domain aggregate function in the subform control.

In the form named Orders Subform, a text box control named Order

Subtotal is calculated by using the following aggregate expression:

   =Sum([Extended Price])

On the form named Orders, the Subtotal control refers to this

calculated subform control. The Orders form displays the Subtotal

value but does not display the value in Print Preview.

Workaround 1

------------

1. Open the Orders Subform in Design view and change the ViewsAllowed

   property to Both and the DefaultView property to Continuous Forms.

2. Close and save the Orders Subform.

3. Open the Orders form. Note that the Subtotal and Total fields are

   correct. Switch to Print Preview and these amounts are now

   displayed.

   Note: You will probably want to rearrange the detail section of

   Orders Subform so it displays properly in the Orders form.

Workaround 2

------------

1. Open the Orders Subform in Design view.

2. Change the text box control named Order Subtotal 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.

      Object: text box

      ----------------

      ControlName: Order Subtotal

      ControlSource: =DSum("[Extended Price]","[Order Details2]", _

                         "[Order ID]=Forms![Orders].[Order ID]")

3. Close and save the form.

4. Open the Orders form in Form view.

Note how the Subtotal and the Total controls display the correct

values in both Form view and Print Preview.

Additional reference words: 1.00

KBCategory:

KBSubcategory: FmsSubf


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: Password Is Case-Sensitive But Verification Is Not

Article ID: Q98223

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When you change your password by choosing Password from the Security

menu, the Verify text box is not case sensitive. However, the Password

dialog box is case sensitive. The next time you start Microsoft

Access, the password you type must exactly match the new password you

entered previously.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

version 1.0. This problem has been corrected in Microsoft Access

version 1.1.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. From the Security menu, choose Change Password.

2. Type your old password, if you have one, or simply type a new

   password in the New Password box. Use only uppercase letters.

3. Type your new password in all lowercase letters in the Verify box.

   Choose OK.

4. Quit Microsoft Access, then restart it.

5. Type your password in all lowercase letters. The following error

   message appears:

      Not a valid account name or password.

6. Type your password in all uppercase letters. Note that the error

   message no longer appears.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, page 624

Additional reference words:

KBCategory:

KBSubcategory: ScrtOthr


PRA: Print Quality Always Defaults to Highest Mode

Article ID: Q109935

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access ignores the print quality set in the Windows Control

Panel and instead defaults to the highest quality print mode available.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Run the Printers utility in the Windows Control Panel.

2. Select a printer, then choose Setup.

3. Choose a printing resolution in the Resolution box that is less than

   the highest available resolution.

4. Start Microsoft Access and open any database.

5. From the File menu, choose Print.

Note that the print quality is set to High.

Additional reference words: 1.00 1.10 PtrIss

KBCategory:

KBSubcategory: PrtaccOthr


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: Problem Exporting "Single" Numeric Data to MS Excel

Article ID: Q103259

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You may be unable to export numeric data to Microsoft Excel if the

Microsoft Access data has a Number data type, a Single field size, and

a fixed format. When you export the table, the numbers lose their

formatting and are altered slightly.

RESOLUTION

==========

Format the data stored as Number-Single in Microsoft Access as "fixed

- 2 decimal places" in Microsoft Excel. All the data stored as

Number-Single in Microsoft Access is also stored as Number-Double.

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.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new table with two fields:

      FieldName:  NumSingle

         Data Type: Number

         Field Size: Single

         Format: Fixed

         Decimal Places: 2

      FieldName:  NumDouble

         Data Type: Number

         Field Size: Double

         Format: Fixed

         Decimal Places: 2

2. Add the following data:

      NumSingle       NumDouble

      -------------------------

      0.00            0.00

      0.01            0.01

      0.02            0.02

      0.03            0.03

      0.04            0.04

      0.05            0.05

      0.06            0.06

      0.07            0.07

      0.08            0.08

      0.09            0.09

      0.10            0.10

      0.10            0.10

      0.11            0.11

      0.12            0.12

      0.13            0.13

      0.14            0.14

      0.15            0.15

      0.16            0.16

      0.17            0.17

      0.18            0.18

      0.19            0.19

      0.20            0.20

3. Export the file to Microsoft Excel and open it.

   The data appears as follows:

     NumSingle        NumDouble

     --------------------------

     0                0.00

     0.01             0.01

     0.02             0.02

     0.029999999      0.03

     0.039999999      0.04

     0.050000001      0.05

     0.059999999      0.06

     0.07             0.07

     0.079999998      0.08

     0.090000004      0.09

     0.100000001      0.10

     0.100000001      0.10

     0.109999999      0.11

     0.119999997      0.12

     0.129999995      0.13

     0.140000001      0.14

     0.150000006      0.15

     0.159999996      0.16

     0.170000002      0.17

     0.180000007      0.18

     0.189999998      0.19

     0.200000003      0.20

Numbers stored as "singles" are imported as numbers with nine decimal

places. Numbers stored as "doubles" are imported with no errors.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmExl4


PRA: Problems Opening a Modal and Pop-Up Form as Dialog

Article ID: Q109396

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If two or more modal pop-up forms are opened and closed, the screen can

become distorted or Microsoft Access can stop.

CAUSE

=====

The problem occurs if both forms' Modal and Popup properties are set to

Yes, and the forms are opened with the OpenForm action with the Window Mode

argument set to Dialog.

RESOLUTION

==========

Either change the OpenForm action to open the forms as Normal instead of

Dialog, or change the forms' Modal and Popup properties to No.

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.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 579-580

Microsoft Access "User's Guide," version 1.1, pages 583-584

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsProp


PRA: Query Progress Meter Reports Status Incorrectly

Article ID: Q98787

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When running an append query that appends a large number of records to

an existing table, the progress meter may incorrectly reflect the

status of the query. The progress meter may increase quickly to 98

percent complete and then continue slowly until reaching 100 percent.

CAUSE

=====

The progress meter does not take into account the time for the sorting

phase. If the sorting phase takes a long time, the progress meter does

not correctly reflect the progress of the query.

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.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 7, "Designing

Action Queries and Parameter Queries," pages 170-174

Additional reference words: 1.00 1.10 queries ui meter gage thermometer

KBCategory:

KBSubcategory: QryOthr


PRA: Referential Integrity Error Message with Shared Databases

Article ID: Q95004

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you share databases in Microsoft Access and try to update a

record that another user has already updated, your update fails and

Microsoft Access generates the following message:

   Data has changed; Operation stopped.

When you choose OK, Microsoft Access generates the following write-

conflict 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.

You can choose one of three option buttons:

 - Save Record

 - Copy To Clipboard

 - Drop Changes

Copying your changes to the Clipboard allows you to look at the values

the other user has entered and paste your own changes back into the

table. However, when you choose Paste, your attempt fails and

Microsoft Access generates the following referential integrity error

message:

   Can't delete or change record. Since related records exist in table

   "<Table Name>", referential integrity rules would be violated.

CAUSE

=====

Your table is on the "one" side of a one-to-many relationship and

the Enforce Referential Integrity check box is selected. These

symptoms occur regardless of the field being edited.

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.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open two instances of Microsoft Access. In each instance, open the

   sample database NWIND.MDB. Make sure that the database is not opened

   with exclusive access.

2. In each instance, open the Categories table.

3. In the first instance, change the Category Name field in the first

   record. Do not commit the change.

4. In the second instance, change the Category Name field in the first

   record. Commit the change by moving the indicator to a field in

   another record.

5. Restore the first instance and try to commit the change. Microsoft

   Access generates the first of the two error messages listed above.

   When the second error message appears, choose Copy To Clipboard.

6. Select the first record from the first instance of Microsoft

   Access. From the Edit menu, choose Paste.

7. Try to close the table. Microsoft Access generates the referential

   integrity error message listed above.

Additional reference words: 1.00 1.10 errmsg multiuser

KBCategory:

KBSubcategory: RltRef


PRA: Report Prompts Twice for Same Parameter Value

Article ID: Q104759

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You are prompted twice for the same parameter value when you run a report

that contains a subreport that is based on a parameter query.

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.

MORE INFORMATION

================

If a subreport that is based on a parameter query that takes one parameter

from the user is placed in the detail section of an unbound main report,

the report will prompt the user twice for the same parameter value. Note

that the same problem occurs with forms and subforms.

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and open the sample database NWIND.MDB.

2. Create a parameter query based on the Categories table. Save the query

   as CategoryQuery:

      Query:  CategoryQuery

      ---------------------

      Field: Category ID

         Criteria: [Enter Category Id]

      Field: Category Name

3. Use the ReportWizard to create a report based on the CategoryQuery

   query. Save this report as MySubReport.

4. Create a new unbound report. Drag the MySubReport report to the detail

   section of the new report.

5. From the File menu, choose Print Preview.

Note that the report asks for the same parameter value twice.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RptSub


PRA: Reserved Error (-1603) Previewing a Report

Article ID: Q109401

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you preview a report, you receive the error message:

   Reserved error (-1603); there is no message for this error.

CAUSE

=====

This error occurs when an Access Basic function references a field in the

report's underlying data that is not on the report and the resulting

dynaset is empty.

RESOLUTION

==========

Place the field referenced by the function on the report. If you do not

want to see the field on the report, set the field's Visible property to

False.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Microsoft Access and either create a new database or open one

   of your choosing.

2. Create the following new table:

      Table: Table1

      -------------------

      FieldName: ID

         DataType: Number

      Table Properties: Table1

      ------------------------

      PrimaryKey: ID

2. Add the following values to the ID field:

      ID

      --

      1

      2

      3

3. Create the following query based on Table1:

      Query: Query1

      ---------------

      Type: Select

      Field: ID

         Criteria: 10

   Note that this query returns no records, which is necessary for

   duplicating the error message.

4. Create a new module and enter the following sample function:

      Function MyFunction (C As Control)

         Debug.Print C

      End Function

5. Create the following new report based on Query1:

      Report: Report1

      -----------------------------------

      RecordSource: Query1

      Text box: Field1

         ControlSource: =MyFunction([ID])

   Note that the ID field is not on the report.

6. Preview the report.

Additional reference words: 1.00 1.10 Reports AB errmsg

KBCategory:

KBSubcategory: RptOthr


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: Run-Time Error Occurs Calling Financial Functions

Article ID: Q106246

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are calling financial functions, the following error message

occurs:

   A run-time error occurred in database: UTILITY. You don't have

   permissions to view modules in this database.

CAUSE

=====

Although each function defined in the library has error trapping

enabled, the declaration for the SetUserError() subroutine does not

point to the correct dynamic link library (DLL).

RESOLUTION

==========

You must change the UTILITY.MDA file using the procedure listed below.

This change will correct the declaration for the SetUserError()

subroutine, causing it to point to the correct DLL.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

In any module's Immediate window, run the following function by typing:

   ? Rate(27,5495,277512,189000,1,0.1)

You will receive the error message stated in the SYMPTOMS section.

Steps to Correct Problem

------------------------

 1. From the File menu, choose New Database to create a new, empty

    database. Type "junk.mdb" (without the quotation marks) in the

    File Name text box and choose OK.

 2. Close all instances of Microsoft Access.

 3. Open the MSACCESS.INI file located in the Windows directory using

    any text editor. (For example, use the Microsoft Windows Notepad

    text editor.)

 5. In the MSACCESS.INI file, locate the [OPTIONS] section. Comment

    out the UtilityDB line by placing a semicolon (;) at the beginning

    of the line.

 6. Add a new line to specify a new utility database called JUNK.MDB.

    The MSACCESS.INI file should now look like the following:

    NOTE: The drive and pathnames in your MSACCESS.INI file may differ

    from those listed in the example below.

       [Options]

       ;UtilityDB=D:\ACCESS.110\UTILITY.MDA

       UtilityDB=D:\ACCESS.110\JUNK.MDB

 7. Save the changes to the MSACCESS.INI file and close the text

    editor.

 8. Open Microsoft Access.

 9. From the File menu, choose Open Database. Type "utility.mda"

    (without the quotation marks) in the File Name text box and choose

    OK.

10. You may receive error messages. Bypass these messages and

    continue.

11. Open the Finance module.

12. Change the following line

    Declare Sub SetUserError Lib "MSABC100.DLL" (ByVal ErrCode As _

                   Integer)

    to:

    Declare Sub SetUserError Lib "MSABC110.DLL" (ByVal ErrCode As _

                   Integer)

    NOTE: In the declaration above, the underscore (_) is used as a

    line-continuation character to improve readability. Your code will

    appear on a single line without the underscore.

13. Save the changes to the Finance module. Close Microsoft Access.

14. Return the MSACCESS.INI file back to its original settings. The

    file should read:

    NOTE: The drive and pathnames in your MSACCESS.INI file may differ

    from those listed in the example below.

       [Options]

       UtilityDB=D:\ACCESS.110\UTILITY.MDA

15. Save the changes to the MSACCESS.INI file and close the text

    editor.

Additional reference words: 1.10

KBCategory:

KBSubcategory: MdlLib


PRA: Run-Time Version Partially Displays Sorting And Grouping

Article ID: Q101373

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

In the run-time version of Microsoft Access, a report's Sorting And

Grouping dialog box is partially displayed. You can see the box's title

bar, as well as the title bar of the Group Properties section.

RESOLUTION

==========

If you create an application for distribution, and you want to change the

sorting and grouping properties for a report in the application without

allowing the user to see the dialog box, set the Echo action's Echo On

argument to No, so that the screen is not updated while the macro is

running.

You can also prevent users from switching to Design view by using

macros and forms to control what actions the user can take while in

the application.

STATUS

======

Microsoft has confirmed this to be a problem in the Microsoft Access

Distribution Kit version 1.1. This problem no longer occurs in the

Microsoft Access Developer's Toolkit version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. In the sample database NWIND.MDB, create the following macro:

      Macro Name     Action

      -----------------------

      Test1        OpenReport

                   DoMenuItem

      Test1 Actions:

      --------------------------------

      OpenReport

         Report Name: Catalog

         View: Design

      DoMenuItem

         Menu Bar: Report

         Menu Name: View

         Command: Sorting And Grouping

2. Save this macro as AUTOEXEC. Close the database and quit Microsoft

   Access.

3. Start the run-time version of Microsoft Access with NWIND.MDB. To do

   this, switch to Program Manager and choose Run from the File menu. Type

   the following in the command line:

      C:\ACCESS\MSARN110.EXE NWIND.MDB

   Note that the Sorting And Grouping dialog box is partially displayed. As

   you tab through the dialog box, cells that contain text are visible.

REFERENCES

==========

For information about other methods of sorting and grouping reports,

search for "GroupHeader," "GroupFooter," "GroupInterval," or "GroupOn"

using the Microsoft Access Help menu.

Additional reference words: 1.10 runtime run-time

KBCategory:

KBSubcategory: RptSort


PRA: RunMacro May Not Work with Large Repeat Count

Article ID: Q100126

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you try to execute a RunMacro action with a Repeat Count argument

greater than 32,767, either Microsoft Access may use an unexpected

Repeat Count argument or the following error message may appear:

   Repeat Count argument in RunMacro action can't be less than 0

CAUSE

=====

Microsoft Access does not explicitly check for Repeat Count arguments

greater than 32,767. Such values may wrap around either to a negative

number or to an unexpected positive number. If the resulting value is

negative, Microsoft Access displays the above error message. If the

value is positive, Microsoft Access runs the macro using the Repeat

Count argument that it evaluated.

RESOLUTION

==========

Make sure that your Repeat Count argument falls between 0 and 32,767.

If you need to run a macro more than 32,767 times, nest your macros.

For example, if you need to run a macro 60,000 times, use the

following three steps:

1. Create a macro (Macro1) that has a RunMacro action with a

   Repeat Count argument of 30,000.

2. Create another macro (Macro2) that has a RunMacro action with a

   Repeat Count argument of 2.

3. Instruct Macro2 to run Macro1.

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.

MORE INFORMATION

================

If the Repeat Count argument falls between 0 and 32,767, Microsoft

Access returns the expected results (no repeat).

If the Repeat Count argument falls between 32,767 and 65,535,

Microsoft Access returns the error message listed above in the

"Symptoms" section.

If the Repeat Count argument is greater than 65,535, Microsoft Access

returns either the expected results (no repeat), the error message, or

unexpected results.

Steps to Reproduce Behavior

---------------------------

1. Open a blank, unbound form and save it as as Test Form.

2. Create two macros (Increment by One and RepeatCount Test) as

   follows:

      Macro Name         Action

      ---------------------------

      Increment by One   SetValue

      RepeatCount Test Actions

      ------------------------

      SetValue

         Item: [field0]

         Expression: [field0]+1

      Macro Name         Action

      ---------------------------

      RepeatCount Test   RunMacro

                         MsgBox

      RepeatCount Test Actions

      ------------------------

      RunMacro

         Macro Name: Increment by One

         Repeat Count: 32767

      MsgBox

         Message: Done

3. Add three controls to Test Form, as follows:

      Object: Text Box

      -----------------

      ControlName: Field0

         ControlSource: <leave blank>

      Object: Command Button

      ----------------------

      ControlName: Increment

         Caption: Increment

         OnPush: Increment by One

      Object: Command Button

      ----------------------

      ControlName: Repeat

         Caption: Repeat

         OnPush: RepeatCount Test

4. Open Test Form in Form view. Type "1" in Field0, then choose

   Increment. Note that each time you choose Increment, the value in

   Field0 increases by 1.

5. Type "1" in Field0, then choose Repeat. When the RepeatCount Test

   macro has run, the message "Done" is displayed. Note that the value

   in Field0 is now 32,767.

   To test different Repeat Count arguments, open the RepeatCount Test

   macro in Design view, change the Repeat Count argument, and repeat

   step 5.

Additional reference words: 1.00 1.10 macros RepeatCount ui

KBCategory:

KBSubcategory: McrActn


PRA: Selecting Options in Find Dialog Box

Article ID: Q94222

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

There are three known problems with the Find dialog box. To see the Find

dialog box, choose Find from the Edit menu.

1. The check boxes for Match Case and Search Fields As Formatted

   work correctly when selected with a mouse, but mistakenly allow

   both boxes to be selected when using the plus (+) and minus (-) keys

   to select or clear the check boxes.

2. There is a slight painting problem when you select the All Fields

   option button under Search In. The default value is false for the

   Match Case and Search Fields as Formatted check boxes, but after

   you select the All Fields option button, Microsoft Access dims the

   Search Fields as Formatted check box caption and selects it.

3. After experiencing the painting problem and seeing the dimmed X in

   the Search Fields as Formatted check box, if you again select

   Current Field under Search In, Microsoft Access incorrectly selects

   the Search Fields as Formatted check box. This occurs whether you use

   the mouse or the keyboard to select Current 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.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: UiOthr


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: Setting OLE Object Property May Cause GP Fault

Article ID: Q96893

------------------------------------------------------------

---------

The information in this article applies to:

 - Microsoft Access version 1.0

------------------------------------------------------------

---------

SYMPTOMS

========

Microsoft Access will produce a general protection (GP)

fault if the

OLEDATA property is set to a null value or an invalid

object.

CAUSE

=====

OLEDATA is a property of an unbound embedded object used in

either

a form or report. The property is not available in the

Object

Properties dialog box; it is set by Microsoft Access and can

only

be modified using Access Basic code.

If the OLEDATA property is set to an invalid object,

Microsoft

Access will display the error "Not a valid OLE object."

Microsoft

Access will allow you to exit the dialog box and continue to

work

in design mode. The frame will remain in the form or report;

however, since its link is broken, it will be dimmed. Access

will

produce a GP fault when leaving design mode to display the

form in

view mode, or the report in print preview mode.

If the OLEDATA property is set to null, Microsoft Access

will display the

error "The setting you entered isn't valid for this

property" and produce a

GP fault upon exiting the dialog box.

RESOLUTION

==========

Setting the embedded objects Visible property to False will

suppress the display of the object.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft

Access

version 1.0. This problem was corrected in Microsoft Access

version 1.1.

MORE INFORMATION

================

Any unbound embedded object inserted with the Paste, Paste

Link*, or

Paste Special* command is subject to the GP fault if the

OLEDATA

property is set to a invalid object.

Steps to Reproduce Problem

--------------------------

 1. Using Paintbrush, open any .BMP file.

 2. Select the object and copy it to the Clipboard.

 3. Exit Paintbrush.

 4. Open Microsoft Access and create a new database.

 5. Create a new form.

 6. In the form's Design view, paste in the object.

 7. Leave the form open and go to the Database window.

 8. Create a new module.

 9. Open the Immediate window.

Option 1

--------

10. Enter the following command:

       Forms![Form1]![Embedded0].OLEDATA=NULL

    Microsoft Access will display the following error:

       The setting you entered isn't valid for this

property.

11. Choose the OK button.

    Microsoft Access will GP fault.

Option 2

--------

12. Enter the following command:

       Forms![Form1]![Embedded0].OLEDATA="X"

    Microsoft Access will display the following error:

       Not a valid OLE object

13. Choose the OK button.

14. Go back to Form1.

15. Switch to the form's View window.

    Microsoft Access will GP fault.

Additional reference words: 1.00

KBCategory:

KBSubcategory: PgmOthr


PRA: Setup (STFSETUP) GP Faults in Windows Standard Mode

Article ID: Q102230

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.1

 - Microsoft Access Distribution Kit version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are running Microsoft Windows in standard mode, the error message

"STFSETUP caused a general protection fault in STFSETUP.EXE" will occur

near the end of the installation process if you are running any of the

following:

 - The retail Setup of Microsoft Access version 1.1.

 - A workstation Setup (/n) from the version 1.1 upgrade disks.

 - A custom application developed with the Microsoft Access

   Distribution Kit (ADK).

CAUSE

=====

This problem is caused by the detection and implementation of sharing

mechanisms.

RESOLUTION

==========

Run Windows in 386 enhanced mode during Setup. You may then switch

back to standard mode to run your applications.

NOTE: This problem is solely confined to the Setup process. In no way

does it affect how Microsoft Access runs in either standard or 386

enhanced mode.

If for some reason you cannot run Microsoft Windows in 386 enhanced

mode, modify STFSETUP.IN_ as described below. Separate procedures

follow for retail, upgrade, and ADK users.

Steps for Retail Users

----------------------

1. Make a backup copy of Disk1.

2. On the backup disk, use an editor to modify the STFSETUP.IN_ file.

   Change the [System Paths] section from

   [System Paths]

      SYSTEMPATH = "" ? DETCMD.DLL GetWindowsSysDir

      WINDOWSPATH = "" ? DETCMD.DLL GetWindowsDir

      HARDDRIVELIST  = "" ? DETCMD.DLL GetAllValidLocalHardDrives

      NETDRIVELIST = "" ? DETCMD.DLL GetAllValidNetworkDrives

   to

   [System Paths]

      SYSTEMPATH = "" ? DETCMD.DLL GetWindowsSysDir

      WINDOWSPATH = "" ? DETCMD.DLL GetWindowsDir

      HARDDRIVELIST = "" ? DETCMD.DLL GetAllValidLocalHardDrives

      NETDRIVELIST = "" ? DETCMD.DLL GetAllValidNetworkDrives

      WINDOWSMODE = "" ? DETCMD.DLL GetWindowsMode

3. Then change the following

   DoShareStuff = +

    set CurrentDialog = DoShareStuff

     set MAKEBAK = "NO"

     ui start VSHARERunning

     ifstr $(ANSWER) == "NO"

   to

   DoShareStuff = +

    set CurrentDialog = DoShareStuff

     set MAKEBAK = "NO"

     ifstr $(WINDOWSMODE) != "ENHANCED"

        set ANSWER = "NO"

     else

        ui start VSHARERunning

     endif

     ifstr $(ANSWER) == "NO"

Steps for Version 1.1 Upgrade Users

-----------------------------------

Single-user upgrades and Admin upgrades (setup /a) work fine. However,

to run Setup or setup /n from the network with Windows in standard

mode, you must first make the changes mentioned above to the

STFSETUP.IN_ file in the ACCESS\INSTALL subdirectory on the network.

Steps for ADK Users

-------------------

The ADK Setup works fine in Windows standard mode. However, before you

create disks for your application, modify the SETUPWIZ.IN_ file (and

optionally the CUST12MB.IN_, CUST14MB.IN_, and CUST720K.IN_ files) as

follows:

1. Change the following

   [System Paths]

       SystemPath =  "" ? DETCMD.DLL GetWindowsSysDir

       WindowsPath     =  "" ? DETCMD.DLL GetWindowsDir

       HARDDRIVELIST   = "" ? DETCMD.DLL GetAllValidLocalHardDrives

       NETDRIVELIST = "" ? DETCMD.DLL GetAllValidNetworkDrives

   to

   [System Paths]

       SystemPath =  "" ? DETCMD.DLL GetWindowsSysDir

       WindowsPath     =  "" ? DETCMD.DLL GetWindowsDir

       HARDDRIVELIST   = "" ? DETCMD.DLL GetAllValidLocalHardDrives

       NETDRIVELIST = "" ? DETCMD.DLL GetAllValidNetworkDrives

       WINDOWSMODE =  "" ? DETCMD.DLL GetWindowsMode

NOTE: Unlike the Microsoft Access version 1.1 corrections, the first

two variables in the [System Paths] section of the ADK is

case-sensitive.

2. Add the test case around VSHARERunning by changing the following

   from

   DoShareStuff = +

    set CurrentDialog = DoShareStuff

     set MAKEBAK = "NO"

     ui start VSHARERunning

     ifstr $(ANSWER) == "NO"

   to

   DoShareStuff = +

    set CurrentDialog = DoShareStuff

     set MAKEBAK = "NO"

     ifstr $(WINDOWSMODE) != "ENHANCED"

        set ANSWER = "NO"

     else

        ui start VSHARERunning

     endif

     ifstr $(ANSWER) == "NO"

NOTE: This is exactly the same change as the Microsoft Access version

1.1 change.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.1 and the Microsoft Access Distribution Kit version 1.1. This problem no

longer occurs in Microsoft Access version 2.0 or the Microsoft Access

Developer's Toolkit version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start Windows in standard mode (win /s), using the Microsoft Access

   version 1.1 Retail disks.

2. Insert Disk 1 into drive A for 3.5-inch disks (or B for 5.25-inch

   disks).

3. From the File menu in Program Manager, choose Run.

4. Type a:\setup (or b:\setup) and press ENTER.

5. Follow the instructions on your screen.

When you insert the last disk, you will receive this error.

Additional reference words: 1.10 gpf

KBCategory:

KBSubcategory: StpOthr


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: Setup Writes Over Newer CTL3D.DLL File

Article ID: Q98671

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When installing Microsoft Access version 1.0, the file CTL3D.DLL

may be replaced, even if you currently have a more recent version of

the file.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

version 1.0. This problem has been corrected in Microsoft Access

version 1.1.

MORE INFORMATION

================

The CTL3D.DLL file provides the 3-D "look" for a Windows application's

buttons. This file is normally stored in the WINDOWS\SYSTEM subdirectory.

Additional reference words: 1.00

KBCategory:

KBSubcategory: StpOthr


PRA: SQL Delete Triggers Function Incorrectly

Article ID: Q99404

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access appears to delete a record in an attached SQL table, but

the record is not actually deleted. The record will reappear when you

requery the table.

CAUSE

=====

The Microsoft SQL Server driver that comes with Microsoft Access version

1.0 incorrectly indicates that the result of the SQL delete action is

successful.

RESOLUTION

==========

To correct this problem, you must DROP the current trigger and CREATE a new

delete trigger on the SQL Server that uses the RAISERROR command instead of

the PRINT command. This method causes Microsoft Access version 1.0 to not

delete the record and display the following error messages:

   ODBC - delete failed.

   [Microsoft][ODBC SQL Server Driver][SQL Server] <MESSAGE> (#-31073)

where <MESSAGE> is the message you specified in the RAISERROR command.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem was corrected in Microsoft Access version 1.1.

MORE INFORMATION

================

If you try to delete a record from an attached SQL table that has a delete

trigger that performs a ROLLBACK and a PRINT action on the SQL Server,

Microsoft Access version 1.0 appears to delete the record and then displays

a message box asking you to verify your deletion. The record is actually

not deleted and reappears when you requery the table by pressing SHIFT+F9,

choosing Show All Records from the Records Menu, or closing and reopening

the table.

In Microsoft Access version 1.1, the RAISERROR method works the same way

that it does in version 1.0. The PRINT method works similarly to the way it

does in version 1.0.

In version 1.0, the PRINT method appears to let you delete the record

without a warning, then later the record reappears. In version 1.1, the

PRINT method still does not display the message specified by the PRINT

command; however, it does not remove the record, and it does display the

following error message:

   ODBC - call failed.

Steps to Reproduce Problem

--------------------------

1. Create a trigger on a SQL Server table that uses the SQL commands

   ROLLBACK and PRINT.

2. Attach the SQL table that the delete trigger was created for by

   choosing Attach from the File menu.

3. Once the table is attached, open it in Datasheet view.

4. Select a record by clicking the gray record selector to the left of

   the record or by choosing Select Record from the Edit menu.

5. Delete the record by pressing the DEL key or by choosing Delete

   from the Edit menu.

6. Choose Yes in the Confirmation dialog box that is displayed.

The record appears to be deleted from the table. Requery the table by

pressing SHIFT+F9. The record reappears.

REFERENCES

==========

"Microsoft SQL Server Language Reference," version 4.2, pages 88-93,

137, 203-204, and 214-216

Additional reference words: 1.00 ODBC

KBCategory:

KBSubcategory: ObcOthr


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: SQORA.DLL Does Not Allow Lengthy SQL Statements

Article ID: Q102525

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are executing a query against, or updating a record in, an

Oracle table, the following error message is displayed

   Statement was longer then allowable maximum 2000+ chars

if the table and field names are long or the query is complex.

CAUSE

=====

This occurs because of 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 with the Oracle table in Datasheet view.

The query should yield only the columns to be updated.

For complex queries, reduce both the number of tables or joins in the

query and the number of fields used or shown in the query.

These workarounds reduce the lengths of SQL statements.

STATUS

======

Microsoft has confirmed this to be a problem in the Oracle ODBC driver

shipped with Microsoft Access version 1.1 and Microsoft Visual Basic

version 3.0 (Professional Edition). An updated driver that corrects

this specific problem is available from Microsoft.

MORE INFORMATION

================

How to Obtain the Updated Driver

--------------------------------

ORA110.EXE, a self-extracting zipped file, can be downloaded from the

MSACCESS forum on CompuServe (Library 11, ODBC Connectivity), or from

the Microsoft Software Data Library (MSDL).

If you are unable to download the file, Microsoft Product Support

Services (PSS) will send you the file on disk by mail. This disk also

contains the updated Btrieve driver.

NOTE: This driver is for use by registered owners of Microsoft Access

1.1 and Visual Basic 3.0 (Professional Edition) only. By installing

these files, you are indicating that you own one of these two products.

PSS Disk Contents

-----------------

The PSS disk contains the following files:

   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

and will not run as a stand-alone file.

The following two files are actually 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

A README.TXT file documents the changes to the Btrieve and Oracle

drivers and the installation procedures for each.

Oracle drivers are manufactured by Oracle Corporation and Btrieve

drivers by Novell, Inc., vendors independent of Microsoft; we make no

warranty, implied or otherwise, regarding these products' performance

or reliability.

Additional reference words: 1.10

KBCategory:

KBSubcategory: ObcOthr


PRA: StDevP() with All NULL Records Returns #ERROR

Article ID: Q96902

------------------------------------------------------------

---------

The information in this article applies to:

 - Microsoft Access version 1.0

------------------------------------------------------------

---------

SYMPTOMS

========

When the StDevP() function is applied to a database

containing only NULL

records, The error message "#ERROR" results. This problem

does not occur

with the StDev() function.

RESOLUTION

==========

Make sure that at least one record of a database where the

StDevP()

function is used contains a non-NULL value.

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft

Access

version 1.0. This problem was corrected in Microsoft Access

version 1.1.

MORE INFORMATION

================

StDevP() and StDev() are functions that return estimates of

the standard

deviation for a population or a population sample,

respectively.

Steps to Reproduce Behavior

---------------------------

1. Create and save the following table:

      Table: Table1

      -------------------------

      FieldName: A

         DataType: Text

      FieldName: B

         DataType: Number

         Default Value: (blank)

2. View the Table1 table in Datasheet view. Add several

records to the

   table, entering text in field A. Do not enter anything in

field B for

   any of the records.

3. Create a new unbound form with the following text box:

      Object: Text box

      ----------------------------------------

      ControlName: Field0

         ControlSource: =DStDevP("B","Table1")

4. View the form in Form view.

In Microsoft Access version 1.0 you will receive a "#ERROR"

error

message. In Microsoft Access version 1.1 you will receive

NULL.

Additional reference words: 1.00

KBCategory:

KBSubcategory: PgmOthr


PRA: STFSETUP.EXE Does Not Overwrite Existing SYSTEM.MDA

Article ID: Q109352

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The Change Workgroup utility (STFSETUP.EXE) will not overwrite an existing

SYSTEM.MDA file, but gives no indication that the SYSTEM.MDA file was not

overwritten.

RESOLUTION

============

To have the Change Workgroup application create a new SYSTEM.MDA file in a

directory that already contains a SYSTEM.MDA file, you must first remove

or rename the existing SYSTEM.MDA file.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Start the Change Workgroup utility.

2. Choose New.

3. Create a new workgroup in C:\TMP\SYSTEM.MDA. (Make sure you have a

   TMP subdirectory first.)

4. Repeat steps 1-3.

The process will be completed with no notification given that a new

SYSTEM.MDA was not created the second time.

Additional reference words: 1.00 1.10 Setup ChangeWorkGroups

KBCategory:

KBSubcategory: GnlOthr


PRA: Timeout While Waiting for DDE Response

Article ID: Q99942

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access generates the message "Timeout while waiting for DDE

response" when you try to initiate a dynamic data exchange (DDE) link

with another application.

CAUSE

=====

This error occurs when the function attempting to initiate the link is

invoked using a RunCode action in a macro and the RunCode action macro

is called from another application using DDE.

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.

MORE INFORMATION

================

Microsoft Access takes time-outs with all attempts to perform DDE to

other applications if the other application is currently conversing

with Microsoft Access as a DDE server.

Steps to Reproduce Problem

--------------------------

The following instructions demonstrate the problem by showing how to

use Word for Windows to run a Microsoft Access macro that attempts to

initiate a DDE conversation with Microsoft Excel.

1. Start Microsoft Excel with the default worksheet Sheet1 and type some

   text in cell A1, or row 1, column 1.

2. Start Microsoft Access and create the following macro called "Test":

      Test Actions

      ------------

      RunCode

         Function Name: =TestDDE()

3. Create the following Access Basic function:

      Option Explicit

      Function TestDDE ()

         Dim chan

         chan = DDEInitiate("excel", "sheet1")

         DDETerminate chan

      End Function

4. Start Word for Windows and choose Macro from the Tools menu.

   NOTE: Start Excel before running the macro or the macro will fail.

5. In the Macro Name box, type "test" (without the quotation marks),

   and press the Edit button.

6. Type the following macro in the editing window:

      Sub MAIN

         chan = DDEInitiate("msaccess", "system")

         DDEExecute chan, "test"

         DDETerminate chan

      End Sub

7. Run the macro by choosing the Start button on the macro toolbar

   or by pressing ALT+SHIFT+S.

Approximately 45 to 60 seconds later the following message is

generated by Microsoft Access:

   Timeout while waiting for DDE response

Additional reference words: 1.00 1.10 Dynamic Data Exchange

KBCategory:

KBSubcategory: IntpDde


PRA: Transaction Limit Can Cause "Out of Memory" Error

Article ID: Q90130

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to make a change to a database, you receive one of the

following error messages, even if you have ample system resources and disk

space.:

   Insufficient Disk Space or Memory

   -or-

   You are out of disk space or have exceeded maximum transaction size

CAUSE

=====

Microsoft Access has a 4 MB transaction limit. All table design

changes are embedded within a transaction to ensure database

integrity. As a result, you will get the "Out of memory" error if you

attempt to update the contents of a table this large or larger.

RESOLUTION

==========

If, for example, a table contains a field of type "double" that

you want to change to "integer," there are two ways to do this:

Method 1

--------

1. Select and copy the desired table to the Clipboard.

2. From the Edit menu, choose Paste (paste only the table structure

   to a new table name).

3. Change the data type of the desired column in this new table.

4. From the Edit menu, choose Paste (paste append the data to this

   new table).

Method 2

--------

1. Add a new column to the table with the data type you wanted.

2. Execute an update query, where the new column is assigned the

   value of the column you wanted to change.

3. Delete the old column from the table.

NOTE: You may get similar "out of memory" alerts when using both of

these methods, but the message boxes should give you the option of

continuing or canceling.

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.

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: TblModfy


PRA: TransferSpreadsheet Causes Error -1310

Article ID: Q106294

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are importing or exporting to Microsoft Excel using the

TransferSpreadsheet macro action, the following error is generated:

   Reserved error (-1310); there is no message for this error.

CAUSE

=====

When the table name is left blank in the TransferSpreadsheet Action,

Microsoft Access cannot determine the table to export.

RESOLUTION

==========

To correct this, include a valid table or query that you want to import or

export in the "Table Name" argument.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Create a new macro named ExcelExport:

      ExcelExport Actions

      -------------------

      TransferSpreadsheet

         Transfer Type: Export

         Spreadsheet Type: Microsoft Excel

         Table Name: (leave blank)

         File Name: C:\ACCESS\TEST.XLS

         Has Field Names: Yes

         Range: (leave blank)

2. Run the Macro ExcelExport.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmExl4


PRA: TrueType Fonts Shift Vertically on HP LJ4 Printer

Article ID: Q100151

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When you print a Microsoft Access form or report formatted with a TrueType

font to a Hewlett-Packard (HP) LaserJet 4 printer, the text in the controls

is shifted vertically. These symptoms also occur with the IBM 4029 printer.

CAUSE

=====

The HP LaserJet 4 and IBM 4029 printer drivers are reporting incorrect font

metrics for some TrueType fonts. This problem causes Microsoft Access to

incorrectly compensate by shifting the fonts vertically when sending the

form or report to the printer.

RESOLUTION

==========

Use a non-TrueType font when you print to either the HP LaserJet 4 or IBM

4029 printer, or use another printer driver that is compatible with these

printers (for example, the HP LaserJet 3 printer driver).

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0, using HP LaserJet 4 printer driver versions 31.1.03 and 31.V1.08, or

the IBM 4029 printer driver. This problem no longer occurs in Microsoft

Access version 1.1.

MORE INFORMATION

================

If you experience the same problem with a non-TrueType font, verify that

you are using a printer font. If Microsoft Windows is remapping your font

to a TrueType font, you will continue to see the same vertical shift when

you try to print.

Steps to Reproduce Problem

--------------------------

The following example assumes that you have an HP LasetJet 4 printer

connection and that you are using a HP LaserJet 4 printer driver version

31.1.03 or 31.V1.08:

1. Create a new, unbound form.

2. Add two text box controls to the form, as follows:

      Object: Text Box

      ------------------------------------------

      ControlName: Field0

         ControlSource: ="Testing TrueType font"

         FontName: Arial

      Object: Text Box

      ----------------------------------------------

      ControlName: Field2

         ControlSource: ="Testing non-TrueType font"

         FontName: Microsoft Sans Serif

3. Switch to Form view.

4. Verify that you are configured to print to an HP LaserJet 4 printer,

   then choose Print Preview from the File menu. The data looks normal and

   is not shifted in either control.

5. From the File menu, choose Print. Note that the data in Field0 is

   shifted vertically in the control; the data in Field2 maintains the

   correct position.

The HP LaserJet 4 printer driver (HPPCL5E.DRV) is manufactured by Hewlett-

Packard 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 ptriss hp4 hplj4

KBCategory:

KBSubcategory: PtrOthr


PRA: Unique Values Only Select Query Shows Duplicates

Article ID: Q93692

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

The result of a query includes duplicate values even though you

selected the Unique Values Only check box (SELECT DISTINCT) in the

Query Properties dialog box.

CAUSE

=====

Duplicate values occur when both of the following conditions are met:

1. The query input data set contains more than approximately 64K of data

   and the duplicate values are widely scattered in the input data.

   For example, a SELECT DISTINCT query on a text column with an average

   length of 20 characters will not display duplicate values unless the

   query input data set included more than 3,300 values (65536 / 20 =

   3276.8. Note that if the query is based on a table that has 10,000

   rows, but the specified criteria retrieves only 20 rows, it is the

   set of 20 rows that determines the size of the query input data set.

   In other words, it is the WHERE clause that determines the size of

   the query input data set.

2. The values that have duplicates appear close (maybe in the first

   dozen values) to what would normally be the beginning of the query

   output. By default, a SELECT DISTINCT query displays data sorted

   implicitly. For example, the following displays the result sorted by

   Order ID:

      SELECT DISTINCT [Order Details].[Order ID]

      FROM [Order Details];

   However, in a SELECT DISTINCT query that uses more than one column

   and sorts by a column other than the first one, the duplicates could

   appear anywhere in the output. To see if there are duplicates, you

   need to remove the sort.

NOTE: This problem also appears in a Crosstab query as duplicated

columns with names like Field1. Use Fixed Column heading to prevent

the problem.

RESOLUTION

==========

In addition to SELECT DISTINCT queries, you can use GROUP BYs in a

totals query to eliminate duplicates in the output. Both SELECT

DISTINCT queries and GROUP BYs in a totals query are limited to

10 columns. Usually, GROUP BY is faster when the resulting data set

is much smaller than the input data set, and SELECT DISTINCT is

faster when there are only a few duplicates.

To ensure the correct results, use GROUP BYs in a totals query instead

of using the Unique Values Only query property. For example, the

following two select queries give identical results:

   SELECT DISTINCT [Order Details].[Order ID]

   FROM [Order Details];

   SELECT DISTINCTROW [Order Details].[Order ID]

   FROM [Order Details]

   GROUP BY [Order Details].[Order ID];

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access version

1.0. This problem was corrected in Microsoft Access version 1.1.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 6,

"Designing Select

Queries," pages 128-130 and 142-148

Additional reference words: 1.00

KBCategory:

KBSubcategory: QryOthr


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: User with Full Permissions Cannot Run Query

Article ID: Q96102

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following message even though you have full permission

on a table:

   Couldn't read; no read permission for table or query <query name>

You can view the table in Datasheet and Design view, and you can open

the query in Design view.

CAUSE

=====

This occurs when a query has the property Run With Owner's Permissions

checked and the user who created the query (the owner) is no longer on

the system. Either the owner was deleted or the database was opened in a

Microsoft Access session that was started with a different SYSTEM.MDA

where the owner is not a included.

When the property Run with Owner's Permissions is checked, Microsoft

Access checks the owner's permissions. It does not compare the owner's

permissions to those of the user running the query. Therefore, if the

owner is not on the system, other users cannot execute the query as long

as the property Run with Owner's Permissions is checked.

RESOLUTION

==========

To allow users to run the query with their own permissions, clear the

Run With Owner's Permissions check box and save the query.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. Start Microsoft Access. If you have activated security, log in as a

    member of the group Admins.

 2. From the Security menu, choose Users.

 3. Press the New button and add a new user called John. Add another user

    called Jane. Do not assign either to any group other than Users.

 4. If you have already activated security, skip this step. Choose Change

    Password... from the Security menu. Leave the Old Password blank, enter

    Admin for New Password and Verify. Press the OK button.

 5. Exit and restart Microsoft Access. Log in as John leaving the password

    blank.

 7. Create a new query based on any table. If you are in a secure system,

    base the query on a table that the Users group has full permissions to.

    From the View menu, choose Query Properties and select the Run with

    Owner's Permissions check box.

 8. Exit and restart Microsoft Access. Log in as Admin using the password

    Admin.

 9. Choose Users from the Security menu. Delete the user John.

10. Exit and restart Microsoft Access. Log in as Jane leaving the password

    blank.

11. Attempt to run the query.

    At this point, you will see the error message "Couldn't read; no read

    permission for table or query '<query name>'.

12. Verify that Jane can open the query in Design view as well as open the

    table on which the query is based.

To avoid the problem, in Design view, the user Jane can choose Options

from the View menu and clear the Run With Owner's Permissions check box.

Depending on the security, that may have to be done by an Admin. After you

clear the check box, the query will run.

REFERENCES

==========

For more information on query permissions, search for "Run with Owner's

Permissions" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 serial number pin ADK errmsg

KBCategory:

KBSubcategory: ScrtOthr


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 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: "Can't Update Currently Locked" Attaching FoxPro Table

Article ID: Q109709

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You receive the error message "Can't Update Currently locked" when you

attach or view a previously attached FoxPro table that another user has

open and is running an append or update operation on.

CAUSE

=====

This error occurs because FoxPro temporarily locks the table and indexes

when a user is performing an append or update operation. The locks are

released as soon as the operation is complete.

RESOLUTION

==========

Wait for the append or update operation to be complete, and then attach or

view the FoxPro table again.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open any database.

2. Attach a FoxPro table located on a shared network drive.

3. Start an append or update query on the attached table. The operation

   will need to take long enough to complete the rest of these steps.

4. Start another instance of Microsoft Access on a second computer.

5. On the second computer, attach the same FoxPro table you attached in

   step 2.

You will receive the error message stated above.

NOTE: The following sample code can be used in place of the append or

update query in step 3 to keep the first computer busy with the FoxPro

table:

   Sub test ()

      Dim db As Database

      Dim ds As Dynaset

      Set db = CurrentDB()

      'Query1 is based on the attached FoxPro table and has no criteria.

      Set ds = db.CreateDynaset("Query1")

      ds.MoveFirst

      While Not ds.eof

         ds.Edit

         ds!Author = "FOX"

         ds.Update

         ds.MoveNext

         Debug.Print ".";

         DoEvents

       Wend

       ds.Close

       db.Close

   End Sub

Additional reference words: 1.00 1.10 Attaching

KBCategory:

KBSubcategory: IsmXbase


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 Open File" Error Message

Article ID: Q93295

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Attempting to open a database exclusively when another user already

has it open results in the error message:

   Couldn't open file <database name>.

CAUSE

=====

The Help topic says in part "You must have ReadData permission for

the file in order to view its data." The error message and Help

text are misleading because the problem is that the file cannot be

opened exclusively.

RESOLUTION

==========

To open the file successfully:

1. Press ESC or choose the OK button to exit the error message.

2. From the File menu, choose Open Database.

3. Select the database you want to open.

4. Clear the Exclusive check box.

5. Choose OK.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

Additional reference words: 1.00 1.10 network share errmsg checkbox

KBCategory:

KBSubcategory: GnlOthr


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: "Error Writing to File 'MSAIN100.DLL'" During 1.1 Install

Article ID: Q103997

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The error message

   Error writing to file "MSAIN100.DLL"

is displayed when you are upgrading a network installation of Microsoft

Access from version 1.0 to version 1.1.

CAUSE

=====

Make sure that no users are running Microsoft Access on the network.

During the version 1.1 installation process, the MSAIN100.DLL file is

deleted and replaced with the MSAIN110.DLL file. This file provides

the international support for Microsoft Access.

If someone is using Microsoft Access when you start the installation

process, the error message

   Error writing to file "MSAIN100.DLL"

is received when the Setup program tries to delete that file. Once all

users have closed Microsoft Access, you can restart Setup.

MORE INFORMATION

================

The following files are deleted during Microsoft Access 1.1

installation:

   BTRVISAM.DLL

   DBSIASM.DLL

   MSABC100.DLL

   MSAES100.DLL

   MSAIN100.DLL

   MSAJU100.DLL

   MSAJT100.DLL

   PDXISAM.DLL

REFERENCES

==========

For more information, see the README.TXT file provided with Microsoft

Access 1.1.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: StpNet


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 Database Object" Error Message

Article ID: Q94600

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are trying to use a database object (database, QueryDef,

table, dynaset, snapshot) within Access Basic, you may receive the

following error message:

   Invalid Database Object.

CAUSE

=====

The problem occurs if you are within a transaction, you call

another function or procedure which dimensions the database, and

then leave the function or procedure which implicitly closes the

object that was opened within the transaction.

In this case Microsoft Access will try to close it and since it was

opened within a transaction, Microsoft Access will roll back all

levels of nested transactions.

If any other database objects were opened within the transaction,

rolling back has the effect of closing them. This means that any

references to an object opened within a transaction after another

object was forced to be implicitly closed will result in the "Invalid

database object" error message.

This problem will not occur if you always close database objects

before they go out of scope. The problem only occurs if you let

Microsoft Access implicitly close them.

RESOLUTION

==========

 - You should always try to open database objects outside of

   transactions.

 - You should always explicitly close database objects.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

Open the sample database NWIND.MDB and enter the following code fragment in

a module to illustrate the problem:

   Function One ()

      Dim MyDB As Database, MyTable As Table

      Set MyDB = CurrentDB()

      BeginTrans

         Set MyTable = MyDB.OpenTable("Employees")

         X = Two()

         Debug.Print MyTable.RecordCount '"Invalid database object."

         MyTable.Close

      CommitTrans

      MyDB.Close

   End Function

   Function Two ()

      Dim MyDB2 As Database

      Set MyDB2 = CurrentDB()

   End Function

MyDB loses scope, implicitly rolls back and closes MyDB with the

effect of also closing MyDB in the One() function.

To circumvent the problem, change the procedure Two to:

   Function Two()

      Dim MyDB2 as Database

      Set MyDB2 = CurrentDB()

      MyDB2.Close

   End Sub

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: PgmObj


PRB: "Invalid Range" Error When Importing from MS Excel

Article ID: Q88161

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Excel versions 3.x and 4.x for Windows

---------------------------------------------------------------------

SYMPTOMS

========

When you import the named range "Database" from Microsoft Excel

versions 3.x and 4.x files, the following error appears:

   Invalid Range.

This error does not occur when you import from Microsoft Excel

version 2.0.

CAUSE

=====

This error is caused by the difference in the Microsoft Excel binary

information file format (BIFF) structures between versions:

 - BIFF2 has the range listed in its internally defined named range

   table. Microsoft Access can read this table.

 - BIFF3 and BIFF4 use an internal construct, rather than listing

   "Database" in the internal named range table. Microsoft Access

   cannot read the internal construct of BIFF3 and BIFF4.

RESOLUTION

==========

There are three recommended workarounds that enable you to import data

successfully from Microsoft Excel:

 - Save the Excel file in 2.x format (in the File Save As dialog)

   before importing the file into Microsoft Access.

 - Give the range "Database" a second name (such as "My_Database_Range").

   Microsoft Excel allows users to assign multiple names to the same

   range.

 - Use the range specification rather than a named range (for example,

   A1:D50).

STATUS

======

Microsoft has confirmed this to be a problem in Microsoft Access

version 1.0. This problem was corrected in Microsoft Access version 1.1.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. In Microsoft Excel version 3.0 or higher, create a named range

   called "Database" (without the quotation marks).

2. Save the file as TEST.XLS.

3. In a Microsoft Access database, choose Import from the File menu.

4. Select Microsoft Excel, and then choose OK.

5. Select TEST.XLS, and choose Database for the named range.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmExl4


PRB: "Invalid Range" Error When Importing Spreadsheet Range

Article ID: Q92891

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Excel for Windows, version 4.x

---------------------------------------------------------------------

SYMPTOMS

========

When you try to import a range of cells from a Microsoft Excel version 4.0

spreadsheet into Microsoft Access version 1.x, you receive the following

error message:

   Invalid Range

The Select File dialog box appears after the error message.

CAUSE

=====

You specified an invalid range of cells to import, either by

improperly referencing them (for example, R0C0:R5C3), or by

providing a nonexistent range name.

RESOLUTION

==========

Reselect the file that you want to import, and then choose Import

from the File menu. When the Import Spreadsheet Options dialog box

is displayed, make sure you type a valid range reference in the

Spreadsheet Range box. This range can be a specific range of cells

(for example, A5:B12), or a defined name that refers to a range of cells on

the spreadsheet (for example, MYRANGE).

STATUS

======

This behavior is by design.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 4, pages 72-75

Additional reference words: 1.00 1.10 cell errmsg

KBCategory:

KBSubcategory: IsmExl4


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: "Object not Found..." Error When Compacting Database

Article ID: Q109367

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are compacting a database, the error message

   Object Not Found <Filename>.MDB

occurs. <Filename> is the name of the database file you are trying to

compact.

CAUSE

=====

The database's System tables may be corrupt, or the MSysObjects table

contains a pointer to an object in one of the other System tables that no

longer exists.

RESOLUTION

==========

Try to following steps to find the cause of the error and correct the

problem:

1. Make a backup copy of the .MDB file.

2. Open the .MDB file in Microsoft Access.

3. Identify the corrupt object by opening every object in the database

   in Design view. When you try to open a corrupt object in Design

   view, you should receive an error message stating that the object

   does not exist, or that you do not have permissions to the object,

   even though you do.

4. After you have identified the corrupt object, close the database and

   then create a new database. Import all the good tables from the original

   database to the new database. Compact the new database to make sure that

   it will compact correctly.

5. Repeat step 4 for the queries, forms, reports, macros, and modules in

   the original database, excluding any corrupt objects. Make sure to

   compact the new database after you import each object type.

6. In the new database, re-create any object that you identified as corrupt

   in the original database.

7. In the new database, re-create any table relationships that exist in

   the original database.

8. In the new database, re-create any Import/Export specifications that

   exist in the original database.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.1, Chapter 4, "Importing or

Attaching Objects from Microsoft Access Databases," pages 68-69, and

Chapter 25, "Compacting a Database," pages 636-637

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: GnlCmp


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 When Exporting Table

Article ID: Q101080

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you are exporting a Microsoft Access table, an "Out of Memory"

error message occurs.

CAUSE

=====

This error message can occur if you have included a nonalphanumeric

character in your table name. Examples of nonalphanumeric characters

include the colon (:) and the comma (,).

RESOLUTION

==========

Rename the table, making sure not to include any nonalphanumeric

characters in the table name.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

If the export table name you create in the File Name box of the Export

to File dialog box contains any nonalphanumeric characters, Microsoft

Access tries to create a filename with these characters and causes an

MS-DOS error. This error occurs when you are exporting to any data

destination that creates an MS-DOS filename for the table.

Steps to Reproduce Behavior

---------------------------

NOTE: Changing the data destination in step 3 below to something other

than Text (Delimited) may cause the error message not to occur.

1. Copy the Employees table in the sample database NWIND.MDB to a

   table named Empl,Nwind (note the comma in the table name). The

   steps to copy a table are as follows:

   a. Select the Employees table in the Database window.

   b. From the Edit menu, choose Copy.

   c. From the Edit menu, choose Paste. Type the new table name

      in the Paste Table As dialog box, and then choose OK.

2. From the File menu, choose Export.

3. Select Text (Delimited) as the Data Destination.

4. In the Select Microsoft Access Object dialog box, select the

   Empl,Nwind table and then choose OK.

The following error message appears:

      Microsoft Access

      Out of Memory

Additional reference words: 1.00 1.10 import paradox excel fixed

KBCategory:

KBSubcategory: IsmTxtd


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: "Outdated COMMDLG.DLL" Error Message During Setup

Article ID: Q93694

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you try to open a database, you receive the following error

message:

   Outdated "COMMDLG.DLL." Please reinstall Microsoft Access.

CAUSE

=====

There are three possible causes of this problem:

1. More than one version of COMMDLG.DLL on your computer.

2. An outdated copy of the COMMDLG.DLL file.

3. An incompatible copy of COMMDLG.DLL.

RESOLUTION

==========

The three solutions below correspond with the three causes listed

above:

1. Rename the duplicate versions of COMMDLG.DLL.

2. Make sure the COMMDLG.DLL file in the WINDOWS system subdirectory is

   newer than the following:

      3/10/92   (for Microsoft Windows version 3.1)

      10/01/92  (for Windows for Workgroups)

      10/25/92  (for Microsoft Access)

3. If you have a third-party COMMDLG.DLL file, make sure that it is

   compatible with Microsoft Access.

The three sections under "More Information" describe these procedures.

MORE INFORMATION

================

Searching for Copies of COMMDLG.DLL File

----------------------------------------

To search for all occurrences of the COMMDLG.DLL file, follow these

steps:

1.  Exit Windows.

2.  Search for any other copies of COMMDLG.DLL on the current drive by

    typing the following commands at the MS-DOS prompt:

      cd\

      dir commdlg.dll /s

Repeat these commands on all other drives and rename or delete any copies

of the COMMDLG.DLL file that you find. When you finish, you should have a

single copy of COMMDLG.DLL on your computer, located in the WINDOWS system

subdirectory.

Installing a New COMMDLG.DLL File

---------------------------------

If you delete or rename all duplicates of the COMMDLG.DLL file and continue

to get the above error message in Microsoft Access, copy COMMDLG.DL_ from

Disk 1 of Microsoft Access and EXPAND.EXE from Disk 3 of Windows version

3.1. Then use EXPAND.EXE to expand the COMMDLG.DL_ file as follows:

   c:\<path>\EXPAND <path>\COMMDLG.DL_ c:\windows\system\COMMDLG.DLL

NOTE: Do not copy COMMDLG.DL$ from the Microsoft Access disks.

Microsoft Access Setup is required to decompress COMMDLG.DL$.

Ensuring No Other Applications Are Open

---------------------------------------

When Microsoft Access Setup tries to update the COMMDLG.DLL file, you may

receive an error message stating that Microsoft Access was unable to access

the file. In most cases, another application is using the COMMDLG.DLL file.

To ensure that no other applications are open when you run Microsoft Access

Setup, use the following steps:

1. Add a new program group in Windows Program Manager called

   Temporary.

2. Move all the icons from the Startup program group to the Temporary

   program group.

3. Edit the [Windows] section of the WIN.INI file as follows:

      [Windows]

      RUN=

      LOAD=

4. Restart Windows and run Microsoft Access Setup.

If you continue to encounter problems, edit the AUTOEXEC.BAT file to look

for conflicting terminate-and-stay-resident (TSR) programs.

Additional reference words: 1.00 1.10 errmsg tsr

KBCategory:

KBSubcategory: StpOthr


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: "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: '|' Isn't A Valid Path Error Message on Start Up

Article ID: Q95447

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When trying to start Microsoft Access, you receive the following error

message:

   '|' Isn't a Valid Path

CAUSE

=====

The drive that contains your TEMP directory does not have enough disk

space, or there is no valid SET TEMP statement in the AUTOEXEC.BAT file.

RESOLUTION

==========

Exit from Windows. At the MS-DOS prompt, type SET and press ENTER.

This gives you a listing of the MS-DOS environment settings. Confirm

that one of the settings is TEMP= followed by a valid path.

If you find the TEMP= setting, then check the amount of disk space

available on the drive where your temporary directory resides. If you

do not have enough disk space, delete unnecessary files from the

drive or move the TEMP directory to a partition that has enough disk

space and change the SET TEMP= line in the AUTOEXEC.BAT file.

STATUS

======

This problem does not occur in Microsoft Access version 1.1.

Additional reference words: 1.00 WinIss

KBCategory:

KBSubcategory: EvnOs


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: <Expression> Not Part of Aggregate Function or Grouping

Article ID: Q98808

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If a select query that contains an expression is converted to a totals

query, the following error message is displayed when the query is run:

   <expression> not part of aggregate function or grouping.

CAUSE

=====

When a select query is converted to a totals query, all expressions

are assumed to contain aggregate functions and cause the Total field

to default to Expression.

RESOLUTION

==========

To work around this problem, set the Total field to Expression and

include an aggregate function as part of the expression for Field

Name. If you cannot add an aggregate function, set Total to Group By

as shown:

   Query: Query Name

   ------------------------

   Field Name: <expression>

   Total: Group By

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

Using the sample database NWIND.MDB, complete the following steps:

1. Open the Employee List query in Design view by choosing the Query

   button in the Database window, selecting the query name, and

   choosing Design.

2. From the View menu, choose Totals to convert the query to a totals

   query.

3. From the Query menu, choose Run. The following error message is

   displayed:

      "[Last Name] & ", " & [First Name]" not part of aggregate

      function or grouping.

4. In the query grid, make the following changes:

     Query: Employee List

     -----------------------------------------------------------

     Field name: Employee Name:[Last Name] & ", " & [First Name]

     Total: Group By

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 141-149

Additional reference words: 1.00 1.10 queries aggregate error

KBCategory:

KBSubcategory: QryTotal


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: ADK Custom Setup Hangs During Installation

Article ID: Q100971

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If you create Setup disks using the Microsoft Access Distribution Kit

(ADK) Custom Setup Wizard, the installation process hangs immediately

after SETUP.EXE creates the program group.

CAUSE

=====

This problem is caused by not specifying an icon file for the application

in the .ICO File (Optional) field and selecting the Change Workgroups

Program Manager Item check box when the message "Would you like to install

any of these optional features?" appears in the Setup Wizard.

RESOLUTION

==========

Run the Setup Wizard again and specify an icon file for the .ICO File

(Optional) field, or follow the steps outlined below to modify the

STFSETUP.IN_ file.

STATUS

======

This behavior no longer occurs in the Microsoft Access Developer's Toolkit

version 2.0.

MORE INFORMATION

================

When the Setup Wizard creates the STFSETUP.IN_ file, it requires that

that you have an icon file if you choose to install Change Workgroups.

The [Custom] section of the file contains the following line:

   InstallChangeWorkGroup="YES"

If you have set this option to Yes, you must also add a line in the

[Program Manager] section of the STSETUP.IN_ file that reads:

   $(AppPath)"NWIND.ICO"

You also need to substitute NWIND.ICO with an icon name that you

specify.

Updating Your STFSETUP.IN_ File

-------------------------------

1. Open the STFSETUP.IN_ file in Notepad. This file is usually found

   in the DISK1 directory of the custom application.

2. Change the following entry

      [Program Manager]

      CreateProgManGroup $(ProgGroupDesc), "NWIND"

      CreateProgManItem $(ProgGroupDesc), "NWIND",

      $(AppPath)"MSARN110.EXE_ NWIND.MDB /Ini NWIND.INI"

      EXIT

   to read

      [Program Manager]

      CreateProgManGroup $(ProgGroupDesc), "NWIND"

      CreateProgManItem $(ProgGroupDesc), "NWIND",

      $(AppPath)"MSARN110.EXE_ NWIND.MDB /Ini NWIND.INI",

      $(AppPath)"NWIND.ICO"

      EXIT

Steps to Reproduce Behavior

---------------------------

1. Run the Microsoft Access Custom Setup Wizard. Do not specify an

   icon.

2. When you are prompted for ISAMs, select ChangeWorkGroup.

3. After the Setup Wizard creates your disks, run SETUP.EXE. The

   process will hang on the last disk, after the icons are added to

   Windows Program Manager.

Additional reference words: 1.10 ADK

KBCategory:

KBSubcategory: StpFail


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: Bitmap May Not Display Correctly

Article ID: Q95448

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A bitmap that displays correctly in another application does not display

correctly in Microsoft Access.

CAUSE

=====

When Microsoft Access starts, it loads a fixed 256-color palette. This

color palette supports the most common colors used in bitmaps and

metafiles. All pictures and OLE Objects displayed in Microsoft Access

are mapped to this color palette.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

By using a fixed color palette, Microsoft Access can display multiple

pictures and OLE objects on the screen at one time without each new object

affecting the screen colors.

However, Microsoft Access can display multiple bitmaps at one time.

Therefore, Because Windows can use only one palette at a time, Microsoft

Access uses a common palette that hopefully will be common to all the

bitmaps Microsoft Access might display.

This is why bitmaps and metafiles displayed in Microsoft Access may be

colored differently than they were in the application in which they were

created. Because Windows can use only one palette at a time, each object

Microsoft Access displays must be mapped to the fixed color palette loaded

by Microsoft Access. Microsoft Windows determines this mapping. You cannot

modify it.

Steps To Reproduce Behavior

---------------------------

1. Start Microsoft Paintbrush (PBRUSH.EXE).

2. Choose Image Attributes and select Black And White under the

   Color option.

3. Create a simple picture using several different shades of gray.

4. Choose Save from the File menu.

5. Under the Save File As Type option, select 256 Color Bitmap.

6. Start Microsoft Access, and open the sample database NWIND.MDB.

7. Open the Categories form in Form view.

8. Select the Picture Control.

9. Choose Insert Object from the Edit menu, and click the File button.

10. Choose the file you just created in Microsoft Paintbrush, and click the

    OK button.

Result: the file loads as a solid black picture. Microsoft Paintbrush uses

a custom palette to offer a variety of shades of gray. But Microsoft Access

does not have the ability to load or reproduce this custom color palette,

so it requests that Windows map each of the colors in the bitmap to the

custom palette that was loaded when Microsoft Access started.

This example is extreme. In most cases the color change will be slight.

Additional reference words: 1.00 1.10 appearance

KBCategory:

KBSubcategory: FmrColr


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: Can't Create Two Relationships Between Same Tables

Article ID: Q94189

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If you create a second relationship between two tables that already have

a relationship, Microsoft Access will automatically remove the first

relationship between the two tables.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps To Reproduce Behavior

---------------------------

1. Create two tables that share a common field:

      Table: Table1

      ------------------------------

      Field Name: Test [Primary key]

      Date Type: Text

      Table: Table2

      ----------------

      Field Name: Test

      Date Type: Text

2. From the Edit Menu choose Relationships, and create a relationship

   between Table1 and Table2 on the Test field with the Enforce

   Referential Integrity check box selected. Choose Add.

3. Create another relationship between the two tables. Choose Add.

   Note that creating the second relationship removes the first.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RltOthr


PRB: CancelEvent Action in OnClose Macro Prevents Exit

Article ID: Q90856

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

After a form is opened, Microsoft Access and Microsoft Windows

cannot be closed (quit).

CAUSE

=====

If there is a CancelEvent action in an OnClose macro, you will be

unable to close Microsoft Access and Windows.

RESOLUTION

==========

If a form's OnClose property specifies a macro that executes a

CancelEvent action, you will not be able to close the form. You must

either correct the condition that caused the CancelEvent action or

open the macro and delete the CancelEvent action. If the form is a

modal form, you will not be able to open the macro.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 549-552

Additional reference words: 1.00 1.10 exit checkpage

KBCategory:

KBSubcategory: McrActn


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 Auto Update an OLE-Linked Object in a Table

Article ID: Q101320

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The Auto Update check box is unavailable in the Edit Paste Special

dialog box when you are attempting to paste link an OLE object.

CAUSE

=====

You cannot paste link an object into an OLE-object field in a table in

Microsoft Access and specify that the link be "hot," or automatically

updated.

You can place linked OLE objects on forms and reports when they are

in Design view. If you paste a link to an OLE object into a form or

report in Design view, the Auto Update check box will be available.

RESOLUTION

==========

One workaround is to force Microsoft Access to update the OLE-linked

field by selecting the object to update, choosing Object from the Edit

menu, and then selecting Update.

This process can be automated using the Access Basic UpdateOLE()

function listed below, which can be assigned to a button on the form

or to the OnCurrent property of the form. If it is assigned to the

OnCurrent property, Microsoft Access will automatically perform the

macro whenever you select a different record. This will ensure that

the data in the selected record will always be current, effectively

simulating auto updating.

Create a new module with the following declarations and UpdateOLE()

function:

   '****************************************************************

   ' DECLARATIONS SECTION

   '****************************************************************

   Option Explicit

   '****************************************************************

   ' FUNCTION: UpdateOLE

   '

   ' PURPOSE: Automates updating an OLE-linked field.

   '

   ' ARGUMENTS:

   '    FieldName - A string with the name of the field to update.

   '

   ' EXAMPLE USAGE:

   '    The OnPush property for a button could be set to:

   '       =UpdateOLE("OLEField")

   '

   ' SIDE EFFECTS:

   '    Focus will be left on the OLE-object field.

   '    The record will be put in Edit Mode.

   '

   '****************************************************************

   Function UpdateOLE (ByVal FieldName As String)

      On Error GoTo ErrUpdateOLE

      DoCmd GoToControl FieldName

      DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, A_OBJECT, A_OBJECTUPDATE

   ByeUpdateOLE:

      Exit Function

   ErrUpdateOLE:

      Resume ByeUpdateOLE

   End Function

Using the UpdateOLE() Function

------------------------------

You can use the UpdateOLE() function by assigning it to a button on

the form or to the OnCurrent property of the form. If performance is a

problem when you are using the OnCurrent solution, the button approach

allows you to decide when the data should be refreshed.

For a linked OLE field named "OLEField" on your form, set the OnPush

property of the button or the OnCurrent property for the form to the

following:

   =UpdateOLE("OLEField")

If you have multiple OLE-linked fields you can create a macro to call

UpdateOLE() for each OLE field on the form.

For three linked OLE fields on a form named "OLEField1", "OLEField2", and

"OLEField3", create the following macro and save it with the name

"UpdateAllOLEFields"

   Action           Argument

   -------------------------------------------------------

   RunCode          Function Name: =UpdateOLE("OLEField1")

   RunCode          Function Name: =UpdateOLE("OLEField2")

   RunCode          Function Name: =UpdateOLE("OLEField3")

then set the OnPush property of the button or the OnCurrent property

of the form to the following:

   UpdateALLOLEFields

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Hot linking, or automatically updating an OLE object, requires a

significant number of system resources. Large numbers of hot-linked

OLE linked objects can cause out of memory or other system errors.

However, Auto Update is available to unbound OLE objects inserted in a

form or report in Design view. This is because the number of objects

inserted in a form is generally minimal.

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Excel.

2. In cell A1, type "123" (without the quotation marks), and press

   ENTER.

3. Select the cell and choose Copy from the Edit menu.

4. Switch to or start Microsoft Access and create a table that has a

   field with the datatype set to "OLE Object".

5. Create a new, blank form, based on the table created in step 4.

6. From the View menu, choose Field List.

7. Drag the OLE field from the Field List window to the middle of the

   blank form.

8. From the View menu, choose Form.

9. Select the OLE field, and then choose Paste Special from the Edit

   menu.

"Microsoft Excel Worksheet Object" will appear in the Data Type box,

and the Paste and Paste Link buttons will be available, but the Auto

Update check box will be unavailable.

Additional reference words: 1.00 1.10 greyed grayed dimmed checkbox

KBCategory:

KBSubcategory: IntpOthr


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 the RecordSource of a Form at Run Time

Article ID: Q100174

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You cannot change a form's RecordSource property at run time.

RESOLUTION

==========

Although you cannot change the actual RecordSource property of a form,

you can use the Apply Filter macro action to simulate the effect.

The following steps demonstrate the method to simulate changing the

RecordSource:

1. Open the sample database NWIND.MDB. Make a copy of the Employees

   table and save it as Employees2. Delete five records from the

   Employees2 table.

2. Create a macro with the following action and save it as

   Employees2 Macro:

      Employees2 Macro Action

      ------------------------

         ApplyFilter

            Filter Name: Select * from Employees2;

            Where Condition:

3. Open the Employees form in Design view. Add a command button to the

   Employees form and set the OnPush property to Employees2 Macro.

4. Open the form in Form view and go to the last record of the form.

   Note how many records are in the Employees field. Next, choose the

   command button and go to the last record of the form. Note that

   there are now five fewer records in the form.

NOTE: If you apply this method to your own tables and the tables do

not have the same fields, you must set the Visible property of the

invalid controls to No to prevent #Name? errors.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 375-382

Additional reference words: 1.00 1.10 filter query requery change

KBCategory:

KBSubcategory: FmsProp


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 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 Edit Data Using Query with Attached dBASE Table

Article ID: Q97623

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You are unable to edit fields in a Microsoft Access table through a

query that joins an attached dBASE table to the Microsoft Access

table. The query joins the tables on a key field in the Microsoft

Access table.

CAUSE

=====

Since relationships cannot be created with attached tables using the

Edit Relationship dialog box, joins must be performed manually in

the QBE grid. When a join is created between an attached dBASE

table and a Microsoft Access table on the primary key field,

Microsoft Access assumes the type of relationship is one-to-many

with the Microsoft Access table representing the "one" side. You

cannot edit fields that come from the "one" side of a one-to-many

relationship.

RESOLUTION

==========

Establish a main/subform setup with the subform based on the

attached dBASE table and the main form based on the Microsoft

Access table. You will be able to edit data from both tables

through their respective forms.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Even if the data in the dBASE table actually has a one-to-one

relationship with the Microsoft Access table, you will not be able to

edit fields from the Microsoft Access table using a query joining

these tables. If you create a single form based on this query, and set

the form's AllowUpdating property to Any Tables, you will not be able

to edit data in the Microsoft Access table.

Additional reference words: 1.00 1.10 mainform allow updating

KBCategory:

KBSubcategory: QryFixup


PRB: Cannot Import YYMMDD Dates in Fixed-Width Text Files

Article ID: Q93727

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access will not import fixed-width text files if there

is a date field in the text file formatted as YYMMDD.

CAUSE

=====

Microsoft Access does not recognize the YYMMDD date format in text

files, and will generate an error log when trying to import a text

file that includes a date in this format. The error log will show a

"Type Conversion Failure." The file will not import.

RESOLUTION

==========

One workaround is to format the date as MMDDYY.

Another workaround is to import the YYMMDD field as a six-character

text field. Next, create a new field in the table called, for

example, NewDate, with a data type of Date/Time. Then run an

update query to derive the NewDate field from the OldDate field

as follows:

NOTE: In the following sample code, an underscore(_) is used as a

line-continuation character. Remove the underscore when re-creating

this code in Microsoft Access.

   Query: ReformatDate

   -------------------------------------------------------

   Field Name: NewDate

   Update to: Mid([OldDate],3,2) & "/" & Right([OldDate],2) & _

                  "/" & Left([OldDate],2)

If the text field containing the date has embedded slashes, such as

1/5/94, then the starting value in the Mid() function must be 4 rather

than 3. In the example above, you would change the Mid() to look like

Mid([olddate],4,2).

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

When importing a fixed-width text file with a date field formatted as

YYMMDD, Microsoft Access generates an Import Error log table, but

does not import the data. If you try to import the text file as

delimited the data is imported, but Microsoft Access changes the

format from date to number or text, depending upon the date delimiter.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmTxtfx


PRB: Cannot Install Cue Cards Without Installing Help in Version

Article ID: Q92639

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

During a custom Microsoft Access version 1.x installation, you can select

and clear options in the Microsoft Access Setup Options dialog box. If you

clear the Help option, the size of the Cue Card files increases from 1688K

to 5112K. However, the total disk space required does not increase and the

size of Help does not decrease from 3424K to 0K.

CAUSE

=====

In Microsoft Access 1.x, you must have the Help files loaded in order to

use Cue Cards. Therefore, when you clear the Help option, the size of the

Cue Cards files increases to include the size of the Help files.

STATUS

======

This behavior is by design. However, in Microsoft Access version 2.0, you

do not have to install the Help files to use Cue Cards. Therefore, when you

clear the Help option, the size of the Cue Cards files is not affected.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: DcmOthr


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 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 Rollback in Transaction without Closing Database

Article ID: Q93140

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A subroutine or a function contains a transaction process which

calls a subroutine or function that dimensions and opens a database

using the OpenDatabase method. When the subroutine or function

exits, Microsoft Access implicitly closes the database (no Close

method is called). When the subroutine or function attempts to

execute the CommitTrans or Rollback statement, Microsoft Access

displays the following message:

   Commit or Rollback without BeginTrans.

CAUSE

=====

When the called subroutine or function exits, Microsoft Access

implicitly closes the database. Internally, the initial attempt to

close the database fails because the database was opened in a

transaction. Microsoft detects this error and performs an implicit

transaction rollback, then it closes the database successfully.

RESOLUTION

==========

To perform a Rollback in the called subroutine or function, you

must first call the Close statement to close the open database.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create the following module.

      '************************************************************

      'Declarations section of the module.

      '************************************************************

      Option Explicit

      '============================================================

      'The following Sub procedure starts a transaction, calls

      'another sub procedure, then attempts to rollback.

      '============================================================

      Sub Test1

         BeginTrans

            Call Test2

         Rollback

      End Sub

      '============================================================

      'The following Sub procedure sets a Database variable to

      'the current database.

      '============================================================

      Sub Test2

         Dim MyDB as Database

         Set MyDB = CurrentDB()

         'the database is implicitly closed on exit

      End Sub

2. Compile the module.

3. In the Immediate window, enter Test1. Microsoft Access generates

   the following message:

      Commit or Rollback without BeginTrans.

Perform the following four steps to demonstrate the resolution to this

problem.

1. Perform Step 1 above.

2. Edit the second function to add MyDB.Close, as follows.

      '============================================================

      'The following Sub procedure will set a Database variable to

      'the current database, and then close the database.

      '============================================================

      Sub Test2

         Dim MyDB as Database

         Set MyDB = CurrentDB()

         MyDB.Close

      End Sub

3. Compile the module.

4. In the Immediate window enter Test1. The Rollback works correctly

   because the code explicitly closes the database opened in the

   transaction.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmOthr


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: Cannot Write README.TXT Error Msg During Installation

Article ID: Q93590

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

While installing Microsoft Access, you see the following error message

when SETUP.EXE is processing Disk 6 or Disk 7:

   Cannot Write C:\MSACCESS\README.TXT

CAUSE

=====

This is a setup problem that occurs setup when Microsoft Access is

writing the README.TXT file. There are a number of possible causes.

The MS-DOS APPEND command, located in the AUTOEXEC.BAT file, causes this

error if there is a README.TXT file in any of the directories that are

specified on the APPEND line.

When SETUP.EXE tries to install README.TXT, the APPEND command can cause

MS-DOS to tell SETUP.EXE that there is a file with the same name in the

installation directory. When SETUP.EXE is notified by MS-DOS that there

is an existing file with the same name, SETUP tries to overwrite the

existing file. MS-DOS returns an error code stating that the file is

write protected.

Some customers have reported possible problems installing the README.TXT

file when using certain terminate and stay resident programs (TSRs) such

as Quicken's BillMind and Logitech's Click and Logimenu.

RESOLUTION

==========

There are several possible workarounds. They are detailed in the More

Information section below.

STATUS

======

This problem does not occur in Microsoft Access version 1.1

MORE INFORMATION

================

Before trying any of the following workarounds, ensure that you have a

standard Windows configuration. Then exit from Windows and from all

applications. Modify your AUTOEXEC.BAT file to remove any non-standard

TSRs, and then restart your computer.

Workaround One

--------------

1. Use File Manager to search the entire hard drive for all README.TXT

   files.

2. Rename all README.TXT files to another file name (for example,

   READTHIS.TXT).

3. Install Microsoft Access from the original disks.

Workaround Two

--------------

1. Change to the directory of the path given in the error message.

2. Use a text editor such as the MS-DOS Edit program to create an

   empty README.TXT file.

3. Install Microsoft Access from the original disks.

Workaround Three

----------------

1. Make a duplicate copy of Disk 6 or Disk 7.

2. On the new disk, copy the README.TX$ file to a new file

   named README.2

3. On the new disk, rename the README.TX$ file to README.1.

   Then rename README.2 to README.TX$.

4. Install Microsoft Access using the new disk you made.

Workaround Four

---------------

1. Make a duplicate copy of Disk 6 or Disk 7.

2. On the new disk, rename the README.TX$ file to README.1.

3. On the new disk, use a text editor such as the MS-DOS Edit

   to create a new file and save it as README.TX$.

4. Install Microsoft Access using the new disk you made.

Additional reference words: 1.00

KBCategory:

KBSubcategory: StpOthr


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: Column Widths in Table Design Not Saved

Article ID: Q92813

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The Datasheet view column widths of the table are automatically

saved by Microsoft Access. When working on tables in Design

view, however, changes made to the Design view grid's column

widths are not saved when the form is closed.

CAUSE

=====

Microsoft Access does not currently support saving the column

width of the Design view grid for a table.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open a table in Design view.

2. Adjust the column width of "field type" (or one of the

   other columns.

3. Exit the table.

4. Return to the table in Design view and notice that the

   width has returned to its original state.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: UiOthr


PRB: Company Pick List in Suppliers Form Doesn't Filter

Article ID: Q109406

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you choose one of the alphabet filter buttons in the Suppliers form

in the sample database NWIND.MDB, the suppliers in the underlying records

are filtered correctly. However, the list of suppliers in the Select

Company To Find box is not filtered, and still displays all the

suppliers.

CAUSE

=====

The alphabet filter buttons are not meant to filter the entries in the

Select Company To Find combo box when the underlying record set is

filtered.

RESOLUTION

==========

The following steps describe how to modify the Suppliers form so that the

alphabet filter buttons will filter the list in the Select Company To

Find combo box:

1. View the Suppliers form in Design view. Place an unbound text box

   with the following properties anywhere on the form:

      ControlName: Company Pick List Filter

      Visible: No

      Default Value: *

2. Open the Alpha Filter Buttons macro in Design view. Add the following

   macro actions at the end of EACH ApplyFilter action:

      SetValue

         Item: [Company Pick List Filter]

         Expression: "[Aaaa]*"

      Requery

         ControlName: Company Pick List

      SetValue

         Item: [Company Pick List]

         Expression: [Company Name]

   The expression in the first SetValue action in each entry should be

   copied from the Where Condition argument of each ApplyFilter section.

   For example, for the A button the ApplyFilter Where Condition argument

   is "[AAAAA]*" (these characters are actually international versions of

   A, represented by A so they will appear on all computer displays).

   The B button's Where Condition argument is "B*," and so on.

3. After the ShowAllRecords action, add the following actions:

      SetValue

         Item: [Company Pick List Filter]

         Expression: "*"

      Requery

         ControlName: Company Pick List

      SetValue

         Item: [Company Pick List]

         Expression: [Company Name]

4. Open the Supplier List query in Design view and add the following

   criteria to the Criteria row of the Company Name column:

      Like [Forms]![Suppliers]![Company Pick List Filter] & "*"

How the Company Pick List Filter Works

--------------------------------------

After the ApplyFilter action filters the underlying records, the SetValue

action places the criteria in the hidden text box control on the

Suppliers form.

The Requery action forces the Select Company To Find combo box to refresh

its list, forcing the Supplier List query to rerun. The query then runs

using the hidden text box contents as the criteria for filtering the

company names to appear in the list.

The final SetValue action ensures that a valid company name from the

filtered list appears in the combo box.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the Suppliers form in Form view.

2. Choose the B alphabet filter button at the bottom of the form to

   filter for company names that start with the letter B.

3. Click the drop-down arrow on the Select Company To Find combo box.

   Note that all suppliers, not just those with a company name that

   starts with the letter B, are listed.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsOthr


PRB: Compile Error When Attempting to Use an AccessWizard

Article ID: Q96107

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

The following error appears when you try to use an AccessWizard:

   Compile error

CAUSE

=====

This occurs because there is a compile error in the code stored in the

database.

Microsoft Access must compile all code in memory to use any of it. This

includes the code stored in the database and any libraries (.MDA files)

that are loaded. When you attempt to use an AccessWizard, Microsoft

Access must compile the Access Basic code that is in the WIZARD.MDA file

in addition to any code in your database. If there is an error in the

code in your database, Microsoft Access will not be able to run the

AccessWizard because the compilation failed.

RESOLUTION

==========

To resolve this problem, follow these steps:

1. Open your database.

2. Open any module in Design view.

3. Choose Compile All from the Run menu.

Microsoft Access will bring up the module window with the offending

line of code. Upon correcting the error, and assuming there are no

other errors, AccessWizards should now work.

If the Compile error message persists, repeat steps 2 and 3 until all

errors in the code are corrected.

STATUS

======

This problem does not occur in Microsoft Access version 1.1.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmOthr


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: 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: CTRL+' Does Not Trigger Update Events in Datasheet View

Article ID: Q109328

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The CTRL+' key combination does not trigger either the BeforeUpdate or the

AfterUpdate property of a form control when the form is in Datasheet view.

The key combination also does not work in a control on a subform that is in

Datasheet view.

RESOLUTION

==========

Do not use macros or functions for the BeforeUpdate or AfterUpdate property

of controls on forms that will be used in Datasheet view.

If you need to trigger update events for a control on a form that will be

used in Datasheet view, such as a subform, create the form with a tabular

look and set the DefaultView property of the form to Continuous Forms. This

will produce a form that appears to be in Datasheet view, but will allow

the update events to be triggered.

If you need to trigger update events for a control on a form that will be

used in both Form view and Datasheet view, use a key assignment macro like

Autokeys to select the field in the previous record, copy the value found

there, return to the current record, and paste the value.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create the following new macro called Test Macro:

      Test Macro Actions

      ----------------------------------

      MsgBox

         Message: This Field has Changed

3. Open the Customers form in Design view.

4. Set the Customer Name control's AfterUpdate property to Test Macro.

5. View the form in Datasheet view.

6. From the Records menu, choose Go To. Choose New.

7. Select the Customer name field, press CTRL+', and then select another

   field in the same record.

Note that the message box does not appear, meaning that the AfterUpdate

event was not triggered. Repeating steps 6-7 with the form in Form view

will cause the message box to appear.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsEvnt


PRB: CueCards Started Outside MS Access Does Not Work

Article ID: Q92706

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you choose the Microsoft Access Help Icon without having

Microsoft Access started and then try to run any topic from the Cue

Cards menu, you are returned to the Program Group without any error

message.

CAUSE

=====

This is a limitation of WinHelp's ability to call and respond to DLLs.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. From the Microsoft Access Program Group, open the Microsoft Access

   Help Icon

2. Choose Cue Cards.

3. Select any Cue Cards topic.

Result: You are returned to the Microsoft Access Program Group without

any error message.

Additional reference words: 1.00 1.10 Docerr

KBCategory:

KBSubcategory: DcmOthr


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: Date/Time Formats Not Used In List or Combo Box Controls

Article ID: Q94175

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A list or combo box based on a Date/Time field does not display the date

or time format assigned to the underlying field. This is particularly

noticeable in a list or combo box control on a form.

CAUSE

=====

Microsoft Access does not have a Format property for list or combo boxes

even though the underlying table field has a defined Format property.

RESOLUTION

==========

Use the Format() function in an expression in a query to format the data.

Then base the list or combo box on the query field instead of the

underlying table field.

For example, define a query named QueryTest. Then instead of entering

the name of the underlying Time/Date field (Event Date) as the field

on the QBE grid, enter this expression:

   Event Day: Format([event date],"mmmm d"", ""yyyy")

Base the list or combo box on this query field to display Event Date

with the desired format.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

----------------------------

1. Create a new table with the following fields:

      Field Name         Data Type

      ----------------------------

      Event ID           Counter

      Event Date         Date/Time

2. Set the Event Date field's Format property to "mmm d, yyy" (without

   quotation marks).

3. Save the table as Events. View the table in Datasheet view and enter

   "8/11/92" (without quotation marks) in the Event Date field. Add a

   few more records with any valid dates. Note that the dates are

   displayed correctly.

4. Create a new form based on the Events table. Add the following list

   box to the form:

      Object: List Box

      ----------------------------

      Control Name:    Event ID

      Control Source:  Event ID

      Row Source Type: Table/Query

      Row Source:      Events

      Column Count:    2

      Column Heads:    Yes

      Column Widths:   0;1

      Bound Column:    1

5. View the form in Form view. Note that the underlying field's Format

   property is ignored.

Additional reference words: 1.00 1.10 controls expressions

KBCategory:

KBSubcategory: FmsCmbo


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: DDE App Name for Access Is Incorrect in Manual

Article ID: Q95912

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You will not be able to initiate a dynamic data exchange (DDE) link with

Microsoft Access if the application name is incorrectly specified as

"ACCESS". Instead, an error message will be generated. For example, in

Microsoft Word for Windows, the error message generated is:

   The remote nwind (System) is not accessible. Do you want to start

   the application Access?

CAUSE

=====

On page 141 of Microsoft Access "Introduction to Programming," the app name

for Microsoft Access is incorrectly listed as Access. It should be listed

as MSACCESS.

RESOLUTION

==========

The correct app name to use when referring to Microsoft Access in a

DDE conversation is MSACCESS.

REFERENCES

==========

Microsoft Access "Introduction to Programming," versions 1.0 and 1.1,

page 141

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IntpDde


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: Default Values Used Only with a Bound Control

Article ID: Q109325

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If a form's underlying dynaset contains a field that has a default value,

the default value will not be used if there is no control bound to the

field.

RESOLUTION

==========

A control on the form must be bound to the field in order for the default

value to be used when a new record is added.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0. In

Microsoft Access 2.0, properties from tables are inherited, while in

version 1.1 table properties are not inherited.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new form based on the Order Details table. Include all the

   fields except Quantity (which has a default value of 1) on the form.

3. View the form in Form view. Add the following new records:

      Order ID   Product ID   Unit Price   Discount

      ---------------------------------------------

       12000     19           1.00         25%

4. From the File menu, choose Save Record.

5. Open the Order Details table in Datasheet view. Note that the Quantity

   column is blank for the records you added, even though this field has

   a default value of 1.

REFERENCES

==========

Microsoft Access "User's Guide," Version 1.0, pages 216-217

Microsoft Access "User's Guide," Version 1.1, pages 220-222

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: TblFldp


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: 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: Do Not Have Permissions to Modify Secured Report

Article ID: Q101089

------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

------------------------------------------------------------

SYMPTOMS

========

When you are trying to print a secured report, you receive the error

message "You don't have permissions to modify <report name>."

CAUSE

=====

This problem will occur if a person other than the application's

creator attempts to preview the secured report using a different

default printer than the default printer that was in use when the

application was created.

RESOLUTION

==========

Create the following macro and add it to OnClose property of the

report:

   Macro Name      Action    Argument

   ----------------------------------

   Secured Report  SendKeys  {ESC}

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

NOTE: To reproduce this error you need to have a database with

security already implemented.

 1. Log into Microsoft Access as any user other than Admin.

 2. Create a new database.

 3. Import the Employees table from the sample database NWIND.MDB.

 4. Use the ReportWizard to create a new report based on this table.

    Save the report as Report1.

 5. Create an AUTOEXEC macro with the following actions/arguments:

       Action      Argument   View

       ------------------------------------

       OpenReport  Report1    Print Preview

 6. Assign execute permissions to the report for all groups and

    users.

 7. Quit Microsoft Access.

 8. In the Microsoft Windows Control Panel, select a different printer

    for your default printer than what is currently selected.

 9. Start Microsoft Access, and then log in as a different user than the

    one who created the report.

10. Open the database created in step 2. The report will open in

    preview mode.

11. Close the report. The error will occur.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: RptOthr


PRB: Domain Param. of Domain Function Cannot Be SQL Exp.

Article ID: Q101088

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If you try to use an SQL SELECT statement as the domain parameter of a

domain function, error 3078 is displayed:

   Couldn't find input table or query <SQL string>

where <SQL string> is the SQL string you have entered, such as the

following:

   Couldn't find input table or query "Select * From Table1 Where ID =

   1"

RESOLUTION

==========

Microsoft Access "Language Reference," versions 1.0 and 1.1, and Microsoft

Access Help version 1.0 incorrectly suggest that the domain parameter of a

domain function (for example, the DLookup(), DFirst(), DLast(), DSum(),

DMax(), DMin(), and DCount() functions) can be an SQL expression.

The following is the incorrect description of the domain

parameter:

   String expression identifying the records that constitute the

   domain. It can be a table name, a query name, or an SQL

   expression that returns data.

The correct wording is provided in Microsoft Access Help version 1.1. The

following is the correct description of the domain parameter:

   String expression identifying the records that constitute the

   domain. It can be a table name or a query name.

Additional reference words: 1.00 1.10 domain parameter

KBCategory:

KBSubcategory: PgmOthr


PRB: Driver Cannot Be Found When Attaching to SQL Server

Article ID: Q95054

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When trying to attach a SQL Server table, or open a previously

attached table, you receive the following error message:

   Driver specified by data source could not be loaded.

CAUSE

=====

The most likely cause of this error message is a missing, damaged, or

incorrect version of the SQLSRVR.DLL 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

==========

To correct this problem, verify the following:

 - There is a single copy of the SQLSRVR.DLL file in your Windows

   SYSTEM subdirectory.

 - You have the correct version of the SQLSRVR.DLL file. The version

   installed by Microsoft Access version 1.0 is dated 10-16-92 and has

   a size of 135792 bytes. You need either this file or a more recent

   version.

Additional reference words: 1.00 1.10 tshoot errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: Edit Find Dialog Box Is Modal in Form View

Article ID: Q95651

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are in the Edit Find dialog box in Microsoft Access, you

cannot switch focus back to the form. The Edit Find dialog must be

cleared before you can continue working with the form.

CAUSE

=====

The Edit Find dialog box is modal. When you open a modal form, you

cannot access any other Microsoft Access objects until you close or

hide the form.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start Microsoft Access and open a database.

2. Open a form with an editable field (for example, a text box) in

   Form view.

3. From the Edit menu, choose Find.

At this point you will be unable to shift focus back to the form. You

must choose the Close button in the Edit Find dialog box.

Additional reference words: 1.00 1.10 2.00

KBCategory:

KBSubcategory: UiOthr


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 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 Attaching Btrieve Table

Article ID: Q94420

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When you try to attach a Btrieve table in Microsoft Access, you

receive the following error message:

   <tablename> is corrupted or isn't a Microsoft Access database.

CAUSE

=====

When Microsoft Access attaches a Btrieve table, it compares

information in the Xtrieve dictionary file (FILE.DDF) with information

in the TBLNAME.DAT file. The most common reasons for the above error

message are differences in index information.

RESOLUTION

==========

Redefine the Btrieve index so that it is exactly the same length as

the field it indexes.

STATUS

======

This problem does not occur in Microsoft Access version 1.1.

MORE INFORMATION

================

In the Btrieve file format, the length of the index may not match the

length of the field. This is a valid condition. The Xtrieve dictionary

file (FILE.DDF) ignores these indexes, but Microsoft Access interprets

them as invalid and returns the above error message.

You can correct this problem by turning the invalid indexes into valid

indexes. Use one of the following options to ensure that the length of

the index and the length of the field are identical:

 - Ask the vendor who created the Btrieve files to change the length

   of the index.

 - Use Btrieve or Xtrieve to redefine the index.

 - Use any third-party utility available to modify the Btrieve

   index.

The following four examples all require changes to the Btrieve index:

Example 1

---------

The TBLNAME.DAT file is defined with the following three columns:

    Column name   Field Length    Index Length

    ------------------------------------------

    Firstname     10              <= Combined length of

    Lastname      10              <= 20 characters

    Company       25

Index1 is defined with a length of 20 characters, the combined length of

the Firstname and Lastname fields.

Resolution: Redefine the Btrieve index into one multiple-segment

index, giving each segment a defined length of 10 characters.

Example 2

---------

The TBLNAME.DAT file is defined with the following three columns:

    Column name   Field Length    Index Length

    ------------------------------------------

    Firstname     10              4 characters

    Lastname      10

    Company       25

Index2 is defined with a length of four characters, shorter than the

defined length of the Firstname field.

Resolution: Redefine the Btrieve index on Firstname. Give it a

10-character length, matching the size of the Firstname field.

Example 3

---------

The TBLNAME.DAT file is defined with the following three columns:

    Column name   Field Length    Index Length

    ------------------------------------------

    Firstname     10              12 characters

    Lastname      10

    Company       25

Index3 is defined with a length of 12 characters, slightly longer than

the defined length of the Firstname field.

Resolution: Redefine the Btrieve index on Firstname. Give it a

10-character length, matching the size of the Firstname field.

Example 4

---------

The TBLNAME.DAT file is defined with the following two columns:

    Column name   Length

    --------------------

    Firstname -   10

    Lastname  -   10

    Company   -   25

Index4 is defined on a numeric byte range index. There is no index defined

on any field in the table.

Resolution: Remove the numeric byte range index completely, then

redefine the index on an existing field. Be sure that the length of

the index matches the length of the indexed field.

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

KBCategory:

KBSubcategory: IsmBtrv


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 Message: Must Run SETUP /A Before Running SETUP /N

Article ID: Q95915

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to set up a workstation for Microsoft Access using

the SETUP /N command, you receive the following error message:

   You must run SETUP /A before running SETUP /N

CAUSE

=====

When the network server was set up, the command SETUP /A was issued

from a temporary installation directory on the hard disk, rather than

from the installation floppy disks.

RESOLUTION

==========

Run SETUP /A from the installation disks in the floppy disk drive to

set up the network server. Then you can run SETUP /N from the

workstations.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

Additional reference words: 1.00 1.10 errmsg setup

KBCategory:

KBSubcategory: StpNet


PRB: Error Using Automatic ODBC Setup with Auto Switch

Article ID: Q109333

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Page 663 of the Microsoft Access "User's Guide," version 1.0, and page

673 of the Microsoft Access "User's Guide," version 1.1, contains

instructions for creating an ODBC installation disk or directory, and for

setting up ODBC automatically.

If you follow these instructions, you will receive the error message:

   Setup is unable to install ODBC. C:\~MSODBC.T\ODBCINST.INI is

   either empty or missing.

CAUSE

=====

There is a step missing in the instructions. The [FILES] section of the

SETUP.LST file is missing two lines.

RESOLUTION

==========

To correct this problem, open the SETUP.LST file in any text editor, such

as Windows Notepad. The SETUP.LST file is located on your ODBC disk, or in

the directory where the ODBC files were copied. Add the following two lines

to the [FILES] section:

   ODBC.INI = ODBC.INI

   ODBCINST.INI = ODBCINST.INI

Run the Setup program again.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, page 663

Microsoft Access "User's Guide," version 1.1, page 673

Additional reference words: 1.00 1.10 docerr

KBCategory:

KBSubcategory: StpOdbc


PRB: Error When Installing Access on DEC Pathworks Network

Article ID: Q96466

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

During a network server installation of Microsoft Access on a DEC

Pathworks 4.x network, the following error message may be displayed:

   You must run setup/a before setup/n

CAUSE

=====

You probably attempted to install Microsoft Access to a Disk Services

drive.

Microsoft Windows considers DEC Pathworks 4.x Disk Services to be a

local disk drive. Windows considers DEC Pathworks 4.x File Services to

be a network drive.

RESOLUTION

==========

To perform a network server installation of Microsoft Access on a DEC

Pathworks 4.x network, you must install to a File Services drive. You

cannot successfully complete a network installation to a Disk Services

drive.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: StpNet


PRB: Error When Opening Attached Table in Shared .MDB File 1.x

Article ID: Q99936

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you attempt to open an attached table in a shared .MDB file, one

of the following error messages appears:

 - Couldn't find file "<drive>:\<path>\<filename>"

 - "<Drive>:\<path>\<filename>" isn't a valid path

 - Couldn't open file "<drive>:\<path>\<filename>"

CAUSE

=====

The path to an attached table is hard-coded in the table's properties.

For a shared .MDB file, this path is very likely invalid.

RESOLUTION

==========

To work around this problem, either change the path to the attached

file so that it is valid, or import the data instead of attaching the

table.

To verify and correct the path for an attached table, use the

following procedure:

1. Open the table in Design view.

2. From the View menu, choose Table Properties. The Description

   property contains the path to the attached table.

3. Place the .MDB file and its attached tables on a share on a

   dedicated server.

4. Use one of the following two naming conventions:

    - Choose a drive letter (for example, "u:") and make sure all

      users connect to the share using that drive letter. Use the

      same drive letter for the attached tables.

      -or-

    - Use the universal naming convention (UNC) for the attached

      tables (for example, \\<server>\<share>\<filename>).

      NOTE: To attach a database using UNC, specify the UNC name and the

      database name where you normally would specify the drive and database

      names. For example, instead of logging on to the network drive,

      typing the database name, and choosing Attach Table from the File

      menu, you need only enter the UNC name and the database name in the

      Attach dialog box, as follows:

         \\MYSERVER\PUBLIC\MYDB.MDB

MORE INFORMATION

================

If the .MDB file is placed on a non-dedicated server that does not allow

redirecting to itself (for example, Microsoft Windows for Workgroups), you

must maintain two separate .MDB files, one to share with other workstations

and one for your local computer.

Maintaining two separate copies of the .MDB file is necessary because

Windows for Workgroups does not allow a server to redirect to itself. For

example, if the server name is SERVERNM, the SERVERNM computer cannot use

the path \\SERVERNM\SHARE to access a file from its own hard disk.

If the .MDB file is placed on a non-dedicated server that does allow

redirecting to itself (for example, Microsoft Windows NT), you only need to

maintain one .MDB file.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 69-72

Additional reference words: 1.00 1.10 attach multiuser

KBCategory:

KBSubcategory: IntpOthr


PRB: Error While Importing FoxPro Table Structure

Article ID: Q109357

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are importing an empty FoxPro version 2.0 table into Microsoft

Access, you receive the following error message:

   Table '<tablename#DBF>' is exclusively locked

CAUSE

=====

The FoxPro indexed sequential access method (ISAM) opens empty tables in

exclusive mode, and opens non-empty tables as read-only. Microsoft Access

opens the table, placing it in exclusive mode, and then attempts the

import. The import cannot be carried out, however, because the table has

already been opened exclusively.

STATUS

======

This problem was corrected in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: IsmXbase


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: Exclusively Locked Error When Attaching to Btrieve Table

Article ID: Q94419

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

When attaching a Btrieve table, you get one of the following error messages

when you choose FILE.DDF:

   Table <tablename> is exclusively locked.

or

   Couldn't open file <filename>.

CAUSE

=====

When attaching to a table, Microsoft Access needs to open the target

Btrieve table exclusively for a moment. If any other user has the target

table open at the same time Microsoft Access is attempting to attach to it,

you will see one of these error messages.

RESOLUTION

==========

Find an available time when no other user is using the target Btrieve

table. Once Microsoft Access attaches to the Btrieve table successfully,

you will no longer receive the error messages.

STATUS

======

This problem does not occur in Microsoft Access version 1.1.

Additional reference words: 1.00

KBCategory:

KBSubcategory: IsmBtrv


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: Find Company Macro Does Not Work Correctly in NWIND.MDB

Article ID: Q109324

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The appropriate record for the company you selected in the Select Company

To Find box on the Suppliers form in the sample database NWIND.MDB will not

be displayed if you have chosen any of the alphabet buttons on the form.

For example, if you have chosen the "L" alphabet button, and then select a

company that has a name that starts with the letter "E" in the Select

Company To Find box, the record will not be displayed. Only companies whose

names start with the letter "L" can be displayed.

CAUSE

=====

The alphabet buttons on the Suppliers form apply filters to the records. If

a filter is applied, only records that match the filter's criteria will be

displayed.

RESOLUTION

==========

Choose the All button, so that no filters are applied, before using the

Select Company To Find box.

 -or-

Add the ShowAllRecords macro action as the first line of the Find Company

macro, which is the macro run by the Select Company To Find combo box. The

ShowAllRecords macro action removes all filters. To add the ShowAllRecords

action to the Find Company macro, follow these steps:

1. Open the sample database NWIND.MDB.

2. Open the Find Company macro in Design view.

3. Select the top cell in the Action column, and select ShowAllRecords in

   the action list.

4. Save the macro.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Open the Suppliers form in Form view.

3. Select any company name in the Select Company To Find box.

4. Choose the "L" alphabet button.

5. Select a company in the Select Company To Find box whose name does

   not begin with the letter "L". Note that the record for the company is

   not displayed.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsCmbo


PRB: Floating Objects Can Cause Unusual Effects

Article ID: Q89548

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

Floating objects such as the toolbox, the Properties window, and the

Immediate window can cause unusual effects in Microsoft Access. Objects can

obscure underlying data from view, an underlying object can be obscured

from view even if it has the focus, or is selected, and the drop-down menu

for the object's corresponding option on the menu bar can appear separated

from the object.

CAUSE

=====

These effects are caused by the different Windows style properties

of the windows.

RESOLUTION

==========

To minimize the impact of this behavior, keep the floating objects

from overlaying your work area by moving or closing them when

not needed.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

Menu Not Connected to the Option on the Menu Bar:

1. Open a form in Design view.

2. Display the color palette by choosing the palette button or by

   choosing Palette from the View menu.

3. Position the palette so it partially obscures a choice on the menu

   bar.

4. Choose the menu by clicking on it or by using the appropriate

   keystroke combination.

5. The drop-down menu related to that menu bar choice should then be

   displayed. At this time, the top level menu item will not overlap the

   palette, but the popup menu will overlap, giving a disjoint look.

Immediate Window Obscures Code During Replace Operation:

1. Open a module in Design view.

2. Display the Immediate window by choosing Immediate Window from the

   View menu.

3. Position the Immediate window so it obscures a section of code in

   the Module window.

4. Start a replace operation that would attempt to replace a piece of

   code in the section of code which is obscured by the Immediate window.

   To do this choose Replace from the Edit menu, enter the information to

   find and replace, and choose Verify.

5. When Microsoft Access finds the information obscured by the

   Immediate window, the dialog box that asks you to verify that you

   want to change the information is displayed, but you cannot see the

   code.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, page 195

Microsoft Access "Introduction to Programming," version 1.0, pages

2-3 and 9-10

Additional reference words: 1.00 1.10 2.00 checkpage

KBCategory:

KBSubcategory: UiOthr


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 Handle Not Released When Closed with Basic Code

Article ID: Q95644

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

After closing a form (using the Close macro action) that was opened

through Access Basic code, the file handle for the table that the

form is based on is not released. Because the file handle is not

released, no functions that require exclusive use on that table can

be executed (for example, deleting the table). When a function that

needs exclusive use of that table is executed, the following error

will occur:

   Couldn't lock table '<tablename>'; currently in use.

CAUSE

=====

You are not guaranteed that the user interface (UI) will be synchronized

with the underlying Microsoft Access code in all cases. In this case, the

record locking is done behind the scenes. Microsoft Access releases the

table when it hits its idle loop (that is, the UI optimization).

RESOLUTION

==========

After the form is opened in Access Basic code, insert a DoEvents

command before the function that needs exclusive use of the table,

to cause Microsoft Access to yield execution to the operating

system, so that it can process events. When the DoEvents command

occurs it allows Microsoft Access to process the pending unlock sequence.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

The following steps provide example code that reproduces this error. There

is a comment in the Access Basic code identifying where to insert a

DoEvents command to resolve this error.

Steps to Reproduce Problem

--------------------------

1. Open the sample database NWIND.MDB. Create a module and enter the

   following code:

      '*************************************************************

      'Declarations section of the module.

      '*************************************************************

      Option Explicit

      '================================================================

      ' Create and save the following TempCust() function in the Module

      '================================================================

      Function TempCust()

         DoCmd SelectObject a_table, "Customers", True

         DoCmd CopyObject , "Cust2"

         DoCmd OpenForm "Customers 2", a_normal, "", "", a_edit, a_dialog

         '**** This is where the DoEvents should be inserted to fix ****

         DoCmd SelectObject a_table, "Cust2", True

         DoCmd DoMenuItem 1, 1, 4

      End Function

2. Open the Customers form in Design view, and change the RecordSource

   property to Cust2.

3. Create a command button on this form with the following  properties:

      Object: Command Button

      -----------------------

      ControlName: Close Form

         Caption: Close Form

         OnPush: ExitForm

4. Save the modified Customers form as Customers 2.

5. Create and save the following macro:

      Macro Name   Action

      -------------------

      ExitForm     Close

6. Create and save the following macro:

      Macro Name     Action     Argument

      ------------------------------------

      OpenCustForm   RunCode    TempCust()

7. From the Database window, run the OpenCustForm macro that you just

   created. The Customers 2 form will open.

8. Click the Close Form macro button on this form. You will receive a

   dialog box that asks:

      Delete Table 'Cust2'?

9. Choose OK. You will receive the following error message:

      Couldn't lock table 'Cust2'; currently in use.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmErr


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: Full Path Causes Endless Loop in StartApp() Example

Article ID: Q94110

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SUMMARY

=======

Passing the full path of a DDE server to the StartApp() function will

cause an endless loop. The function will continue to run, starting up

new copies of the specified DDE server, until the user stops the code

or the workstation runs out of memory and the code fails.

The function works correctly if the name of the DDE server without

the path is used.

MORE INFORMATION

================

The sample database NWIND.MDB contains a module called Introduction to

Programming. Much of the Access Basic code used as examples in the

"Microsoft Access Basic: An Introduction to Programming" manual, version

1.0 is included in this module. The sample function StartApp() from

page 142 contains a routine that can be used to initiate a DDE channel.

If the DDEInitiate() in the StartApp() function fails, the error

handling routine StartApp: attempts to start the server. The error

routine then passes control back to the main body of code, where the

DDEInitiate is tried again.

If the full path to the DDE server is used when the StartApp()

function is called, the DDEInitiate() function will fail, but the

Shell() function in the error routine will be successful.

The following is an example of using StartApp() that will cause an

endless loop:

   =StartApp("c:\winword\winword.exe","system")

The following is an example that will work correctly:

   =StartApp("winword","system")

Additional reference words: 1.00 1.10 excel channel

KBCategory:

KBSubcategory: PgmOthr


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: Incorrect Btrieve Error Message, [Btrieve ISAM] section

Article ID: Q99402

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The following incorrect error message may be returned when you attempt

to attach or import a Btrieve file:

   Invalid entries in [Btrieve ISAM] section in WIN.INI

CAUSE

=====

This error message is generated when Microsoft Access tries to attach

or import a Btrieve file and the settings in the [Btrieve]--not the

[Btrieve ISAM]--section of the WIN.INI file are incorrect.

RESOLUTION

==========

Search for the [Btrieve] section in the WIN.INI file instead of the

[Btrieve ISAM] section.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

For more information on [Btrieve] settings in the WIN.INI file for

Microsoft Access version 1.1, see the heading "Setting Btrieve Options in

WIN.INI" in the BTRIEVE.TXT file.

For more information on [Btrieve] settings in the WIN.INI file for

Microsoft Access version 2.0, choose "Setting Microsoft Access Options for

Btrieve" then look for the heading "Setting Btrieve Options" in the

ACREADME.HLP file.

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 errmsg

KBCategory:

KBSubcategory: IsmBtrv


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: Incorrect Time Calculations in Years Prior to 1900

Article ID: Q109339

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Using the DateAdd() function to perform a time calculation on a Date/Time

field that contains a date prior to the year 1900 returns an incorrect

value. For example, the expression

   DateAdd("n",30,#January 1, 1776 9:00:00 AM#)

should add 30 minutes to the value, but instead returns:

   January 1, 1776 8:30AM

CAUSE

=====

Microsoft Access stores dates as serialized numbers that represent the

number of days from a reference date. The time component is represented by

the digits to the right of the decimal point. Since Microsoft Access uses

December 31, 1899 as the reference date, all dates prior to that date are

stored as negative numbers. Microsoft Access correctly interprets larger

negative whole numbers as earlier dates, but incorrectly interprets larger

negative fractions as an earlier time.

RESOLUTION

==========

Use an immediate if (IIf) function, or an If-Then-Else construction, in

Access Basic to reverse the sign of the calculation. The following example

demonstrates how to use the IIf() function to reverse the calculation's

sign for a Date/Time field called MyDate.

NOTE: In the following example, an underscore (_) is used as a line-

continuation character. Remove the underscore when re-creating example.

   IIf([MyDate]<#12/31/1899#, DateAdd("n",-30,[MyDate]),_

   DateAdd("n",30,[MyDate]))

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.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 102-103

Additional reference words: 1.00 1.10 query ab

KBCategory:

KBSubcategory: ExrOthr


PRB: Index Does Not Work in AB Function with NWIND.MDB

Article ID: Q109318

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you run an Access Basic function that has PrimaryKey defined as an

index, and that uses the Index method on a table in the sample database

NWIND.MDB, you receive the error message:

   'PrimaryKey' isn't an index in this table.

CAUSE

=====

The PrimaryKey index is incorrectly named Primary Key internally (note the

space between "Primary" and "Key") in three tables in NWIND.MDB. These

tables are the Products, Shippers, and Suppliers tables.

RESOLUTION

==========

When you are running an Access Basic function that uses the Index method

on these three tables, refer to the index as "Primary Key" instead of

"PrimaryKey."

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

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.

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new module and enter the following sample function:

      '*********************************************

      'Declarations section of the module.

      '*********************************************

      Option Explicit

      Function NWINDSEEK (Prod_ID As Integer)

         Dim db As Database, TBL As Table

         Set db = CurrentDB()

         Set TBL = db.OpenTable("Products")

         TBL.Index = "PrimaryKey"

         TBL.Seek "=", Prod_ID

         If TBL.NoMatch Then

            MsgBox "Not a valid ID. Try another"

         Else

            MsgBox "This Product ID is in the table!"

         End If

         TBL.Close

         db.Close

      End Function

3. From the View menu, choose Immediate Window.

4. Type the following in the Immediate window:

      ?NWINDSEEK(1)

   The above error message displays.

5. Change the TBL.Index statement in the module to the following:

      TBL.Index = "Primary Key"

6. Repeat step 4.

The appropriate message box is displayed.

Additional reference words: 1.00 1.10 seek

KBCategory:

KBSubcategory:  TblPriky


PRB: Insert Object Dialog Box Has No "All Files" (*.*) Option

Article ID: Q103253

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you choose Insert Object from the Edit menu, All Files (*.*) is

not an option in the List Files Of Type box in the Insert Object From

File dialog box.

CAUSE

=====

This behavior is by design. The List Files Of Type box displays only

file types that represent OLE server applications stored in your

computer's registration database file, REG.DAT. The All Files (*.*)

option is omitted to prevent you from unintentionally trying to link

or embed an object using a non-OLE or unregistered application.

RESOLUTION

==========

You can type "*.*" (without the quotation marks) in the File Name text

box if you want to display all file types. However, if your purpose in

selecting All Files is to link or embed an object from a non-OLE or

unregistered application, you must use the Microsoft Windows Object

Packager to create and paste an object into Microsoft Access.

For information on using Object Packager, see the Microsoft Windows

"User's Guide," Chapter 13.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. In the sample database NWIND.MDB, open the Categories table in

   Datasheet view.

2. Move to a new record and select the Picture field.

3. From the Edit menu, choose Insert Object.

4. Choose the File button in the Insert Object dialog box.

5. Open the List Files Of Type box. Note that All Files (*.*) is not

   an option.

Additional reference words: 1.00 1.10 WinIss

KBCategory:

KBSubcategory: IntpOle


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: 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

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

The contents of a disabled list box are not dimmed (grayed) as they

are in other disabled controls.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create a new form.

3. Place a list box control on the form and set its RowSource property

   to Customers.

4. Set the Enabled property to No.

5. Choose the Form View button.

Note that the list box's label is dimmed, but the contents of the list

box are not dimmed, as you would expect from a disabled control.

The problem, however, is only visual; the list box control is truly

disabled and you cannot alter its contents.

Additional reference words: 1.00 1.10 2.00 scroll grey out unavailable

KBCategory:

KBSubcategory: UiOthr


PRB: ListTables Method Returns Odd Names

Article ID: Q106188

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you use the ListTables method to list table or QueryDef names, you may

see odd names that are not objects in the Database window. For example, the

ListTables method may return a name similar to

   Customer Mailing Labels0000

which is neither a table nor a QueryDef in your database. There may be an

object with a similar name in the Database window, but no actual table or

QueryDef with the same name.

CAUSE

=====

The odd name is the name of a hidden query that was created by running a

report. Although the QueryDef cannot be seen in the Database window, it

does exist and will be found by the ListTables method.

RESOLUTION

==========

Hidden QueryDefs are retained in the database until the report is deleted

and you compact the database.

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.

Steps to Reproduce Behavior

---------------------------

1. Create a new report and save it as Test1.

2. Run the Test1 report at least once.

3. Open a module and enter the following function:

'=============================================================

      ' The following function ListMyTables() can be run from the

      ' Immediate window by typing "?ListMyTables()" (without the

      ' quotation marks). It returns the Table/QueryDef name

      ' and TableType.

'=============================================================

         Function ListMyTables ()

            Dim MyDB As Database, MySnap As Snapshot

            Set MyDB = CurrentDB()

            Set MySnap = MyDB.ListTables()

            MySnap.MoveFirst

               Do Until MySnap.EOF

               Debug.Print MySnap.name & " " & MySnap.TableType

               MySnap.MoveNext

            Loop

         End Function

4. Run the function in the Immediate window by typing:

      ? ListMyTables()

Note that "test100005" is returned in the Immediate window. This is the

name of the hidden QueryDef created by the Test1 report.

If you delete the report, compact the database, and then run the function

again, "test100005" will not be returned.

REFERENCES

==========

Microsoft Access "Language Reference," version 1.0, pages 292-294

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: PgmOthr


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: Low Number of Share Locks Can Cause Error Message

Article ID: Q96904

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You receive the error message "Can't save; record is locked by another

user" in Microsoft Access, even when only one user (in one session on one

computer) is using a database opened for shared access.

CAUSE

=====

This error can be caused by an insufficient number of share locks.

RESOLUTION

==========

Be sure that the number of share locks is set to 500 or more. The

number of share locks is set by the /L:xxxx parameter when SHARE.EXE

is invoked, usually in the AUTOEXEC.BAT file, as follows:

   C:\DOS\SHARE.EXE /L:500

The Microsoft Access Setup program modifies your AUTOEXEC.BAT file

and sets the number of share locks to 500, but some other program

may alter that value.

Although 500 share locks are sufficient for most Microsoft Access

applications, some applications may have problems related to the

number of share locks. You may need to gradually increase the number

of share locks until these problems disappear. Try to add as few share

locks as possible, since each share lock uses memory.

Note that if you are running Microsoft Access under Windows for

Workgroups in 386 Enhanced mode, then you do not need to load SHARE.EXE

in your AUTOEXEC.BAT file. VSHARE.386, which is loaded automatically by

Windows for Workgroups in 386 Enhanced mode, will take care of this

problem.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

For more information on VSHARE.386, query on the following words here in

the Microsoft Knowledge Base:

   VSHARE.386 and enhanced

Additional reference words: 1.00 1.10 share-lock errmsg shared locks

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 Condition Example Using COUNT() Is Incorrect

Article ID: Q96588

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Page 519 of the Microsoft Access "User's Guide," version 1.0, or page 523

of the Microsoft Access "User's Guide," version 1.1, shows examples of

valid conditions to be used in the Condition column in the Macro window.

The last example shows the following:

   COUNT(Order_ID) > 35

This condition will result in the error message "Can't parse expression."

If you correct the parsing error by adding square brackets and replacing

the underscore with a space, as in the following example,

   COUNT([Order ID]) > 35

you will receive the error message:

   Function isn't available in expressions.

RESOLUTION

==========

To see if the total number of entries in the Order ID field is greater

than 35, use the DCOUNT() function in a macro expression, as in the

following example:

   DCOUNT("[Order ID]","Orders") > 35

If there are more than 35 entries in the Order ID field of the Orders

table, the expression above will return TRUE.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

For more information on the DCount() function , search for "DCount" then

"DCount Function" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10 docerr errmsg logical false message

KBCategory:

KBSubcategory: DcmOthr


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: Memory or Disk Space Problems Using MS-DOS 6.0

Article ID: Q103991

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0, 1.1, and 2.0

---------------------------------------------------------------------

SYMPTOMS

========

When you are working in Microsoft Access, you receive an error message

stating that you are out of memory. The message may be accompanied by other

messages stating that you have insufficient space in your TEMP directory,

or that you have insufficient disk space.

CAUSE

=====

If you are running MS-DOS 6.0, these error messages may be due to the way

the memory on your computer is configured, or to the use of file

compression on your hard disk.

RESOLUTION

==========

Check each of the items described below and make any necessary changes.

MORE INFORMATION

================

DoubleSpace

-----------

MS-DOS 6.0 includes its own disk compression program called DoubleSpace.

This program makes your hard disk seem larger than it actually is by

compressing the files on the disk. The DoubleSpace program has an option to

let you specify the compression ratio that will be used. You can increase

the default compression ratio that DoubleSpace sets up, but increasing this

ratio usually does not result in additional usable space on your hard disk.

The average file compression ratio is about 1.5 to 1. With this ratio, a 20

MB disk could actually yield about 30 MB of usable space. If you set the

DoubleSpace compression ratio to 16 to 1, the disk will show about 320 MB

of usable space, but will still only actually provide about 30 MB of space.

If you have set up a high compression ratio, the hard disk may show far

more free space than can actually be used. If you attempt to install

Microsoft Access to such a disk, you can run out of disk space during the

installation process.

If you are using DoubleSpace, you can check your compression ratio by

typing "dblspace" (without the quotation marks) at the MS-DOS prompt. From

the Drive menu, choose Info. If the compression ratio is set larger than

the estimated compression ratio, choose Ratio and set the new estimated

compression ratio to match the estimated compression ratio. This will give

you the most accurate information about the amount of actual usable free

disk space.

MemMaker

--------

MS-DOS 6.0 includes a memory-management utility called MemMaker that helps

optimize the configuration of your computer's memory. This utility may

alter two commands that can affect Microsoft Access.

The first item is the FILES=<xx> line in your CONFIG.SYS file. Microsoft

Access requires that <xx> be 50 or greater, but the MemMaker utility

sometimes sets this line to less than 50. Check your CONFIG.SYS file with

any text editor and make sure that the line reads FILES=50.

The second item is the DEVICE=EMM386.EXE line in your CONFIG.SYS file. The

MemMaker utility sometimes adds the HIGHSCAN parameter to this line, but

this parameter can cause conflicts on some computers. You may want to

remove this parameter and any i=<xxxx>-<xxxx> parameters, and make sure

that the NOEMS switch is present. For example, the line might read

DEVICE=EMM386.EXE NOEMS.

Undelete

--------

If you are running the Delete Sentry option of the Microsoft Undelete

program, your hard disk may show an incorrect amount of disk space. This is

because Delete Sentry makes a hidden copy of all deleted files. These

hidden files are stored for seven days, and are not counted when you use

the DIR command to show available disk space.

If you run out of disk space when you are installing Microsoft Access, use

the DIR /A command to show all files. This command will show you any hidden

files, including hidden files stored by the Delete Sentry. You can delete

the hidden files to free up disk space, but these files will no longer be

guaranteed to be recoverable. \* \* If you run into unusual problems, one

means of troubleshooting may \* be to switch the SET TEMP= statement to

point to the uncompressed \* drive.

REFERENCES

==========

Microsoft MS-DOS 6.0 "User's Guide"

Additional reference words: 1.00 1.10 2.00 WinIss errmsg

KBCategory:

KBSubcategory: EvnOs


PRB: Microsoft Access Can't Recognize SQL Server Double Index

Article ID: Q93925

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

---------------------------------------------------------------------

SYMPTOMS

========

Microsoft Access does not recognize a SQL Server table index if the

index has a DOUBLE data type.

STATUS

======

This problem does not occur in Microsoft Access version 1.1.

MORE INFORMATION

================

Microsoft Access requires a unique index on any SQL Server table for

updates (editing), and it cannot use the data type DOUBLE as a unique

index. After reading the DOUBLE index value on the server, Microsoft Access

converts the value from binary to decimal and back to binary, causing

rounding errors, before storing it in a Microsoft Access virtual table

(VT). The same conversion process occurs when Microsoft Access sends the

value back to the server for an update. Microsoft Access uses the index

value to find the row in the table where the update is needed. Because of

the rounding errors, Microsoft Access cannot find the correct row to make

the update, so the update fails. Because updates cannot be made on this

type of index, even though it may be unique, Microsoft Access ignores the

index.

Additional reference words: 1.00

KBCategory:

KBSubcategory: ObcOthr


PRB: Microsoft Access GP Faults with ATI Ultra Video Card

Article ID: Q90121

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If you are using an ATI Graphics Ultra video driver and you select 1024 x

768 resolution, you will get a general protection (GP) fault when you

create a new form and choose Align from the Layout menu unless you first

select a control or field on the form. This error cannot be reproduced

using an ATI Graphics Ultra video driver at a lower resolution or with

any of the video drivers packaged with Microsoft Windows version 3.1.

RESOLUTION

==========

To work around this problem, select a control on the form before

choosing Align from the Layout menu.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Microsoft has only been able to reproduce this problem on the ATI

Graphics Ultra video card running in 8514 mode (that is, 1024 x 768) and

800 x 600, 16/256 mode.

Steps to Reproduce Behavior

---------------------------

1. Create a new form.

2. From the Layout menu, choose Align.

   The following error message appears:

      MSACCESS caused a General Protection Fault in module

      <unknown>022F:D7C8@|MSACCESS will close.

Additional reference words: 1.00 1.10 WinIss

KBCategory:

KBSubcategory: EvnGpf


PRB: Microsoft Excel Custom Date Format Not Detected by Import

Article ID: Q92651

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

 - Microsoft Excel version 4.x for Windows

---------------------------------------------------------------------

SYMPTOMS

========

When you import a Microsoft Excel version 4.0 spreadsheet containing custom

date formats into a new Microsoft Access version 1.x table, Microsoft

Access gives the fields Double data types, instead of Date/Time data types.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a new Microsoft Excel version 4.0 spreadsheet.

2. Enter a date in cell A1.

3. Assign a date format, such as mmmmmm/dd/yyyy, to the cell.

4. Import the spreadsheet to Microsoft Access. Note that the date is

   formatted as a Number data type instead of a Date/Time data type.

REFERENCES

==========

For more information about importing Microsoft Excel data, search for

"Excel" using the Microsoft Access Help menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmExl4


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: MS Access Short and Medium Time Formats Have Leading Zero

Article ID: Q92826

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you use the Short Time and Medium Time Date/Time formats,

a leading zero appears in your data.

RESOLUTION

==========

To eliminate the leading zero, use a custom format, such as "h:mm am/pm".

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a Date/Time field.

2. Format it as Medium Time.

3. Type "4:57pm" (without the quotation marks).

4. Press TAB to leave the field.

The value you entered will be displayed as "04:57 PM."

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: GnlFrmt


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: No System Table Permissions After Admin User Deleted

Article ID: Q96011

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Your attempt to access the system tables MSysACES, MSysColumns, or

MSysIndexes fails.

CAUSE

=====

You deleted the Admin account from the list of valid users.

RESOLUTION

==========

Before you delete the Admin account, you must assign permissions for

the system tables to a new member of the Admins group.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

The text below explains how to assign permission to access the system

tables to a new member of the Admins group.

If you create a new Admin account and delete the original Admin

account from the Users group before you assign the new account access

rights, you are unable to access the system tables. The one exception

to this rule applies if the original Admin did not create the

database.

To assign permissions to the system tables, use the following steps:

1. Log on to Microsoft Access as the user Admin. If you do not receive

   a logon screen, you are automatically logged in as Admin.

2. From the Security menu, choose Users.

3. In the Users dialog box, choose New.

4. Enter the name of the new administrator, assign the administrator a

   PIN (personal identification number), and choose OK.

5. In the Group Membership section of the Users dialog box, add the

   new administrator to the group Admins. To do so, select Admins in

   the Available Groups list and choose Add. Then choose Close.

6. From the View menu, choose Options.

7. In the Items box in the General category, set Show System Objects

   to Yes and choose OK.

8. From the Security menu, choose Permissions.

9. In the Object section of the Permissions dialog box, select the

   MSysACES table. In the Permissions section, select the Full

   Permissions check box. Microsoft Access sets all other permissions

   automatically.

Repeat step 9 for the MSysColumns and MSysIndexes tables.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 616-623

For more information, search for "permissions," then "Adding Users to

Groups," and "Assigning Permissions to Users" using the Help menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ScrtOthr


PRB: Not Enough Stack Memory When Opening Form

Article ID: Q96988

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you open a form, it flashes repeatedly, and the following

message is displayed:

   Not Enough Stack Memory

CAUSE

=====

One possible cause is that a macro with a Requery action is assigned

to the first control in the form's Tab Order. Or the macro is

assigned to the OnCurrent property of the form. This creates an

infinite loop, causing the form to requery until stack memory is

depleted.

RESOLUTION

==========

If the macro must be assigned to the first control, assign it to the

BeforeUpdate event of the control.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

The example below uses the sample database NWIND.MDB.

Steps to Reproduce

------------------

1. Create a new macro with a single Requery action. You do not need to

   fill in any arguments for this macro action. Save the macro as

   MyRequery.

2. Open the Categories form in Design view.

3. Assign the macro MyRequery to the OnEnter property of the first

   control on the Categories form. This should be the text box control

   named Category ID.

4. Open the form in Form view.

The form flashes several times. After several seconds, you receive the

following error message:

   Not Enough Stack Memory

Additional reference words: 1.00 1.10 continuously

KBCategory:

KBSubcategory: McrArg


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: NWIND Order Form Updates Order Amount Field with Zero

Article ID: Q101090

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The Order Amount field in the Orders table is incorrectly set to zero.

CAUSE

=====

The Orders.Write Order Amount macro writes the order subtotal,

calculated in the subform footer, to the Order Amount field in the

Orders table before the order subtotal has finished calculating.

The order subtotal is calculated using the Sum() aggregate function,

which runs asynchronously (or, independently) of other actions

on the form. When a field is altered in the subform that affects this

calculation (for example, the Quantity field), the AfterUpdate event

for the subform executes the Orders.Write Order Amount macro. This

macro executes before the new order subtotal can be calculated. As a

result, the macro incorrectly updates the Subtotal field in the table.

RESOLUTION

==========

The Order Subtotal field in the subform footer cannot be relied on to

calculate the correct order subtotal, since it is being calculated

independently of other events occurring on the form. Instead, the

value should be calculated using the DSum() aggregate function in the

Orders.Write Order Amount macro. This result can be written to the

Order Amount field in the Orders table.

MORE INFORMATION

================

This change has already been made to the sample database NWIND.MDB

that ships with Microsoft Access version 1.1. Following the "Steps

to Reproduce Behavior" section is a description of changes that must

be made to version 1.0 of the sample database NWIND.MDB to correct

this problem. There are additional suggestions to optimize the Orders

form for both versions 1.0 and 1.1.

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB supplied with Microsoft Access

   version 1.0.

2. Open the Orders form in Form view.

3. Change the Quantity field for one of the products listed in the

   Orders Subform. (Note the Order ID of the order that you are

   changing.)

4. Open the Orders table and find the record with the same Order ID.

   Result: The Order Amount field is set to zero.

Using DSum() Function to Correctly Calculate Order Subtotal

-----------------------------------------------------------

The following steps describe how to change the Orders form in

Microsoft Access version 1.0 to implement the DSum() function:

NOTE: The sample database ORDENTRY.MDB supplied with Microsoft Access

uses the same technique to calculate the order subtotal. Please see

the FrmOrders.Recalc macro in ORDENTRY.MDB for more information.

1. Open the Orders macro in Design view.

2. Find the SetValue action for the Write Order Amount macro group.

3. Change the expression argument from

      Forms![Orders]![Orders Subform].Form![Order Subtotal]

   to

      DSum("[Extended Price]","[Order Details2]","[Order ID] =

      Forms![Orders]![Order ID]")

4. Save the macro.

----------------------------------------

Since the Orders Subtotal field in the Order Subform footer is no

longer necessary, use the following steps remove it and increase your

database performance:

1. Open the Orders Subform in Design view.

2. Remove the Orders Subtotal field from the footer.

3. Open the Orders form and select the Subtotal field. Change the

   the ControlSource property from

      =[Orders Subform].Form![Order Subtotal]

   to

      Order Amount

In Microsoft Access version 1.0, you can remove Orders.Write Order

Amount from the BeforeUpdate property of the Orders form.

Additional reference words: 1.00

KBCategory:

KBSubcategory: FmsSubf


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: OnDblClick Macro Requires CancelEvent to Change Focus

Article ID: Q90115

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The macro action GotoControl does not successfully change the focus

to another control if the macro is attached to the OnDblClick

property of a text box, list box, or combo box.

CAUSE

=====

This behavior occurs because the second click of a double-click is

not processed until after the event is completed. The second click

on the same field forces Microsoft Access to return the focus to

that field.

RESOLUTION

==========

To prevent the second click in the double-click from being processed,

add a CancelEvent action to the macro after the GotoControl action.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 21, page 541

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsEvnt


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: Parameters Expected When Navigating Form with Sub-subform

Article ID: Q113545

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

While navigating a main form that contains a subform that contains another

subform, you receive the following error message:

   3 Parameters were expected but only 1 were supplied

CAUSE

=====

A common field is being used in the LinkChild and LinkMaster properties to

link the main form to the subform and the subform to its subform (the

subsubform). When Microsoft Access tries to evaluate the common link field

to filter the records in the subforms, it may try to evaluate the links in

an incorrect order, which leads to the error message described above.

RESOLUTION

==========

This problem does not occur in Microsoft Access version 2.0.

There are two ways to solve this problem in versions 1.0 and 1.1:

1. Create a single, unique, key field (perhaps a counter field) in the

   subform table that can be used to link to the subsubform table, rather

   than linking on multiple fields.

2. Base the subform and the subsubform on a query that has a calculated

   field that combines the linking fields into a single field. This single

   calculated field can be used in the LinkChild and LinkMaster properties

   of the subsubform control to link to the subform. This eliminates the

   common field from being defined in both links.

See the example below, which demonstrates how to use both techniques to

solve this problem.

MORE INFORMATION

================

The following example demonstrates the problem described above, and

demonstrates the techniques to solve the problem.

Note that this problem is very difficult to reproduce. Following the steps

below may not be sufficient to cause the problem to manifest in the sample

database NWIND.MDB.

Suppose that you have common Orders and Order Details tables to take orders

for your business, similar to the design in the sample database NWIND.MDB.

The Orders table stores information about an order and the Order Details

table stores information about the "many" products ordered on "one" order.

The tables might have the following important fields (among others):

   Orders

   ----------

   *Order ID

   Order Date

   Order Details

   ----------------

   *Order ID

   *Product ID

   Unit Price

   Quantity Ordered

NOTE: An asterisk (*) denotes a primary key field.

Your business is run such that you can fulfill an order by making multiple

shipments of products to the customer for a given order. (You may be out of

stock of some products and will ship the remainder of the order

separately.) You need to track how many of each product was shipped on a

given date for a given order. To do this, you create an additional "many"

table to store the dates and the quantities shipped per item on a given

order. You create the following table:

   Order Details Shipped

   ---------------------

   *Order ID

   *Product ID

   *Date

   Quantity Shipped

To view this information, you create a main form based on the Orders table.

You create a subform to view information about the "many" products ordered

from the Order Details table linked on the Order ID field. You create a

subsubform to view information on the "many" shipments made for each

product on the order from the Order Details Shipped table linked on the

Order ID and Product ID fields. Your form links look like the following:

   Main form     Subform              SubSubform

   Orders        Order Details        Order Details Shipped

   ---------     -------------        ---------------------

   Order ID  ->  Order ID         ->  Order ID

                 Product ID       ->  Product ID

In this design, the Order ID field is being used to link both the main form

to the subform, and the subform to the subsubform. This can cause the error

described above when you navigate the records on the main form.

Solution 1

----------

The best way to solve this problem is to create a single, unique key field

(perhaps a counter field), in the subform table that can be used to link

the subsubform table, rather than linking with multiple fields.

Using the example above, add a field called Order Detail ID with a Counter

data type to the Order Details table. The table will look like:

   Order Details

   ----------------

   Order Detail ID

   *Order ID

   *Product ID

   Unit Price

   Quantity Ordered

You can then link a product to the many shipment records in the Order

Details Shipped table using this single field:

   Order Details Shipped

   ---------------------

   *Order Detail ID

   *Date

   Quantity Shipped

The links between the main form and the subforms would look like the

following:

   Main form     Subform              SubSubform

   Orders        Order Details        Order Details Shipped

   ---------     -------------        ---------------------

   Order ID  ->  Order ID

                 Order Detail ID  ->  Order Detail ID

The difficulty with this solution is that implementing it on an existing

database with a lot of data may require some effort. The second solution,

although less preferred, solves the problem at the form level rather than

the table level.

Solution 2

----------

This solution involves another way of eliminating the use of a common field

in the links between the main form and the subforms by using a query. To

use this solution, create two queries. One of the queries will be based on

the subform table, and the other will be based on the subsubform table.

Include all the fields from the underlying table in each query. In an empty

column on the query grid, create a calculated field that combines the

values of the linking fields.

Using the example above, place the following in an empty Field row on the

query grid:

   OrdProdLink: [Order ID] & [Product ID]

You can now alter the LinkChild and LinkMaster fields between the subform

and the subsubform to use this single calculated field. The links between

the main form and the subforms would look like the following:

   Main form      Subform              SubSubform

   Orders         Order Details        Order Details Shipped

   ---------      -------------        ---------------------

   Order ID  ->   Order ID

                  OrdProdLink     ->   OrdProdLink

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 6, "Designing Select

Queries," pages 126-127

Microsoft Access "User's Guide," version 1.1, Chapter 6, "Designing Select

Queries," pages 130-131

Microsoft Access "User's Guide," version 1.0, Chapter 10, "Creating Forms

Based On More than One Table," pages 275-276

Microsoft Access "User's Guide," version 1.1, Chapter 6, "Designing Select

Queries," pages 275-276

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmsSubf


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: Print Preview of Datasheet Does Not Show Data

Article ID: Q109368

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

No data is displayed when you are previewing a table, query, or form

datasheet, even though records do exist in the underlying record source.

CAUSE

=====

This problem can occur after you change font settings.

RESOLUTION

==========

After you change font settings, save and then close the object. The data

will be displayed correctly when you preview the object after you re-open

it. Also, avoid selecting white as the color for window text in the Color

utility in Microsoft Windows Control Panel.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Start the Control Panel.

2. Double-click the Color icon.

3. Choose the Color Palette button.

4. In the Screen Element box, select Window Background. In the Basic

   Colors area, select a gray color.

5. In the Screen Element box, select Window Text. In the Basic Colors

   area, select white.

6. Start Microsoft Access and open any database.

7. Open any existing table in Datasheet view.

8. From the Layout menu, choose Font. Select a different font or size for

   the datasheet, and then choose OK.

9. From the File menu, choose Print Preview.

Additional reference words: 1.00 1.10 WinIss

KBCategory:

KBSubcategory: EvnOs


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: Queries Sent to Remote SQL Server Run Slowly

Article ID: Q109815

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A query sent to a remote SQL Server from Microsoft Access seems to run very

slowly compared to other methods of querying SQL data.

CAUSE

=====

This behavior can be due to either of the following causes:

 - A parameter used in the query is not explicitly defined, causing

   Microsoft Access to send the entire query to SQL Server.

   Microsoft Access automatically takes care of all implicit data type

   conversions internally, whether you are running a query against native

   Microsoft Access tables or attached tables. However, you will find that

   your remote queries run much slower than you expect when you force

   Microsoft Access to interpret query parameter data types, because it

   cannot be certain what implicit type conversions the remote server

   provides. As a result, Microsoft Access will not send the entire query

   to the remote server, but instead will locally process the parts of the

   query having parameters, resulting in slower than expected query

   performance.

 - You are referencing a function or command that is unknown to SQL in your

   query criteria.

   Since SQL Server does not know how to process user-defined Access Basic

   functions and some built-in Access Basic commands and functions, it

   cannot evaluate them. As a result, Microsoft Access must locally

   evaluate them, which can hinder query speed. This applies to all

   functions not known by SQL, such as the Access Basic IIf() function.

   Note that this behavior applies only when a function unknown to SQL is

   used in your query criteria. It does not apply when such a function is

   used in the query's output, except for aggregates such as StDev() that

   have no SQL equivalent.

RESOLUTION

==========

Make sure to explicitly define all the query parameters before running the

query, so that Microsoft Access can send the entire query to the server.

To explicitly define parameters, choose Parameters from the Query menu, and

then enter the names and data types of all the parameters used in the

query. The "Employee Sales by Country (Parameter)" query in the sample

database NWIND.MDB demonstrates this method.

Also make sure to use only functions and commands known to SQL in your

query criteria, or, if possible, provide additional query restrictions to

send to the server. This limits the amount of data returned to Microsoft

Access for local user-defined function evaluation. For example, the

following query will return all records that are not null:

   Like MyFunction(Forms]![Formname]![Fieldname],*)

Since the sample query above contains MyFunction(), a function unknown to

SQL, the query has to be performed locally. Instead, you can get the same

results by using the following query, which uses only functions known to

SQL:

   Like [Fieldname] or [Fieldname] Is Null

Note that "Forms!Formname!Fieldname" is effectively a query parameter, and

should be explicitly declared. It can be declared as:

   Name=Forms!Formname!Fieldname, Type=<yourtype>

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

REFERENCES

==========

Microsoft Access "User's Guide," pages 182-185

Additional reference words: 1.00 1.10 Queries

KBCategory:

KBSubcategory: ObcOthr


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 Error Caused by Colon in Field Name

Article ID: Q94191

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A query results in one of the following error messages:

 - Query must have at least one output field

 - Can't set criteria unless you've specified a field

 - Syntax Error

CAUSE

=====

One of the query's criteria includes a field name that ends with a

colon(:). For example, the fieldname "Field:" used as a criteria would

cause an error message.

RESOLUTION

==========

Field names that include colons must be enclosed in brackets to be used

as criteria. For example, to use the field name "Field:" as a criteria,

you would enter it as "[Field:]" (without quotation marks).

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

In a query's Design view, you can rename a field to be more descriptive.

Place the insertion point in front of the first letter of the field name

in the QBE grid. Then type the new name followed by a colon. Do not

delete the underlying field name. Now, in Datasheet view, you will see

the descriptive label as the heading instead of the underlying field

name.

Using this technique to change a field name in a query's Design view

automatically changes the heading in the query's Datasheet view, and it

changes the field name in a form or report based on the query. But the

underlying field name in the table does not change.

The error messages shown above occur because without brackets around the

field name, Microsoft Access interprets the colon in the field name as a

request to add a label (rename) that field.

Steps to Reproduce Behavior

---------------------------

1. Create a new table named Test with one field named FullName:.

2. Save the table as Table1.

3. Create a query based on Table1.

4. Drag the field FullName: to the query grid.

5. Run or view the results of the query. You will receive an error

   message.

REFERENCES

==========

For more information on renaming fields in queries, search for "renaming

fields" then "Renaming a Field in a Query" using the Microsoft Access

Help menu.

Microsoft Access "User's Guide," version 1.0, Chapter 5, "Query Basics,"

page 96

Additional reference words: 1.00 1.10 errmsg

KBCategory:

KBSubcategory: QryOthr


PRB: Query Fails When Linked SQL Server Table Cannot Be Found

Article ID: Q95053

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When attempting to use an attached SQL Server table, you receive the

following error message:

   Couldn't execute query; couldn't find linked table.

   Invalid object name <TABLE_NAME>.

CAUSE

=====

The most likely cause of this error is an incorrect entry in the

[SQLSERVER] section of your WIN.INI file.

The [SQLSERVER] section of your WIN.INI file should look like the

following:

   [SQLSERVER]

   MYSERVER=dbnmp3,\\MYSERVER\PIPE\SQL\QUERY

   YOURSRVR=dbnmp3,\\YOURSRVR\PIPE\SQL\QUERY

The error is caused by an incorrect server name (MYSERVER or YOURSERVR)

or additional spaces in the entry.

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 that the [SQLSERVER] section of your WIN.INI file contains

the correct entry for the server you are attempting to attach.

Additional reference words: 1.00 1.10 tshoot errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: Query Results in "Overflow" Error Message

Article ID: Q104488

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you run a query an "Overflow" error message is returned.

CAUSE

=====

This error message can occur when you use And or Or with numbers greater

than 32768. For example, the following expression in the field row of a

query will cause an the error:

   Expr1: 32768 and 0.

NOTE: There are other causes of the Overflow error that can be avoided by

using the correct data types for variables, or by modifying the expression

that causes the error. This behavior is by design, and is explained in the

Help topic for the Overflow error. These errors include:

 - Dividing one number by another number such that the result is larger

   than the data type can hold. For example,

      Dim MyVal As Integer

      MyVal = 32767 / 0.1

   would result in setting MyVal to 327,670, which exceeds the maximum

   integer size of 32,767.

 - Multiplying two numbers such that the result is larger than the data

   type can hold.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: QryParm


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: Remote ODBC Tables Are Read-Only Without a Unique Index

Article ID: Q90100

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you edit an attached SQL Server table that does not have a unique

index defined, Microsoft Access beeps and the message "Form is read only"

appears in the status bar.

CAUSE

=====

Microsoft Access requires that a unique index be defined for each table.

Database tables from products such as Oracle, Sybase, Ingres, and DB2

that are attached to Microsoft Access using ODBC are read-only unless

they have a unique index. Views and synonyms are also read-only without a

unique index.

RESOLUTION

==========

You can use Microsoft SQL Server to define a unique index for each table

with the SQL command CREATE UNIQUE INDEX. The basic syntax for this

command is:

   CREATE UNIQUE INDEX <index_name>

      ON [[<database.>]<owner.>]<table_name.> (<column_name>

         [, <column_name>]...)

You cannot run this command from within Microsoft Access; it must be run

in the system administration facility (SAF) on a SQL Server computer or

from a program such as Q+E, which is shipped with Microsoft Excel and can

run SQL commands directly on the SQL Server computer.

After you create the unique index for the table, reattach the table in

Microsoft Access to implement the change.

STATUS

======

This behavior is by design.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 66-68

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: ObcOthr


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 Detail Items Appear in Group Header

Article ID: Q109718

------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

------------------------------------------------------------

SYMPTOMS

========

The Groups/Totals ReportWizard places controls in the group header

section of the report that should be in the report's detail section.

CAUSE

=====

This problem occurs if the report is based on a query that contains a

calculated field.

RESOLUTION

==========

To work around this behavior, move the calculated field to the first

column in the query grid. Or convert the query to a make-table query,

and then base your report on the make-table query's resultant table,

instead of on the original query.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Open the sample database NWIND.MDB.

 2. Create a new query based on the Customers table.

 3. Drag the Customer ID, Company Name, and Contact Name fields onto the

    query grid.

 4. Enter the following expression in the Field row of the fourth column

    of the grid:

       IIF([customer id] = "ALWAO", "yes", "no")

 5. Save the query as Group/Total.

 6. Choose the Report button in the Database window, then choose New.

 7. In the Select A Table/Query box, select the Group/Total query.

 8. Choose the ReportWizards button.

 9. Select Groups/Totals in the Which AccessWizards Do You Want? box,

    and then choose OK.

10. Click the ">>" button, and then choose Next.

11. Select the Customer ID field and then click the ">" button.

12. Select the Company Name field and then click the ">" button. Choose

    Next.

13. At each of the next three screens, choose Next.

14. Choose the Design button.

Note that the report has two group headers. The Company Name header,

however, contains both the Company Name field and the Contact Name

field, instead of just the Company Name field.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 17, "Report Basics,"

pages 399-403

Microsoft Access "User's Guide," version 1.1, Chapter 17, "Report Basics,"

pages 403-407

Additional reference words: 1.00 1.10 wizard

KBCategory:

KBSubcategory: RptSort


PRB: Report Grouping on Date/Time Field Incorrect

Article ID: Q109326

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

A report that groups on a Date/Time field will group incorrectly if Group

On is set to Day and the Interval is set to 1. The report will group the AM

and PM records in different groups, instead of putting all the records for

one day in one group. In some cases, the group header will be repeated.

RESOLUTION

==========

To get the correct grouping on the report, set Group On to Hour and set the

Interval to 24.

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.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

 1. Copy the Orders table in the sample database NWIND.MDB to a table

    named Orders1.

 2. Open the Orders1 table in Datasheet view. Modify the entries in the

    Order Date column as follows, making sure to add "AM" and "PM"

    (without the quotation marks) as indicated:

       Order ID      Order Date

       -------------------------------

       10000         1/6/92 9:00:00 AM

       10001         1/6/92 3:00:00 PM

       10002         1/7/92 9:00:00 AM

       10003         1/7/92 3:00:00 PM

       10004         1/7/92 3:00:00 PM

 3. Delete all other records in the table.

 4. Create a new report based on the Orders1 table.

 5. Choose ReportWizards.

 6. Select Groups/Totals, and then choose Next.

 7. Select Order ID and then choose ">". Select Order Date and then

    choose ">". Choose Next.

 8. Select Order Date and then choose ">". Choose Next.

 9. Select Day in the Records Will Be Grouped By box, and then choose

    Next.

10. Choose Next.

11. Choose Next.

12. Choose Print Preview.

Note that January 6 is split into two groups. One group contains the AM

records for January 6, and the other group contains the PM records for

January 6 and the AM records for January 7.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory:  RptSort


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: Report Property PageFooter Set to "Not With Rpt Ftr"

Article ID: Q113297

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you set a report's PageFooter property to Not With Rpt Ftr, the page

footer still prints on the last page of the report with the report footer.

CAUSE

=====

The PageFooter property, if set to Not With Rpt Ftr, was designed to not

print the page footer if the report footer is the first section printed on

the report.

Note that the PageHeader property works similarly. The PageHeader property,

if set to Not With Rpt Ftr, was designed to not print the page header if

the report footer is the first section printed on the page.

RESOLUTION

==========

Setting the report's PageFooter property to Not With Rpt Ftr alone

will not prevent the page footer from printing with the report footer.

To keep the page footer from printing with the report footer, set the

report footer property ForceNewPage to Before Section. Or, if the

PageHeader property is set to Not With Rpt Ftr, the report footer section

will be forced to a new page, and no page footer section will print.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

 1. Open the sample database NWIND.MDB.

 2. Open the Alphabetical List Of Products report in Design view.

 3. From the View menu, choose Properties.

 4. Set the report's PageFooter property to Not With Rpt Ftr.

 5. Add a label control with the text "My Report Ftr" to the report

    footer section.

 6. From the File menu, choose Print Preview.

 7. Move to the last page of the report. Note that both the report footer

    and the page footer (page number) are printed.

 8. Choose the Cancel button on the toolbar.

 9. Change the report footer property ForceNewPage to Before Section.

10. From the File menu, choose Print Preview. Move to the last page

    of the report. Note that the report footer is printed on a new

    page, without the page footer.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, Chapter 18, "Designing

Reports," page 445

Microsoft Access "User's Guide," version 1.1, Chapter 18, "Designing

Reports," page 449

Additional reference words: 1.00 1.10 report footer

KBCategory:

KBSubcategory: RptProp


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: 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: Setup Program STFSETUP.EXE Causes GP Fault

Article ID: Q95646

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The Microsoft Access Setup program displays the following error

message immediately after trying to update an old version of the

Windows Help file (WINHELP.HLP):

   General Protection Fault (GPF) in STFSETUP.EXE

CAUSE

=====

The current WINHELP.HLP or WINHELP.EXE files in the Windows directory

are corrupt. These corrupt files cause a general protection (GP) fault

when you run the Microsoft Access Setup program to update the Help file.

RESOLUTION

==========

Rename the WINHELP.EXE and WINHELP.HLP files in the Windows directory to

some other names. Then reinstall Microsoft Access. The Setup program will

place new Help files in the Windows directory.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

Additional reference words: 1.00 1.10 UAE unrecoverable application error

gpf

KBCategory:

KBSubcategory: StpOthr


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: 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: 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: Toolbox Selection Lost When Toolbox Is Closed

Article ID: Q95641

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The toolbox will not retain your selection when it is closed and

then reopened.

RESOLUTION

==========

The toolbox will always be reset to the Pointer when you reopen it.

If you want your selection to be saved, choose the Lock button at

the bottom of the toolbox.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Open a form in Design view.

2. From the View menu, choose Toolbox.

3. Select an item on the toolbox other than the Pointer.

4. From the View menu, choose Toolbox (this will close the toolbox).

   Note that the cursor still reflects the current tool selection as

   expected.

5. From the View menu, choose Toolbox to reopen the toolbox. The Pointer

   will be selected.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: FmrTlbx


PRB: TransferDatabase Macro Accepts Invalid File Names

Article ID: Q92674

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When using the TransferDatabase macro action to export a database,

Microsoft Access allows you to enter file names that include spaces in

the Destination argument. Once the database is exported with a file name

that includes a space, Microsoft Access will not be able to import that

file. If you try to import the file, the following error message appears:

   The filename is not valid

RESOLUTION

==========

If you export a file with a blank embedded in the filename, renaming

the file without the space, using File Manager or MS-DOS, enables

Microsoft Access to import the file.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a table and call it Table1.

2. Create the following new macro:

      Macro Name   Condition   Action

      -----------------------------------------

      Macro1                   TransferDatabase

      Macro1 Action

      -------------------------------------

      TransferDatabase

      Arguments          Attribute

         Transfer Type:    Export

         Database Type:    Dbase or Paradox

         Database Name:    c:\access

         Object Type:      Table

         Source:           Table1

         Destination:      Test Table

         Structure Only:   No

3. Run the macro. This macro creates a file called Test Tab.xxx where xxx

   is the appropriate extension for the export type.

4. Try to import this file. Microsoft Access displays the message:

      Test Tab.xxx This filename is not valid

Additional reference words: 1.00 1.10 space

KBCategory:

KBSubcategory: IntpOthr


PRB: TransferDatabase Macro Action Does Not Replace Table

Article ID: Q106187

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If you use a TransferDatabase macro action to transfer a table with the

same name as an existing table in the destination database, the existing

table will not be overwritten by the transferred table.

CAUSE

=====

If the destination database contains a table with the same name as the

table you are trying to transfer, Microsoft Access will give the

transferred table a new name in the destination database. The new name will

consist of the original table name plus a sequential number. For example,

if you try to transfer a table named Categories to a database that already

has a table with the same name, the newly transferred table will be named

Categories1.

RESOLUTION

==========

If you want to replace an existing table using a TransferDatabase macro

action, you first need to rename or delete the existing table in the

destination database.

STATUS

======

This behavior is by design.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

NOTE: The following example assumes that Microsoft Access is installed in

the C:\ACCESS directory. If Microsoft Access is installed in a different

directory on your computer, modify the example to refer to your Microsoft

Access directory.

1. Before starting Microsoft Access, use the Microsoft Windows File Manager

   to make a copy of the NWIND.MDB file. Name the copy NWIND2.MDB, and

   place it in the Microsoft Access directory.

2. Start Microsoft Access. Open the sample database NWIND.MDB.

3. Create the following new macro, and save it as Test1:

      Macro Name   Action

      -----------------------------

      Test1        TransferDatabase

      Test1 Actions

      -----------------------------------

      Transfer Type: Import

      Database Type: Microsoft Access

      Database Name: C:\ACCESS\NWIND2.MDB

      Destination:  Categories

      Structure Only: No

5. Run the macro by choosing Run from the Macro menu, and then close

   the macro.

6. In the Database window, choose Table. Note that the original

   Categories table still exists, and that a new Categories1 table has

   been added.

Additional reference words: 1.00 1.10 ADK

KBCategory:

KBSubcategory:  IsmIea


PRB: TransferText Action Removes Spaces from Field Names

Article ID: Q109734

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

The TransferText action removes embedded spaces from field names if the Has

Field Names argument is set to Yes, and the Transfer Type argument is set

to Delimited Text.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

The Has Field Names argument indicates whether the table or query field

names should be included as the first row of the exported text file. When

set to Yes, the table or query field names will be exported to the text

file as the first row of the text file. Embedded spaces will be removed

from the field names in the first row of the exported text file.

Note that the Has Field Names argument does not apply if the Transfer Type

argument is set to Fixed-Width. When you use the Fixed-Width setting, the

field names are a part of the fixed-width import/export specification.

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Create the following new macro, and then save it as TransferText Macro:

      TransferText Macro Actions

      ----------------------------------

      TransferText

         Transfer Type: Export Delimited

         Specification: <leave blank>

         Table Name: Shippers

         File Name: SHIPPERS.TXT

         Has Field Names: Yes

3. From the Macro menu, choose Run.

4. When the macro has finished, quit Microsoft Access.

5. Open the SHIPPERS.TXT file in any text editor (such as Windows Notepad).

   Note that the spaces in the field names in the first row of the file

   have been removed. For example, the name "Shipper ID" has become

   "ShipperID."

REFERENCES

==========

For more information about the TransferText action, search for

"TransferText" then "TransferText Action" using the Microsoft Access Help

menu.

Additional reference words: 1.00 1.10

KBCategory:

KBSubcategory: IsmTxtd


PRB: Troubleshooting "Out of Memory" Errors in Queries

Article ID: Q95008

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you run a query, you receive the following error message even though

your system has sufficient memory and system resources:

   Out of Memory

CAUSE

=====

Microsoft Access allocates specific memory segments for compiling a query.

If your query requires more memory than is stored in the segment, you will

receive the error message stated above.

RESOLUTION

==========

The following tips may help you to avoid an "Out of Memory" error message:

 - Reduce the number of columns in the table's design.

 - Reduce the size of the column names in the table's design.

 - Reduce the number of columns selected by the query.

 - Do not base a query on another query; run only a singe query at a time.

 - If a query that causes an "Out of Memory" error message includes another

   query, convert that query to a make-table query. Then, use the resultant

   table in the initial query, instead of the included query.

Additional reference words: 1.00 1.10 tshoot errmsg

KBCategory:

KBSubcategory: QryJoin


PRB: Troubleshooting 'ODBC - couldn't find ODBC.DLL' Error

Article ID: Q95011

----------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access version 1.0

----------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message:

   ODBC - couldn't find ODBC.DLL

CAUSES

======

Here are three possible causes:

 - The ODBC.DLL file you are using may be old.

 - You may have duplicate ODBC.DLL files on your system, and you are

   using the wrong one.

 - The ODBC.DLL file you are using may be damaged or corrupted.

RESOLUTION

==========

The ODBC.DLL file installed by Microsoft Access version 1.0 is dated

10-16-92, has a size of 44736 bytes, and should be installed in the

\WINDOWS\SYSTEM directory.

MORE INFORMATION

================

There are other situations that may indirectly cause this error message. To

troubleshoot for these possibilities:

1. Use File Manager to search for multiple, corrupted, or outdated

   copies of these files:

      File          Correct Dates and Sizes

      ---------------------------------------------------

      DBNMP3.DLL    dated 9-15-92(8241 bytes) or later

      SQLSRVR.DLL   dated 10-16-92(135792 bytes) or later

      NETAPI.DLL    depends on the network being used

      COMMDLG.DLL   dated 10-25-92(89248 bytes) or later

      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 in step 1 are in their appropriate locations.

   All files except NETAPI.DLL are usually installed in the \WINDOWS\SYSTEM

   directory. The NETAPI.DLL file is a network specific driver; it 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 to the same data source. If you

   cannot access the data source from another application, you probably

   have a network problem with the NETAPI.DLL file or with the server, not

   with Microsoft Access or ODBC.

4. Attempt to attach another data source, if available, such as another

   SQL server. If you can attach to another server, 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 the same data source from a different machine. If you

   cannot gain access to the SQL server from a different machine, you may

   have a network-wide problem, or the SQL 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 server is up,

   available for transactions, and operating properly.

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 ODBC tshoot errmsg

KBCategory:

KBSubcategory: ObcOthr


PRB: Two Error Messages with Database on Workgroups Server

Article ID: Q92893

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

If you are connected to a Microsoft Windows for Workgroups server and

have a database from the server open on your workstation in Microsoft

Access, you may be disconnected by the server and receive error

messages from Microsoft Access.

CAUSE

=====

The server can disconnect any client by using Net Watcher, a program

that comes with Windows for Workgroups. If you are disconnected, you

receive two separate error messages when you attempt to open a table

in Microsoft Access. The first error message is:

   Internal database error (-1106).

When you choose OK, you receive the second error message:

   Disk or Network error.

RESOLUTION

==========

You must reconnect to the server on which the database is stored in

order to use the database.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Problem

--------------------------

1. Connect your computer (the client) to a Windows for Workgroups

   server.

2. Start Microsoft Access on the client and open a database file

   located on the server.

3. Start Net Watcher on the server.

   NOTE: Net Watcher is located in the Accessories group in Windows

   Program Manager.

4. From the Connection menu, choose Disconnect to disconnect the

   client from the server.

5. In the Database window on the client, select a table and try to open

   it. The database still appears to be open, even though the server

   has disconnected you.

Additional reference words: 1.00 1.10 wfwg errmsg client server

KBCategory:

KBSubcategory: GnlMu


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: Typing in Combo Box Does Not Select Item

Article ID: Q104975

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

Typing a value in a combo box does not automatically select that value in

the combo box.

CAUSE

=====

The LimitToList property of the combo box is set to No.

RESOLUTION

==========

Change the LimitToList property of the combo box to Yes.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

The LimitToList property determines if a combo box can accept new items. If

the property is set to No, characters typed in the combo box cannot be used

to select a list item because Microsoft Access does not know if you are

entering a new value or want an existing value from the combo box.

If the LimitToList property is set to Yes, the combo box cannot accept new

values. This enables Microsoft Access to use the characters you type for

selecting a list item.

Steps to Reproduce Behavior

---------------------------

1. Open the sample database NWIND.MDB.

2. Open the Suppliers form in Design view.

3. Select the combo box at the bottom of the form.

      Object: Combo box

      -----------------

      ControlName: Company Pick List

         RowSourceType: Table/Query

         RowSource: Supplier List

         LimitToList: Yes

4. Set the LimitToList property to No.

5. View the form in Form view.

6. Click the arrow beside the combo box to open the combo box.

7. Begin typing "Bigfoot Breweries" (without the quotation marks) and note

   that Bigfoot Breweries is not automatically selected until the last

   character is typed.

REFERENCES

==========

For more information on properties, search for "property sheet" then

"property sheet" using the Microsoft Help menu.

Microsoft Access "User's Guide," version 1.0, Chapter 9, "Designing Forms,"

pages 244-245

Additional reference words: 1.00 1.10 combobox spell limit list UI

KBCategory:

KBSubcategory: FmsCmbo


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 Close Microsoft Access from Control-Menu Box

Article ID: Q103188

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

You receive the following error message when you attempt to close

Microsoft Access from the Control-menu box:

   Currently unable to quit Microsoft Access

CAUSE

=====

This problem occurs if the currently selected form has an OnClose

property pointing to a macro that contains the Quit action.

RESOLUTION

==========

Do not attach a macro containing the Quit action to the OnClose

property of the form if you will be using the Control-menu box to quit

Microsoft Access.

STATUS

======

This problem no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Steps to Reproduce Behavior

---------------------------

1. Create a blank, unbound form and save it as Form1:

      Form: Form1

      ---------------

      OnClose: Macro1

2. Create a new macro and save it as Macro1:

      Macro Name      Action

      ----------------------

      Macro1          Quit

3. Open Form1 in Form view, and then double-click the Microsoft Access

   Control-menu box, or choose Close from the Control-menu box. You

   will receive the error message:

      Currently unable to quit Microsoft Access.

Additional reference words: 1.00 1.10 on close system

KBCategory:

KBSubcategory: McrActn


PRB: Unable to Connect to Attached SQL Server Table, Error Msg

Article ID: Q95051

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you try to use an attached SQL Server table, you receive the

error message:

   Unable to connect to data source.

CAUSE

=====

The following two conditions are most likely to cause this error

message:

 - There is an incorrect entry in the [SQLSERVER] section of your

   WIN.INI file.

   The [SQLSERVER] section of your WIN.INI file should look like the

   following example:

      [SQLSERVER]

      MYSERVER=dbnmp3,\\MYSERVER\PIPE\SQL\QUERY

      YOURSRVR=dbnmp3,\\YOURSRVR\PIPE\SQL\QUERY

   This error is caused by an incorrect server name (MYSERVER or

   YOURSERVR) or extra spaces in the path.

 - The SQL database server is overloaded or unavailable.

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 that the [SQLSERVER] section of your WIN.INI file has the

correct entry for the server you are attempting to attach. Then check

with the system administrator to see if the SQL database server is

available for transactions, operating properly, and not overloaded.

Additional reference words: 1.00 1.10 tshoot errmsg ODBC SQL Server

KBCategory:

KBSubcategory: ObcOthr


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 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: Update Queries Do Not Check Validation Rules

Article ID: Q90096

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

During update queries, validation rules are not checked, and no

error log is generated for invalid records.

RESOLUTION

==========

Run a query to see which rows violate the validation rules. For example, if

you defined "<500" as the rule for the Units In Stock field in the Products

table, and then ran an update query to update Units In Stock + 450, some of

the fields might be greater than 500. You could then run a select query

checking for Units In Stock > 500.

STATUS

======

This behavior no longer occurs in Microsoft Access version 2.0.

MORE INFORMATION

================

Update queries are queries that change existing data in a table.

Validation rules are rules placed on a field when it is defined to

prevent that field from accepting data that does not meet the

specified rules.

When an update query is executed, as long as the data that is being

changed is the correct data type for the field, it will be changed

even if it violates the validation rules for field.

REFERENCES

==========

Microsoft Access "User's Guide," version 1.0, pages 174-178

Additional reference words: 1.00 1.10 update

KBCategory:

KBSubcategory: QryMktbl


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: Updated Help Compiler Needed for Word 6.0 RTF Files

Article ID: Q109405

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access Distribution Kit version 1.1

---------------------------------------------------------------------

SYMPTOMS

========

When you compile a Help file with the Help compiler that ships with the

Microsoft Access Distribution Kit (ADK), you receive error messages similar

to the following:

 - This application has violated system integrity due to an invalid

   fault and will be terminated.

 - Quit all applications, quit Windows, and then restart your computer.

CAUSE

=====

The Rich Text Format (RTF) file that you are using was created with

Microsoft Word version 6.0 for Windows. This version of Word for Windows

generates some new RTF items that are not supported by the Help compiler

that ships with the ADK.

RESOLUTION

==========

An updated version of the Help compiler is available on CompuServe and the

Microsoft Download Service (MSDL). The updated Help compiler is compatible

with Word 6.0 for Windows RTF files.

STATUS

======

This problem no longer occurs in the Microsoft Access Developer's Toolkit

version 2.0.

MORE INFORMATION

================

The Help compiler that ships with the ADK is named HC31.EXE and is version

3.10.504. To work with RTF files from Word 6.0 for Windows, you need

version 3.10.505 or later.

The following steps describe how to download the updated Help compiler from

either CompuServe or the MSDL:

To locate the most recent version of the Help compiler on CompuServe:

1. Log on to CompuServe.

2. Type "go msl" (without the quotation marks).

3. Choose the Scan option.

4. When prompted for Keywords, type "help compiler" (without the quotation

   marks).

To locate the most recent version of the Help compiler on the MSDL:

1. Connect to the MSDL at (206) 936-6735. Login instructions will

   be displayed.

2. After you log in, choose the File Index option.

3. Choose the Languages and Windows SDK option.

4. Choose the Windows SDK option.

5. Choose the Articles option.

Once you have located the most recent version of the Help compiler on

either CompuServe or the MSDL, follow the online instructions for

downloading the file.

Note that the file you download may contain two Help compiler files, HC.EXE

and HCP.EXE. HC.EXE is the standard Help compiler, and HCP.EXE is the

compiler for use with extended memory and larger files. HCP.EXE allows

larger files to be compiled in the Windows environment than does HC.EXE.

Additional reference words: 1.10 hccp hc505.exe

KBCategory:

KBSubcategory: PgmOthr


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: Where Condition Refers to Fields Not Controls

Article ID: Q103140

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

SYMPTOMS

========

On page 348 of the Microsoft Access "Language Reference" manual, the

description for the action argument Where Condition reads:

   To open a form in which the value of one of its controls

   equals the value of a control on another form, use this

   syntax:

      [controlname on opened form] =

         Forms!formname![controlname on other form]

RESOLUTION

==========

The description for the action argument Where Condition on page 348

should read:

   To open a form and show only records where one of the fields

   matches the value of a control on another form, use this

   syntax:

      [field in opened form's recordsource] =

         Forms!formname![controlname on other form]

STATUS

======

This problem no longer occurs in the Microsoft Access version 2.0

User's Guide.

MORE INFORMATION

================

The action argument Where Condition is used to filter the records in

the form's dynaset. Microsoft Access compares the specified fields in

each record on the form being opened to the controls on the original

form. Records on the form being opened will be included in the dynaset

only if the record's fields satisfy the Where Condition argument.

The steps below demonstrate the correct use of the Where Condition

argument:

1. Open the sample database NWIND.MDB. Create a new unbound form with

   the following controls. Save the form as ChooseState.

      Textbox

      ------------------------

      ControlName: ChosenState

      Command Button

      ------------------

      OnPush: Open Emp 2

2. Create a new form, bound to the Employees table, with the following

   controls. Save the form as Emp 2.

      Textbox

      ------------------------

      ControlName: Last Name

      ControlSource: Last Name

      Textbox

      --------------------

      ControlName: State

      ControlSource: State

3. Create a new macro with the following action. Save the macro as

   Open Emp 2.

      Action: OpenForm

      ----------------------------------------------------------

      Formname: Emp 2

      Where Condition: [State] = Forms!ChooseState![ChosenState]

4. Open the ChooseState form. Type "WA" (without the quotation marks)

   in the text box, and choose the command button. The Emp 2 form

   opens and shows only those employees who live in Washington state.

5. Close the forms.

6. Open the Emp 2 form in Design view. Change the ControlName property

   of the State text box to Test. Save and close the form.

7. Open the form ChooseState. Type "WA" (without the quotation marks)

   in the text box, and choose the command button. The Emp 2 form will

   open and show the same records as in step 4. This demonstrates that

   you are filtering the underlying data, not the controls on the

   form.

REFERENCES

==========

Microsoft Access "Language Reference," page 348

Additional reference words: 1.00 1.10 docerr

KBCategory:

KBSubcategory: FmsProp


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: 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


WX0964: SecurityWizard and White Paper Application Note

Article ID: Q109074

---------------------------------------------------------------------

The information in this article applies to:

 - Microsoft Access versions 1.0 and 1.1

---------------------------------------------------------------------

The "SecurityWizard and White Paper" (WX0964) Application Note contains

in-depth information about the Microsoft Access security model to help you

understand and use Microsoft Access security effectively.

You can obtain this Application Note from the following sources:

 - CompuServe, GEnie, and Microsoft OnLine

 - Microsoft Download Service (MSDL)

 - The Internet (Microsoft anonymous ftp server)

 - Microsoft Product Support Services

For complete information, see the "To Obtain This Application Note"

section at the end of this article.

THE TEXT OF WX0964

==================

======================================================================

  Microsoft(R) Product Support Services Application Note (Text File)

                WX0964: SECURITYWIZARD AND WHITE PAPER

======================================================================

                                                  Revision Date: 12/93

                                                       1 Disk Included

The following information applies to Microsoft Access(R), version 1.1.

|---------------------------------------------------------------------|

| 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) 1993 Microsoft Corporation.  All Rights Reserved.     |

| Microsoft, Microsoft Access, and MS-DOS are registered trademarks   |

| and Windows is a trademark of Microsoft Corporation.                |

|---------------------------------------------------------------------|

The disk included with this document contains two files. The

about the Microsoft Access security model to help you understand and

use Microsoft Access security effectively. The WZSECURE.MDA file

contains the Microsoft Access SecurityWizard, which is a tool for

easily securing your databases. The white paper includes instructions

for using the SecurityWizard.

To Install the SecurityWizard

-----------------------------

1. Copy the WZSECURE.MDA file to your Microsoft Access 1.1 program

   directory.

2. Add the following line to the [Libraries] section of your

   MSACCESS.INI file:

      WZSECURE.MDA=RO

3. Add the following lines to your MSACCESS.INI file, and then

   save the file:

      [Menu Add-Ins]

      Security&Wizard==swz_SecureDB()

The next time you start Microsoft Access, the SecurityWizard command

will be available on the Help menu.

The SecurityWizard runs only in Microsoft Access version 1.1, but will

work with databases in either 1.0 or 1.1 format. Attempting to use the

SecurityWizard in Microsoft Access version 1.0 will result in an "Out-

of-date database format" error message, followed by a "Some library

modules could not be loaded" error message when you start Microsoft

Access. Databases created by the SecurityWizard are always in version

1.1 format.

The SecurityWizard may take some time to run. For example, securing

the sample database NWIND.MDB on a 486/50 computer takes approximately

13 minutes. The SecurityWizard's About dialog box gives further

information on what the SecurityWizard does, as does the text file

included on the disk.

The Security White Paper

------------------------

The security white paper is a text document written by Microsoft

Access development.  It contains in-depth information on the security

model used by Microsoft Access, details on how and why Microsoft

Access security acts the way it does, and answers to some common

security questions.  The file is in text (.TXT) format and is readable

by any word processor.

--------------------------------------------------------------------

TO OBTAIN THIS APPLICATION NOTE

===============================

 - On CompuServe, GEnie, and Microsoft OnLine, Application Notes

   are located in the Microsoft Software Library. You can find

   WX0964 in the Software Library by searching on the word WX0964,

   the Q number of this article, or S14488. WX0964 is a compressed,

   self-extracting file. After you download WX0964, run it to

   extract the file(s) it contains.

 - Application Notes are available by modem from the Microsoft

   Download Service (MSDL), which you can reach by calling (206)

   936-6735. This service is available 24 hours a day, 7 days a week.

   The highest download speed available is 14,400 bits per second (bps).

   For more information about using the MSDL, call (800) 936-4100 and

   follow the prompts. To obtain WX0964, download WX0964.EXE.

   WX0964.EXE is a compressed, self-extracting file. After you

   download WX0964, run it to extract the file(s) it contains.

 - On the Internet, Application Notes are located on the Microsoft

   anonymous ftp server, which you can reach by typing "ftp

   ftp.microsoft.com" (without the quotation marks) at the ">" command

   prompt.

 - If you are unable to access the sources 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: 1.00 1.10 appnote

KBCategory:

KBSubcategory: ScrtOthr


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 them 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.