Execute Module in Access Application

I have a module named

Public Function DeleteDuplicates()

How do I get this to run in my application?
mato01Asked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Connect With a Mentor Commented:
"Run-time error '3167:  Record is deleted."

Well ... that's really a different Question.  Close this Q and start a new Q ... posting the Code you have.

Macro ...yes - see image.

mx



Capture1.gif
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
One way ... in your code from where ever

Call DeleteDuplicates()

mx
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
And actually, just to keep the terminology straight, you have a Function in a Module.  Modules don't run or execute.  Functions (and Subs) do.

mx
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
mato01Author Commented:
Thanks for setting me straight on the terminology.

Ok. I placed Call DeleteDuplicates() behind a button. And, even though it does delete, it gives me the following error.

Run-time error '3167:  Record is deleted.

Also, can I run this from a Macro?

0
 
Jeffrey CoachmanMIS LiasonCommented:
<No Points wanted>

<And actually, just to keep the terminology straight>
...and a bit more.

Your public function must be in a standalone "Module" (not just in the code for a form or Report), in order to be called from a Macro.

Many people think that simply by making a function "Public" will make it accessible to a macro.

If a function is public, yes, it can be called from anywhere using "code"

But in order to be seen by a macro, it also has to be in a standalone module.

Again, just FYI, for clarity.

JeffCoachman
0
 
Jeffrey CoachmanMIS LiasonCommented:
But in order to be seen by a macro, it also has to be in a standalone module.
sb
But in order to be seen by a macro, the function also has to be in a standalone module and be Public
0
 
mato01Author Commented:
Thanks.  Went online for additional help. Once I compact and repaired the database everything was fine and the macro ran.
0
All Courses

From novice to tech pro — start learning today.