G
Guest
Hi,
I'm sure this is an easy one, but I'm not really up on code.
I have the following code that I picked up from this discussion board, which
works perfectly in the database I first used it in. It is very helpful to me
as it gets rid of any ImportErrors tables I might have (I generate quite a
lot of these as my header/footer records differ from the data records).
However, when I copy the function (as part of a module) into another
database and attempt to run/compile I get:
"Compiler Error: User defined type not defined" on the line that reads
"Dim db As Database"
Could someone please offer some idiot-proof advice on how to correct this?
Be aware that you're dealing with a reasonably high-standard of idiot, but a
poor standard of DBA
Thnaks in advance,
Mike
Function Delete_ImportErrors()
Dim db As Database
Dim tdf As TableDef
Set db = CurrentDb
For Each tdf In db.TableDefs
If tdf.Name Like "*_ImportErrors*" Then
DoCmd.DeleteObject acTable, tdf.Name
End If
Next
End Function
I'm sure this is an easy one, but I'm not really up on code.
I have the following code that I picked up from this discussion board, which
works perfectly in the database I first used it in. It is very helpful to me
as it gets rid of any ImportErrors tables I might have (I generate quite a
lot of these as my header/footer records differ from the data records).
However, when I copy the function (as part of a module) into another
database and attempt to run/compile I get:
"Compiler Error: User defined type not defined" on the line that reads
"Dim db As Database"
Could someone please offer some idiot-proof advice on how to correct this?
Be aware that you're dealing with a reasonably high-standard of idiot, but a
poor standard of DBA
Thnaks in advance,
Mike
Function Delete_ImportErrors()
Dim db As Database
Dim tdf As TableDef
Set db = CurrentDb
For Each tdf In db.TableDefs
If tdf.Name Like "*_ImportErrors*" Then
DoCmd.DeleteObject acTable, tdf.Name
End If
Next
End Function