Wortz, Charles
CWortz at tea.state.tx.us
Thu Aug 7 11:25:31 CDT 2003
Julie, The problem with Public variables on forms is that the form must be open to use them. Remember, forms are instances of the class form. When you open a form you are instantiating a class object. When you close a form you are destroying a class object. That is why Gustav wants you to move them to a standard module, since there is no such restriction on public variables in standard modules. Charles Wortz Software Development Division Texas Education Agency 1701 N. Congress Ave Austin, TX 78701-1494 512-463-9493 CWortz at tea.state.tx.us -----Original Message----- From: Julie Reardon-Taylor [mailto:prosoft6 at hotmail.com] Sent: Thursday 2003 Aug 07 11:01 To: accessd at databaseadvisors.com Subject: [AccessD] Public Variables in a Report Okay, Gustav gave me some information about using public variables, and said that I have to move my variables from the code behind the form to a module in order to be able to see the value of those variables in a report. However, I found, in an Access 2000 programming book, that I supposedly can use the public variable anywhere within the project if I reference the form first and then the variable name. Anyone have experience doing this? Here is an example: Me.hours111 = frmpayroll.f_shift_hours3 + frmpayroll.f_shift_hours2 + frmpayroll.f_shift_hours1 The Me.hours111 references the unbound text box on my report. The other items that I am trying to add are declared as public variables in the general section of the code behind the form named frmPayroll. Access tells me that it cannot find the variable. Help! Julie Reardon-Taylor PRO-SOFT OF NY, INC. www.pro-soft.net