Solved

Execute Module in Access Application

Posted on 2011-09-20
7
396 Views
Last Modified: 2012-05-12
I have a module named

Public Function DeleteDuplicates()

How do I get this to run in my application?
0
Comment
Question by:mato01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 75
ID: 36569207
One way ... in your code from where ever

Call DeleteDuplicates()

mx
0
 
LVL 75
ID: 36569213
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
 

Author Comment

by:mato01
ID: 36569314
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 125 total points
ID: 36569354
"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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36569993
<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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36570008
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
 

Author Closing Comment

by:mato01
ID: 36570968
Thanks.  Went online for additional help. Once I compact and repaired the database everything was fine and the macro ran.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question