ACC: Fill Record w/Data from Prev. Record Automatically (95/97)Last reviewed: October 24, 1997Article ID: Q136127 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. When you are creating new records using a form, you may want to speed the data entry process by having fields in the new record fill automatically with values from the previous record. This article demonstrates a sample Visual Basic for Applications function called AutoFillNewRecord() that enables you to fill selected fields (or all fields) in a new record with values from the previous record automatically. NOTE: This article explains a technique demonstrated in the sample files, FrmSampl.exe (for Microsoft Access for Windows 95 version 7.0) and FrmSmp97.exe (for Microsoft Access 97). For information about how to obtain these sample files, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q150895 TITLE : ACC95: Microsoft Access Sample Forms Available on MSL ARTICLE-ID: Q175066 TITLE : ACC97: Microsoft Access 97 Sample Forms Available on MSL MORE INFORMATIONOne technique to speed repetitive data entry for the field containing the insertion point is to press CTRL+APOSTROPHE (') to retrieve the value from the previous record. Another technique is to use the AutoFillNewRecord()function described later in this article. You can call this function from a form's OnCurrent property event procedure to fill all the fields in a new record using data from the previous record. If you want to fill only selected fields, you can create a text box and set the DefaultValue property with a semicolon- delimited list of field names to automatically fill, for example:
Text box: Name: AutoFillNewRecordFields Visible: No DefaultValue: Phone;Company Name;City;State;ZipTo create and use the AutoFillNewRecord() function, follow these steps:
REFERENCESFor more information about the For Loop, search the Help Index for "For Each...Next Statement," or ask the Microsoft Access 97 Office Assistant.
|
Additional query words: default value tag duplicate copy carry forward keep
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |