Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Public Const on a Form

Status
Not open for further replies.

mckenneyj

MIS
Jun 1, 2002
96
In the middle of a Brain Cramp
Seems I have forgotten how to do this

I have defined a Module named basCompanyInfo
In the module are several Public Const
Public Const AName = "xyz"
Public Const AStreet = "123 easy street"
Public Const ACSZ = "city, st, 11111"
Public Const APhone = "PHONE: (555) 666-7777"
Public Const AFax = "FAX: (555) 666-8888"
Public Const AURL = "
I need to be able to reference these constants on forms and reports
A little help would be appreciated

Thanks,
John McKenney
Work Hard... Play Harder
 
Use them just like a variable - but only the right hand side of an "=":

strName = AName

Just as a matter of style, most folk put constants in capitals and define the type of each constant:

Public Const ANAME As String = "xyz"

Geoff Franklin
 
I make global properties out of them:
Code:
Public Const APP_ICON As String = "MyApp.ico"

Public Property Get AppIcon() As String
  AppIcon = APP_ICON
End Property
Then on the form or report I can access them normally:
Code:
=AppIcon()

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Thanks
Both worked great
But I opted for defining Public Property

Thanks,
John McKenney
Work Hard... Play Harder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top