Deleting Import error tables

Ver101

Board Regular
Joined
Sep 2, 2011
Messages
190
Hi Guys,

Im getting an error when when i apply a code to delete import error tables, here is the error:

Microsoft Office Access cant find the name 'DeleteImportErrTables' you entered in the expression.

You may have specified a control that was'nt on the current object without specifying the correct form or report context.

to refer a control on another form or report, precede the control name with the name of collection.................................


Here is the code: in the standard module


Function DeleteImportErrTables()
Dim z As Integer
Dim db As DAO.Database

Set db = CurrentDb
For z = db.TableDefs.Count - 1 To 0 Step -1
If InStr(1, db.TableDefs(z).Name, "ImportError") > 0 Then
DoCmd.DeleteObject acTable, db.TableDefs(z).Name
End If
Next z
End Function


I hope somebody can help....:(
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How are you calling this function?
 
Upvote 0
What I mean is when you say you get an error when you apply the code, how do you apply the code? From a form? Another module? Event trigger? etc. The problem is that Access can't "find" your function. So we must figure out why Access can't "find" it.
 
Upvote 0
What I mean is when you say you get an error when you apply the code, how do you apply the code? From a form? Another module? Event trigger? etc. The problem is that Access can't "find" your function. So we must figure out why Access can't "find" it.
I think on the event trigger, when I was in the macro, macro action: run code, function: DeleteImportErrTables and I click run (big red !) that's where the error, do I missed something?
 
Upvote 0
What version of Access are you using?

Note: If possible, for run function type the function name with two parentheses following ...
DeleteImportErrTables()
 
Upvote 0
What version of Access are you using?

Note: If possible, for run function type the function name with two parentheses following ...
DeleteImportErrTables()
I'm using access 2007, I think I have already did that, still I'm getting an error.
 
Upvote 0
Works fine for me. Not sure. Double check you've dotted your i's and crossed your t's -- function is public, in a standard module, use parenthesis after the function name in the macro dialog, and be sure it is spelled correctly.

sample (working) database:
<a href="http://northernocean.net/etc/mrexcel/20120209_Database7.zip">Database</a>
sha256sum (zip file): 5680767f9f36e242e8e6f95232a2ff985f335a10342faed1dcf2c53265e6f17c
 
Upvote 0
Works fine for me. Not sure. Double check you've dotted your i's and crossed your t's -- function is public, in a standard module, use parenthesis after the function name in the macro dialog, and be sure it is spelled correctly.

sample (working) database:
Database
sha256sum (zip file): 5680767f9f36e242e8e6f95232a2ff985f335a10342faed1dcf2c53265e6f17c

Thanks it works.
 
Upvote 0

Forum statistics

Threads
1,221,604
Messages
6,160,748
Members
451,670
Latest member
Peaches000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top