INF: Forms Questions & Answers
  
PSS ID Number: Q104387
Article last modified on 02-07-1995
 
1.00 1.10
 
WINDOWS
 

---------------------------------------------------------------------
The information in this article applies to:
 
 - Microsoft Access versions 1.0 and 1.1
---------------------------------------------------------------------
 
======================================================================
  Microsoft 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, 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  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
KBCategory: kbusage kbfasttip kbappnote
KBSubcategory: FstQa
=============================================================================
Copyright Microsoft Corporation 1995.
