Solved

Execute Module in Access Application

Posted on 2011-09-20
7
392 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

739 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