Compile Error: Variable Not Defined

  • Thread starter Thread starter John McKee
  • Start date Start date
J

John McKee

In a function that's been working perfectly for years,
after some modifications to the database, suddenly it's
throwing the subject error. Here's the function, as
provided by Getz et al in Access 97 Developer's Handbook:

Function IsLoaded(ByVal strFormName As String) As Boolean
' Returns True if the specified form is open in Form view
or Datasheet view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName)
<> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView
Then
IsLoaded = True
End If
End If

End Function


The strFormName is highlighted at the error. It's
declared as the Function's input parameter.

Any ideas where to check to fix this?


TIA,


John
 
Check all the references. (Tools - References in VBA editor) If they're all
intact then it could be a corruption issue - import all the objects (forms,
modules, tables etc) into a new mdb file. (Select File - GetExternal Data -
Import) and then restore any references in the new mdb. Recompile your code
again to see if the error remains.

Jamie
 
Thanks Jamie. That did the trick. Of course I had to
work through the compile errors mainly due to not
declaring my databases and recordsets as DAO (it's an
old '97 app). All is well again.

John
 
Back
Top