non-declared variable working

elsandalos

Registered User.
Local time
Today, 21:11
Joined
Jan 27, 2004
Messages
22
Hi all,
got a weird one here:

I've got a popup form whose contents are updated as the records are changed on another form (through Form_Current). This is working ok, but i'm trying to use a public variable so that the main form knows not to invoke a requery on the popup form if it isn't open. Basically the variable is toggled between 1 and 0 depending on the status of the popup form.

Anyway, it's not working and it looked like my public variable was holding two different values simulataneously (i'm checking using Msgbox <var>). Whilst debugging i noticed that even with no delcaration, access is quite happy for you to do:

vartest = 1

msgbox vartest

without actually declaring vartest anywhere :confused:

I would expect an error with no declaration, as access doesn't know what vartest is without one. This is making debugging rather difficult, any ideas?

El.
 
Do you have Option Explicit written at the top of your modules?
 
SJ McAbney said:
Do you have Option Explicit written at the top of your modules?

Nope - Option Compare Database

ah - just read the helpfile. Thanks for the pointer!

El.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom