Unable to get the public variable to work (1 Viewer)

knn9413

Registered User.
Local time
Today, 00:15
Joined
Feb 18, 2015
Messages
36
Here is what I have so far

I have a module that has a global variable defined as shown below

Module: initGlobals
-----------------------
Code:
Option Compare Database
Option Explicit
Public strGlobalUserId As String

Sub initvar()
    strGlobalUserId = "Myuserid"
End Sub

This is invoked in a login form("frmLogin") and it displays the above value before I replace it with the one that is accepted in the form.

Here is the code from the login form

Code:
strGlobalUserId = Me.cboEmployee.Value

When the password is successful, I close the login form and open a form called "frmMainForm". In the form_open event of the "frmMainForm", I am trying to display the user id using strGlobalUserId but it just has spaces. What am I doing wrong?

Appreciate the help in advance. I have searched my entire project for declarations to the above variable. The only place it is declared is in the general module and referenced in the 2 forms that I mentioned above

Thanks
 

spikepl

Eledittingent Beliped
Local time
Today, 09:15
Joined
Nov 3, 2010
Messages
6,142
What is the content of
Me.cboEmployee.Value
In the form_open event of the "frmMainForm", I am trying to display the user id using strGlobalUserId but it just has spaces.
How? Show code.
 

knn9413

Registered User.
Local time
Today, 00:15
Joined
Feb 18, 2015
Messages
36
What is the content of
Me.cboEmployee.Value
How? Show code.

This is weird.. I got up this morning and it works just fine. Not sure why it showed spaces yesterday night...And I was not even drinking:p
 

Users who are viewing this thread

Top Bottom