FIX: Referencing Data Object Gives Error: Object not an Array (100367)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q100367 SYMPTOMS
An "Object not an Array" error results when you reference a field of a
dynaset, table, or snapshot object in a form or module that does not
contain a Set statement for that dynaset, table, or snapshot. The error
occurs when Visual Basic attempts to compile your program.
CAUSE
This error is caused by a parsing problem in the Visual Basic programming
environment. The Visual Basic parser does not recognize the object type
because there is no Set statement in the same form or module.
WORKAROUND
Add a dummy Sub procedure to each form or module, and use a Set statement
that refers to the global database / table / dynaset in a meaningful way
(for example, Set myds = db.CreateDynaset(...) not set myDs = myDs). Give
the Sub procedure a name like 'AAAAA_Fix_Parser' so it becomes the first
code parsed in that form or module. Make sure the dynaset set in the dummy
Sub procedure is the exact same dynaset that is causing the problem.
When adding more than one dummy Sub procedure to a project, give each Sub
procedure a different name (AAAAA1, AAAAA2, and so on) to avoid name
collisions that could complicate your existing problem.
For example, use the following dummy procedure if MyDs is the dynaset
causing the problem:
Sub AAAAAA_Fix_Parser
Set MyDs = MyDB.CreateDynaset("...")
End Sub
You never need to execute the code in the Sub procedure or even call the
Sub procedure. Once you add the Sub procedure, the parser sees the Set
statement(s) before it tries to parse any other code, so it does not have
trouble with the global objects. After adding the Sub procedure, you do not
have to tweak the code every time you reload the project; you can do it
once and save it.
STATUS
Microsoft has confirmed this to be a bug in Microsoft Visual Basic version
3.0 for Windows. This bug was corrected in Microsoft Visual Basic version
4.0 for Windows.
Modification Type: | Major | Last Reviewed: | 10/28/2003 |
---|
Keywords: | kbbug kbfix KB100367 |
---|
|