M
mls via AccessMonster.com
Below code ran fine in my A2003 but after moving to 2007 it is failing at the
following line..
strTableNameCheck = CurrentDb.TableDefs(TableName)
Do I need to add any references to make this run successfully?
Thanks
*****************************************
Function TableExists(TableName As String) As Boolean
Dim strTableNameCheck
On Error GoTo ErrorCode
'try to assign tablename value
strTableNameCheck = CurrentDb.TableDefs(TableName)
'If no error and we get to this line, true
TableExists = True
ExitCode:
On Error Resume Next
Exit Function
ErrorCode:
Select Case Err.Number
Case 3265 'Item not found in this collection
TableExists = False
Resume ExitCode
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical,
"hlfUtils.TableExists"
'Debug.Print "Error " & Err.number & ": " & Err.Description &
"hlfUtils.TableExists"
Resume ExitCode
End Select
End Function
following line..
strTableNameCheck = CurrentDb.TableDefs(TableName)
Do I need to add any references to make this run successfully?
Thanks
*****************************************
Function TableExists(TableName As String) As Boolean
Dim strTableNameCheck
On Error GoTo ErrorCode
'try to assign tablename value
strTableNameCheck = CurrentDb.TableDefs(TableName)
'If no error and we get to this line, true
TableExists = True
ExitCode:
On Error Resume Next
Exit Function
ErrorCode:
Select Case Err.Number
Case 3265 'Item not found in this collection
TableExists = False
Resume ExitCode
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical,
"hlfUtils.TableExists"
'Debug.Print "Error " & Err.number & ": " & Err.Description &
"hlfUtils.TableExists"
Resume ExitCode
End Select
End Function