By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,374 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Calling a module from a form command button

P: n/a
Hey:

I have created a module that runs fine. I am trying to put all my modules
on a form. I cannot get the modules to run from the command buttons.
The error I get is

Compiler error:

Expected variable or procedure not a module. The module code will run fine
if I move it all to the form. I was told it was best practice to use
modules for my code.

I have tried using db1.xxx with no success. It has to be simple what am I
missing.

Private Sub cmdConsolidateTables_Click()
db1.Consolidate_Tables ' will not run here
End Sub

C. Pete Staman

--
Message posted via http://www.accessmonster.com
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Modules don't "run." The Subs and Functions inside the modules run.

The syntax for calling a sub/function in a module is:

moduleName.sub_functionName parameters

If your Consolidate_Tables routine were in a module called "Utilities"
you'd call the routine like this:

Utilities.Colsolidate_Tables
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQmmXPYechKqOuFEgEQKN4gCePXAQxptlQ2huC9I78YgfZw d1qusAn1zO
AKO+ZVdIfdnpINy329HtVtvl
=tbrL
-----END PGP SIGNATURE-----
Pete Straman Straman via AccessMonster.com wrote:
Hey:

I have created a module that runs fine. I am trying to put all my modules
on a form. I cannot get the modules to run from the command buttons.
The error I get is

Compiler error:

Expected variable or procedure not a module. The module code will run fine
if I move it all to the form. I was told it was best practice to use
modules for my code.

I have tried using db1.xxx with no success. It has to be simple what am I
missing.

Private Sub cmdConsolidateTables_Click()
db1.Consolidate_Tables ' will not run here
End Sub

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.