ACC: "Expected Function or Variable" Error Message (145705)
The information in this article applies to:
- Microsoft Access for Windows 95 7.0
- Microsoft Access 97
This article was previously published under Q145705
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you run or compile a procedure in a Microsoft Access database that
references a field with the same name as a data-access method on a
Recordset object, you may receive one of the following error messages:
Expected Function or variable
Argument not optional
Type Mismatch
CAUSE
You used the dot (.) syntax when you referenced a field with the same name
as a data-access method on a Recordset object. For example, you may have a
field called "Close" that is preceded with a dot:
Function Test()
Dim db As DATABASE, tb As Recordset, x As Variant
Set db = CurrentDb
Set tb = db.OpenRecordset("Table1")
x = x + tb.[Close]
End Function
RESOLUTION
Modify the procedure to use the exclamation point (!) syntax in the
reference, for example:
Function Test()
Dim db As DATABASE, tb As Recordset, x As Variant
Set db = CurrentDb
Set tb = db.OpenRecordset("Table1")
x = x + tb![Close]
End Function
STATUS
This behavior is by design.
REFERENCES
For more information about naming conventions, search the Help Index for
"naming conventions," or ask the Microsoft Access 97 Office Assistant.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kberrmsg kbprb kbProgramming KB145705 |
---|
|