Make It A Module

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

Is there a way that I can turn this into a module or a function.....or
something so that I can call it. As opposed to writing this code over and
over again.
Thanks
DS
 
I don't know what the "this" is, but you can define a PUBLIC SUB in a module
and then call it from anywhere (except a query; for that you'd need a PUBLIC
FUNCTION).
 
DS said:
Is there a way that I can turn this into a module or a function.....or
something so that I can call it. As opposed to writing this code over and
over again.
Thanks
DS

Turn what into a function?
 
Is there a way that I can turn this into a module or a function.....or
something so that I can call it. As opposed to writing this code over and
over again.
Thanks
DS

A Module (using the Modules tab on the database window) is a container for
multiple Subs and Functions. You can copy the VBA text of a function into a
Module; be sure its first row is something like

Public Function <some function name...>

and you'll be able to reference it from anywhere in the database.

Just be sure to give the Module a DIFFERENT name than the name of the
function. That is, if you have Public Function MyStuff(this, that, theother)
then don't save the module as MyStuff; Access will get confused. Use something
like basMyStuff or Utilities as the name of the module instead.
 
Thanks John, I'm on my way. Tired me! I forgot to put what "This" is as
pointed out by another poster. In any case I'm on my way. Thanks
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Is it possible to automate repetive coding 2
Run Module 6
Module Question 7
Code behind objects or in separate VBA modules 1
Shared Modules? 1
Module or Class Module 4
Ref a Function 3
Access Modules empty 0

Back
Top