Connecting Tech Pros Worldwide Forums | Help | Site Map

Declare a varable for the entire database

Newbie
 
Join Date: Sep 2008
Posts: 31
#1: Nov 19 '08
I am trying to declare a maximum # of characters that can be inputted into multiple Memo fields. I have a len counter displaying the # of characters.

When the count gets to 10 lets say I want a msgbox to pop up. This is working. Instead of saying:
if lencounter >10 then
Msgbox "You have reached the maxium # of characters"
I would like to set the maximum # of characters once globally so my code would read.
if lencounter >MaxChar then
Msgbox "You have reached the maxium # of characters"
And I would declare the following:
Dim MaxChar as integer
MaxChar = 10

RuralGuy's Avatar
Expert
 
Join Date: Oct 2006
Posts: 194
#2: Nov 19 '08

re: Declare a varable for the entire database


That is done in a standard module (not a form module) before any procedures. You could also use a constant. The Help system can assist you here.
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,218
#3: Nov 19 '08

re: Declare a varable for the entire database


As indicated by RuralGuy, in a Standard Code Module:
Expand|Select|Wrap|Line Numbers
  1. Public Const conMAX_NUM_OF_CHARACTERS As Integer = 10
Reply