ACC97: "Function isn't available in expressions..." Error MessageID: Q194374
|
Advanced: Requires expert coding, interoperability, and multiuser skills.
When you run a query, you may receive the following error message:
You may see a "#Name" error on forms and reports in controls that use an expression for the ControlSource property. This behavior can occur in forms, queries, or reports that use built-in functions in expressions, for example, the Format(), Left(), or Right() function.Function isn't available in expressions in query expression.
You referenced a type library on your development computer, and then moved
the database to a computer that has a newer version of the type library
installed.
NOTE: This issue most frequently involves references to COMCTL32.OCX, but
can occur with other type libraries.
To fix this problem, you need either the same version of the type library on your development computer and on other computers that will be using the database, or you can refresh the reference to the type library on the computers that will be using the database so that Microsoft Access recognizes the control. What follows are three methods that you can use to do this.
Query: qryTestRefs
------------------------------
Field: Expr1
------------
Value: Left([Category Name],1)
Macro Name Action
--------------------
AutoExec RunCode
Action Arguments
-------------------------
Function Name: CheckRefs()
Function CheckRefs()
Dim db As Database, rs As Recordset
Dim x
Set db = CurrentDb
On Error Resume Next
' Run the query qryTestRefs you created and trap for an error.
Set rs = db.OpenRecordset("qryTestRefs", dbOpenDynaset)
x=rs!expr1
' If you see error 3075, inform the users you have to fix
' the application. Error 3075 is the following:
' Function isn't available in expressions in query expression...
If Err.Number = 3075 Then
MsgBox "This application has detected newer versions " _
& "of required files on your computer. " _
& "It may take several minutes to recompile " _
& "this application."
Err.Clear
FixUpRefs
End If
End Function
Sub FixUpRefs()
Dim r As Reference, r1 As Reference
Dim s As String
' Look for the first reference in the database other
' than Access and Visual Basic for Applications.
For Each r In Application.References
If r.Name <> "Access" And r.Name <> "VBA" Then
Set r1 = r
Exit For
End If
Next
s = r1.FullPath
' Remove the Reference and add it back.
References.Remove r1
References.AddFromFile s
' Call a hidden SysCmd to automatically compile/save all modules.
Call SysCmd(504, 16483)
End Sub
Microsoft has confirmed this to be a problem in Microsoft Access 97.
When a type library is installed on a computer, specific information about it is placed in the Windows registry. Microsoft Access uses this registry information to reference and use the type library. Under normal conditions, installing a newer version of a type library on a computer has no effect on the programs that use it, but in some cases, changes to the type libraries cause them to be registered differently. When this happens, Microsoft Access can't use them until the new registry information is refreshed in the References collection.
Table: Table1
-------------------------------
Field Name: CategoryID
Data Type: Counter
Indexed: Yes (No Duplicates)
Field Name: CategoryName
Data Type: Text
Field Name: Location
Date Type: Text
Field Size: 20
Indexed: Yes (Duplicates OK)
Table Properties: Table1
------------------------------
PrimaryKey: CategoryID
Index1: CategoryName; Location
EXPR1: Format([CategoryID], " #")
Visual Basic For Applications
Microsoft Access 8.0 Object Library
Microsoft DAO 3.5 Object Library
Microsoft Common Dialog Control 5.0
Microsoft Windows Common Controls 5.0
Function isn't available in expressions in query expression
'Format([CategoryID], " #")'
For more information about references, search the Help Index for "References collection," or ask the Microsoft Access 97 Office Assistant.
Additional query words: typelib activex
Keywords : kberrmsg kbdta IntpCstm OdeGen
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 13, 1999