Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

Execute Module in Access Application

I have a module named

Public Function DeleteDuplicates()

How do I get this to run in my application?
0
mato01
Asked:
mato01
  • 3
  • 2
  • 2
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
One way ... in your code from where ever

Call DeleteDuplicates()

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
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
 
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
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now