Make It A Module

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
 
D

Dennis

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).
 
S

Stuart McCall

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?
 
J

John W. Vinson

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.
 
D

DS

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
Module or Class Module 4
Run Module 6
Module Question 7
Retreive Variable Value from Module 3
Ref a Function 3
Call Module from SQL 5
Class module 6

Top