Compile Error: Variable Not Defined

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
 
J

Jamie

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
 
J

John McKee

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top