Global variables losing contents

striker

Useless and getting worse
Local time
Today, 23:21
Joined
Apr 4, 2002
Messages
65
This is driving me crazy. I have declared my variables as public within a module which contains a some functions.

I am then using some of the variables from a form procedure. The variables which are referenced from the form have all lost their contents when i need to use them in the module functions. Has anyone got any ideas on how to stop this or get round it.
 
Put them on a hidden form which remains open for as long as you need.
 
Thanks for that, but, the form which the buttons are on which fills the variables is still open, I can't see that putting the variables on a hidden form is any different. I will however try it. You may detect from the tone that I am slowly losing the will to live.
 
I see this "I have declared my variables as public within a module which contains a some functions."
I usually use a separate module something like
Option Compare Database
Option Explicit

Public MyName As String
Public MyVal As Integer
Public MyTest As String
Public MyAmount As Currency
Public MyValue As Currency
Public MyID As Integer

but check your functions for any errors will cause them to lose their value.
HTH
 

Users who are viewing this thread

Back
Top Bottom