Public variable

VictorGuarnieri

New Member
Joined
Jul 12, 2011
Messages
3
Hello, I got a doubt:
In a test project I have two forms: a login and a main form
In the login form, I'll check the user/password and also the access level of that user. For that I used a variable set as public (in the login form), since I'll need it later on other forms, but its not working.
So, if I have to do that, do I have to write the login routine in a module?
Thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Thanks for the quick answers.
Well in the login form I declared it:
Public nivel As Integer

Later in the main form I used it without declaring again, so it appears out of nowhere
 
Upvote 0
Thanks for the quick answers.
Well in the login form I declared it:
Public nivel As Integer

Later in the main form I used it without declaring again, so it appears out of nowhere

Can you show me the line of code in your main form where you use it? Did you preface the variable with the name of your login form? For example, if your login userform is named Userform1, did you refer to the variable as Userform1.nivel when you refered to it in the main form?
 
Upvote 0
Yeah that's the problem...
So always when I declare a variable as public somewhere, later I'll have to use the form where it was declared as a reference?
Thanks
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,873
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top