98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access Training and help » VBA declaring Public variables for use with forms -question for
VBA declaring Public variables for use with forms -question for
Resolved · Low Priority · Version 2007
Kathy has attended:
Access Introduction course
Access Intermediate course
Access VBA course
Excel Advanced - For Power Users course
VBA declaring Public variables for use with forms -question for
Hi,
Please can you tell me how I can use Public variables in Access VBA, if I'm working with forms, and giving the variables their values in the form modules.
I've tried declaring the variable in the form modules and in the standard modules. But if the variable gets its value from the form controls and I try to use it in the other modules, it results in a message that the variable is not defined.
I have also experienced this working with forms and with ActiveX controls in Excel.
I have a work-around in Excel, but it would be good to know how to make the Public dimensioning work properly in Access.
RE: VBA declaring Public variables for use with forms -question
Hi Kathy, thanks for your query. The trick is to declare the public variable in a standard module rather than one of the form modules:
http://bytes.com/topic/access/answers/726791-using-global-variables-access-vb-form-modules
Try setting the variable up, then loading it with a value from form 1 and passing it to a control of form 2. Let me know if you encounter any problems with this.
Hope this helps,
Anthony
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Insert The Current DateTo insert the current date into a Table field or Form Text box use: |