The information in this article applies to:
SYMPTOMSIf a Data control references the Recordset property in the Form_Load event or anytime BEFORE the Form_Activate event, you will receive the following error message (Error#91): You can also receive the "Object variable not set" error with the Data control, without necessarily being in a Form-Load event, if you assign the Recordsource property to a table name without quotation marks and then do an addnew. For example:
CAUSEThe RecordSet property of a Data Control is not resolved until after the form has been loaded -- that is, after the Form_Load event. This means that you cannot issue any method such as MoveNext or FindNext of the Data Control that uses its record set (its internal Dynaset). RESOLUTIONTo prevent the error, force the creation of the internal dynaset in the data control by issuing the Refresh method:
This will validate the RecordSet property allowing you to use methods that
require this.
STATUSThis behaviour is by design. MORE INFORMATIONNOTE: This problem also occurs in Visual Basic for Applications when you define an object and don't use it. In the General Declarations section of your the code, where the variable is dimmed as an Object, as in the following:
comment out or delete this.Also, if "X" is set to something, for example
and is not used later in the procedure, then comment out or delete this
line as well.
Steps to Reproduce Behavior
Additional query words: 3.00
Keywords : |
Last Reviewed: September 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |