iknowkungfu
Registered User.
- Local time
- Today, 05:48
- Joined
- Jan 17, 2006
- Messages
- 24
My code is currently running the error handler even if I comment out every single line (apart from strErrMsg and On Error GoTo) in the code, which seems to run perfectly anyway!
This is just an example. The other subs/functions in the same module do the same thing. This is driving me crazy!
Code:
Function fDeleteXtabs()
'deletes xtab(n) queries 1-9
On Error GoTo fDeleteXtabs_Err
Dim strErrMsg As String
Dim intI As Integer
Dim strXtabName As String
'!-------Begin Querydef block
Dim db As DAO.Database
Dim qdfNew As DAO.QueryDef
Set db = CurrentDb()
'!-------End Querydef block
For intI = 1 To 9
strXtabName = "xtab" & intI
If ObjectExists("Query", strXtabName) Then 'prevents it trying to delete non-existent object
db.QueryDefs.Delete strXtabName
End If
Next intI
fDeleteXtabs_Err:
Select Case Err
Case Else
'File is open
strErrMsg = vbNullString
strErrMsg = "There has been a problem deleting one of the queries. "
MsgBox strErrMsg, vbCritical, "Output Error!"
Exit Function
End Select
End Function
This is just an example. The other subs/functions in the same module do the same thing. This is driving me crazy!