I have a global variable defined on a form"
- NOTE - a variable defined with the public keyword at the top of a forms/reports module IS NOT a public variable. You will need to put it into a standard module (in VBE - Insert | Module) to make it public (global).
A form public, is only available as long as the form is open. When it closes, the form public looses the value (out of scope).
wemeier's suggestion will work well with a public variable (declared in a standard module), but if you're going to try to retrieve a form public you'll need to ensure the form is open, then fetch it like a form property, for instance like this:
[tt]Public Function GetCurrUser() As String
GetCurrUser = forms("nameofyourform").CurrUser
End Function[/tt]
wemeier's or this function will need to be in a standard module.
Roy-Vidar