Creating Modules

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I create a new module?
I've tried so many things and no matter what I type in the module, it's wrong.

Assume I haven't tried anything (be detailed), I just need to know what I'm
missing.
 
How do I create a new module?
I've tried so many things and no matter what I type in the module, it's wrong.

Do you mean a Standard Module? You can create one from the database window (the one with the listing of the Tables,
Forms, etc) by clicking Modules, then New ... this will create a new Standard Module named Module1. You can rename it,
of course.

From there you'd add your Subs and Functions. A Sub or Function always has a Header and Footer:

Sub MySub()
<your code here>
End Sub

Function MyFunction(SomeInputValue As String) As Boolean
<your code here>
End Function

You can also add Constants and such at the beginning, in the General Declarations section:

Private mflgDirty As Boolean

Const conIsNew As Long = 1

Unlike a Class module, you don't need to do anything special to call a Sub or Function from a Module, you simply do
this:

If MyFunction("Tommy Boy") Then
MsgBox "Right On!!"
End If
Assume I haven't tried anything (be detailed), I just need to know what I'm
missing.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 

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


Back
Top