Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / July 2007

Tip: Looking for answers? Try searching our database.

Creating Modules

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KISSnACDC - 19 Jul 2007 20:38 GMT
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.
Scott McDaniel - 19 Jul 2007 22:41 GMT
>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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.