paulmcdonnell
Ready to Help
- Local time
- Today, 08:46
- Joined
- Apr 11, 2001
- Messages
- 167
Hi guys
I have a code module which declares public variables when the database opens…
Option Compare Database
'set variables
'set public variable
Public OffersDataSource As Variant
Public SetPropertyID As Integer
'For OUTLOOK AUTOMATION OF APPOINTMENTS
Public ASTARTDATE, ASTARTTIME, AENDTIME As Date
Public ADURATION, ABODY, ALOCATION, ATITLE, ASUBJECT As Variant
Public MailboxID As Variant
Public Emailto As Variant
Public who As String
As I understand it these variables are available to the database and can be used in any private functions.
I have a routine that adds an appointment to an outlook diary.
The first instance that the code is run the variable “Mailbox”, which is set to a variable when the database opens is used and all works fine the appointment added.
If I try to run the code a second time the variable is now “”.
Nothing in my code resets this variable that I can see. It should still be there for a second use surely?
How do I set a variable when the database starts up and then be able to use and reuse this variable again and again until I reset it or set it to “”?
Also when does my module with my public variable execute. This is the only thing I can see that would reset this variable. If my ON click event is initiating the module event above how can I set a variable once and keep it from being reset (it must be public and open to many prodecures though?)
Hope you can help
Cheers
Paul
I have a code module which declares public variables when the database opens…
Option Compare Database
'set variables
'set public variable
Public OffersDataSource As Variant
Public SetPropertyID As Integer
'For OUTLOOK AUTOMATION OF APPOINTMENTS
Public ASTARTDATE, ASTARTTIME, AENDTIME As Date
Public ADURATION, ABODY, ALOCATION, ATITLE, ASUBJECT As Variant
Public MailboxID As Variant
Public Emailto As Variant
Public who As String
As I understand it these variables are available to the database and can be used in any private functions.
I have a routine that adds an appointment to an outlook diary.
The first instance that the code is run the variable “Mailbox”, which is set to a variable when the database opens is used and all works fine the appointment added.
If I try to run the code a second time the variable is now “”.
Nothing in my code resets this variable that I can see. It should still be there for a second use surely?
How do I set a variable when the database starts up and then be able to use and reuse this variable again and again until I reset it or set it to “”?
Also when does my module with my public variable execute. This is the only thing I can see that would reset this variable. If my ON click event is initiating the module event above how can I set a variable once and keep it from being reset (it must be public and open to many prodecures though?)
Hope you can help
Cheers
Paul