Re: Boolean variable not holding state
- From: Bob Quintal <rquintal@xxxxxxxxxxxxx>
- Date: Wed, 14 May 2008 19:29:56 -0400
"Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx> wrote in
news:ejE5vSgtIHA.4772@xxxxxxxxxxxxxxxxxxxx:
You've declared validate inside of btnSaveRecord_Click. That meansEven with Option Explicit the sub does not generate any error.
you can only refer to that variable inside that routine.
To declare a variable that can be used by all routines within the
module, declare the variable at the top of the module before any
code.
The fact, though, that you're not getting an error implies that
you haven't told Access to require that all variables be declared.
Go into the VB Editor and select Tools | Options from the menu.
Make sure that the "Require Variable Declaration" box is checked
on the Editor tab. If you had done that, then you'd have quickly
realized that your sub validateAccount knew nothing about the
variable validate.
The reason he's not getting an error is that he's used the
implicitly defined variant validate in the function by treating it
as a parameter.
The actual problem is that he's put validate inside parentheses, and
I don't know why, but that seems to prevent the call from changing
the variable
'This works:
validateAccount validate
'This does not:
validateAccount (validate)
--
Bob Quintal
PA is y I've altered my email address.
** Posted from http://www.teranews.com **
.
- Follow-Ups:
- Re: Boolean variable not holding state
- From: Douglas J. Steele
- Re: Boolean variable not holding state
- From: Graham Mandeno
- Re: Boolean variable not holding state
- References:
- Boolean variable not holding state
- From: Jordan C. Schroeder
- Re: Boolean variable not holding state
- From: Douglas J. Steele
- Boolean variable not holding state
- Prev by Date: Re: Form Requery Not Working
- Next by Date: RE: Adding previous year value to a form automatcally(and updating tab
- Previous by thread: Re: Boolean variable not holding state
- Next by thread: Re: Boolean variable not holding state
- Index(es):
Relevant Pages
|