S
Sharon
When I open my Access 2003 database, I receive an immediate error: “Invalid
procedure call or argumentâ€. The problem appears to be the code regarding
the Open_Reporter (see code below). I have a module named “Login Code†with
the code as shown below. I have checked to make sure that all the forms
exist, that there are no missing references etc. but just can’t figure out
what the problem is. If someone could give me some idea where to start it
would be extremely helpful. Thanks in advance.
Function ObjectExists(ObjType As Integer, ObjName As String) As Boolean
'Purpose: Determines whether or not a given object exists in database
'Example: If ObjectExists(acTable, "tblOrders") then ...
On Error Resume Next
Dim db As Database
Dim strTemp As String, strContainer As String
Set db = CurrentDb()
Select Case ObjType
Case acTable
strTemp = db.TableDefs(ObjName).Name
Case acQuery
strTemp = db.QueryDefs(ObjName).Name
Case acMacro, acModule, acForm, acReport
Select Case ObjType
Case acMacro
strContainer = "Scripts"
Case acModule
strContainer = "Modules"
Case acForm
strContainer = "Forms"
Case acReport
strContainer = "Reports"
End Select
strTemp = db.Containers(strContainer).Documents(ObjName).Name
End Select
ObjectExists = (Err.Number = 0)
End Function
__________________________________________________________
Function SQL_Link_ok() As Boolean
SQL_Link_ok = False
On Error GoTo ERROR
If Not ObjectExists(acQuery, "qrySQLTables") Then Exit Function
If IsNull(DLookup("Name", "qrySQLTables", "'ProfileFields'")) Then
Exit Function
Else
SQL_Link_ok = True
End If
ERROR:
End Function
_______________________________________________________
Function Open_Reporter()
If SQL_Link_ok Then
DoCmd.OpenForm "frmMainMenu", acNormal, "", "", , acNormal
DoCmd.Maximize
DoCmd.Close acForm, "frmOpen"
Else
DoCmd.OpenForm "frmConnect", acNormal, "", "", , acNormal
End If
Open_Reporter = 0
End Function
procedure call or argumentâ€. The problem appears to be the code regarding
the Open_Reporter (see code below). I have a module named “Login Code†with
the code as shown below. I have checked to make sure that all the forms
exist, that there are no missing references etc. but just can’t figure out
what the problem is. If someone could give me some idea where to start it
would be extremely helpful. Thanks in advance.
Function ObjectExists(ObjType As Integer, ObjName As String) As Boolean
'Purpose: Determines whether or not a given object exists in database
'Example: If ObjectExists(acTable, "tblOrders") then ...
On Error Resume Next
Dim db As Database
Dim strTemp As String, strContainer As String
Set db = CurrentDb()
Select Case ObjType
Case acTable
strTemp = db.TableDefs(ObjName).Name
Case acQuery
strTemp = db.QueryDefs(ObjName).Name
Case acMacro, acModule, acForm, acReport
Select Case ObjType
Case acMacro
strContainer = "Scripts"
Case acModule
strContainer = "Modules"
Case acForm
strContainer = "Forms"
Case acReport
strContainer = "Reports"
End Select
strTemp = db.Containers(strContainer).Documents(ObjName).Name
End Select
ObjectExists = (Err.Number = 0)
End Function
__________________________________________________________
Function SQL_Link_ok() As Boolean
SQL_Link_ok = False
On Error GoTo ERROR
If Not ObjectExists(acQuery, "qrySQLTables") Then Exit Function
If IsNull(DLookup("Name", "qrySQLTables", "'ProfileFields'")) Then
Exit Function
Else
SQL_Link_ok = True
End If
ERROR:
End Function
_______________________________________________________
Function Open_Reporter()
If SQL_Link_ok Then
DoCmd.OpenForm "frmMainMenu", acNormal, "", "", , acNormal
DoCmd.Maximize
DoCmd.Close acForm, "frmOpen"
Else
DoCmd.OpenForm "frmConnect", acNormal, "", "", , acNormal
End If
Open_Reporter = 0
End Function