B
Bill B
I keep getting the error " Object variable or With block variable not set"
with running this function and the "ref_intOpenDatabase_CurrentDB" getsa
called.
Is there any otehr way to open an database other then like I am??
*****************
Function ref_intOpenDatabase(ByVal pstrDB As String) As Integer
On Error GoTo ref_intOpenDatabase_Err
Dim intRet As Integer
Dim strCurrDB As String
Const NO_DB_OPEN = 7952 '= Illegal function Call - no current
database
' special error handler to catch when no database is opened.
On Error GoTo ref_intOpenDatabase_CurrentDB
strCurrDB = mappAccess.CurrentDb.Name()
On Error GoTo ref_intOpenDatabase_Err
If strCurrDB <> pstrDB Then
mappAccess.CloseCurrentDatabase
End If
ref_intOpenDatabase_OPEN:
mappAccess.OpenCurrentDatabase mstrAccappPath & pstrDB, False
intRet = True
ref_intOpenDatabase_Exit:
ref_intOpenDatabase = intRet
Exit Function
ref_intOpenDatabase_Err:
intRet = False
MsgBox "_Err Error: " & Error$, vbExclamation, "ref_intOpenDatabase()"
Resume ref_intOpenDatabase_Exit
ref_intOpenDatabase_CurrentDB:
If Err = NO_DB_OPEN Then
Resume ref_intOpenDatabase_OPEN
Else
intRet = False
MsgBox "_CurrentDB Error: " & Error$, vbExclamation,
"ref_intOpenDatabase()"
Resume ref_intOpenDatabase_Exit
End If
End Function
*******************
Bill
with running this function and the "ref_intOpenDatabase_CurrentDB" getsa
called.
Is there any otehr way to open an database other then like I am??
*****************
Function ref_intOpenDatabase(ByVal pstrDB As String) As Integer
On Error GoTo ref_intOpenDatabase_Err
Dim intRet As Integer
Dim strCurrDB As String
Const NO_DB_OPEN = 7952 '= Illegal function Call - no current
database
' special error handler to catch when no database is opened.
On Error GoTo ref_intOpenDatabase_CurrentDB
strCurrDB = mappAccess.CurrentDb.Name()
On Error GoTo ref_intOpenDatabase_Err
If strCurrDB <> pstrDB Then
mappAccess.CloseCurrentDatabase
End If
ref_intOpenDatabase_OPEN:
mappAccess.OpenCurrentDatabase mstrAccappPath & pstrDB, False
intRet = True
ref_intOpenDatabase_Exit:
ref_intOpenDatabase = intRet
Exit Function
ref_intOpenDatabase_Err:
intRet = False
MsgBox "_Err Error: " & Error$, vbExclamation, "ref_intOpenDatabase()"
Resume ref_intOpenDatabase_Exit
ref_intOpenDatabase_CurrentDB:
If Err = NO_DB_OPEN Then
Resume ref_intOpenDatabase_OPEN
Else
intRet = False
MsgBox "_CurrentDB Error: " & Error$, vbExclamation,
"ref_intOpenDatabase()"
Resume ref_intOpenDatabase_Exit
End If
End Function
*******************
Bill