Public var not works in 2000 not 2003

wjburke2

Registered User.
Local time
Today, 08:49
Joined
Jul 28, 2008
Messages
194
I have created a form using Access 2000. I declare a public variable

Public lngStartDate as long

I set the variable to 20070101.

I then open a subform based on a query. The criteria for the query is ...WHERE iDate = Forms!frmMyForm.lngStartDate.

The form opens fine and I get the expected data in 2000.

My problem is that when I do the same thing using Access 2003, I am prompted for Forms!frmMyForm.lngStartDate when the form opens.

Any help would be appreciated. :rolleyes:
 
hmm interesting
usualy what comes after a dot in a construct like Forms!formname. is either a control name or a form property , i wonder how it works other than that.

however i would suggest that you declare global variables (AKA Public Variables) in Modules for the mater of cross forms trading and then you could retrieve variable value every form its called on at no extra hassels.
 
Thanks nIGHTmAYOR, have they changed that in Access 2003? Access as in VB advertises that you can declare a variable in the general declarations section of a form. that will be available only in that form and its sub forms.

I am somewhat new so excuse the ignorance. We all have two monitor systems. My idea was the user could open several forms if they desire. One form to lookup and another in modify. This date is used in several forms and reports for filtering. If someone changes a public variable in say a form/report will everyone see that change? Actually, they can print reports from several forms. How do I make it available to only that process.

Has anyone used the Friend type? And do you know how that works?
 
oh i see , u r quite confused .. ok let me put some fundamentals to your quest:
have they changed that in Access 2003? Access as in VB advertises that you can declare a variable in the general declarations section of a form. that will be available only in that form and its sub forms.
1 - they havent changed it , yet it might be that you have discovered some hidden bug that was solved in later releases (the story of my life)
We all have two monitor systems. My idea was the user could open several forms if they desire. One form to lookup and another in modify. This date is used in several forms and reports for filtering. If someone changes a public variable in say a form/report will everyone see that change? Actually, they can print reports from several forms. How do I make it available to only that process.
2 -variables (Global / Public / Private) are all project specific (ie not available to other project running on your pc or others even if connected to same backend database)

3 - the norm in access programing is that you set variable per form to become form specific (Public or Private), yet if needed to be accessed through different areas of project you need to declare it in a module (yes modules are global) just the same way you declare it in a form.

4 - there must be other undocumented methodes mind you documented but unpopuler ones as to how to achieve your request yet its all up to you to dig , but till then stick to the norm :)
 
nIGHTmAYOR,
I appreciate your taking the time to explain that to me. I am still new to Access. I am frustrated that 2000 code will not work on machines with 2003. We have decided to upgrade to Access 2007. I am hoping the bug is gone in that version. If it works its worth a couple of hundred bucks not having to change all my screens. If not I have found that creating a text field on the screen and doing a fully qualified reference will work (Forms!myform!txtfield).
 
Last edited:

Users who are viewing this thread

Back
Top Bottom