ACC2000: "Invalid Use of Null" Error When You Try to Add a Record to a Form in NorthwindCS.adp (221343)
The information in this article applies to:
This article was previously published under Q221343 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access project (.adp).
SYMPTOMS
When you try to assign the value of a control to some other object in a Microsoft Access project, you may receive the following error message:
Invalid use of Null
RESOLUTION
Use the IsNull function to verify the control's value before you assign the value to some other object. To see an example of how to do so, follow these steps. This example uses the Suppliers form in the sample project NorthwindCS.adp.
- Open the Suppliers form in Design view.
- View the OnCurrent property setting of the form, and note that it has [Event Procedure].
- Click the Build (...) button next to the OnCurrent property box to open the Private Sub Form_Current() event procedure.
The line of code that causes the error is:
strLinkCriteria = "SupplierID = " + CStr(Forms![Suppliers]![SupplierID])
- Place this line of code within a conditional statements. For example:
If Not IsNull(Forms![Suppliers]![SupplierID]) Then
strLinkCriteria = "SupplierID = " + CStr(Forms![Suppliers]![SupplierID])
End If
- Compile the code, close the Visual Basic Editor, and view the Suppliers form in Form view.
- Add a new record and note that the error message no longer occurs.
STATUSMicrosoft has confirmed that this is a problem in Microsoft Access 2000. REFERENCESFor more information about the IsNull function, click Microsoft Visual Basic Help on the
Help menu, type IsNull in the Office Assistant or
the Answer Wizard, and then click Search to view the topics
returned.
Modification Type: | Major | Last Reviewed: | 12/12/2002 |
---|
Keywords: | AccessCS kbbug KbClientServer kbdta KB221343 |
---|
|