UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Is there a way for me to create a "login" form    
 
   
HawkeyeX
post Mar 18 2005, 01:49 PM
Post #1

UtterAccess Enthusiast
Posts: 62
From: Denver, CO



And use the form to transfer their login forms into the other forms?

I'm trying to make a Daily Report form, but first I want to "log them in" first and use their following info:

DATE DAY TIME OPERATOR

into all other forms that require them and then grey that area out (so they don't have to input it again)

Make it simpler.

Any advice? I'm an Access newbie.

Thanks!

David
Go to the top of the page
 
+
fredrisg
post Mar 18 2005, 01:55 PM
Post #2

UtterAccess VIP
Posts: 1,795
From: LA, CA, USA



David,

I use a Sign On form (frmSignOn) that is the start up form and only has four controls: a cbo for user names,a password textbox, and a Ok and Exit buttons.

The password for each user is hidden in a column in the cbo.

When the user hits Ok or Accept, the VBA checks to see if the password is correct for the user and opens the Main Menu (frmMainMenu) (just a simple form with command buttons that go different places . . . project tracking, sales, etc.

If the password isn't corrent, the user can't enter the system.
CODE

If txtPassword = cboName.Column(2) Then
   . . . open frmMainMenu
Else
   . . . message indicating the password is wrong
end if


Steve
Go to the top of the page
 
+
HawkeyeX
post Mar 18 2005, 02:19 PM
Post #3

UtterAccess Enthusiast
Posts: 62
From: Denver, CO



Problem is, this isn't what I'm looking for.

I'm looking for something simple - like a logon form to transfer the following info:

DATE DAY TIME OPERATOR

to other forms that I've created.
Go to the top of the page
 
+
tinygiant
post Mar 18 2005, 02:49 PM
Post #4

UtterAccess Ruler
Posts: 1,150
From: Elizabethtown, KY



HawkeyeX,

You don't need to keep transferring the data to each of the forms you open. It would be a little easier, I think, to create a global variable on login of a custom type:
CODE
Public Type UserInfo
    LoginDate as Date
    LoginDay as ???
    LoginTime  as Date
    Operator as Integer
End Type

Global User as UserInfo

When the user logs in, you can use code to set these variables and they will then be availabe to any module, form, report, etc. etc at any time, using forms, queries or VBA. You set the variables with a statement like this:
CODE
User.Operator = DLookup(....)

or some such statement to set it's value. You can then refer to it at any time in much the same way.
CODE
Me.txtDate = User.LoginDate

I've used this technique to successfully and easily transfer values that are required in multiple areas without having to worry about setting variables in each form's module or worry about passing information from form to form.
Go to the top of the page
 
+
HawkeyeX
post Mar 21 2005, 12:49 PM
Post #5

UtterAccess Enthusiast
Posts: 62
From: Denver, CO



Ok. As an Access newbie, can you help me out do this correctly? I don't know much about Access, only what I know via the books, and this is a bit advanced for me.

Thanks!

Actually, Operator is a 2 letter name so it should be text, not Integer, btw.

David
Go to the top of the page
 
+
fredrisg
post Mar 21 2005, 01:45 PM
Post #6

UtterAccess VIP
Posts: 1,795
From: LA, CA, USA



Hawkeye,

Here's some sample code that does what ed suggest and I do myself:

CODE


    If txtPassword = cboName.Column(2) Then                

        'obtain user and permission info
        gstrName = cboName.Column(1)
        glngNameID = cboName.Column(0)

     End if


Here again, the password is hidden in column in the cbo using a 0" width.

I establish global variables in a module as follows:


Global gstrName As String
Global glngNameID As Long

Thus, you can refer to this global variables anywhere in your code.

Steve
Go to the top of the page
 
+
jhardy66
post Mar 21 2005, 01:57 PM
Post #7

UtterAccess Ruler
Posts: 1,571
From: Athens, Georgia "UGA" (USA)



You may also want to check out CyberCow's example db Login from the Code Archives. It is what I use for the basis of my login form. Which I use for similar reasons to you. His code is veryu well documented and any questions I've ever had on it, he was always willing to help.

Also check out this link for an explaination.

Edited by: jhardy66 on Mon Mar 21 14:00:11 EST 2005.

Edited by: jhardy66 on Mon Mar 21 14:03:38 EST 2005.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 12:09 PM