Selasa, 23 Oktober 2012

Re: [MS_AccessPros] Login form

 

Bill,

My sample db named Form_LogIn might also be of help in providing some working ideas. It is in Access 2000 file format and is available at Rogers Access Library. Link:
http://www.rogersaccesslibrary.com/forum/forum_topics.asp?FID=45

Successful log-in takes you to a secondary switchboard (Administrator's or User's, depending upon the mode chosen for logging in). Each of these secondary switchboards provides for change of password, if desired.

Best wishes,
A.D. Tejpal
------------

Form_LogIn
(Sample Db - Brief Description)
======================
This sample db demonstrates a log in form with the following options:
(a) As Administrator.
(b) As User.

Max three attempts are allowed. If the correct combination of user ID and password are not supplied within the max allowed attempts, the database closes down. If this happens in non-administrative mode, user's account gets blocked.

To start with, the text boxes for entering user Id & password have light blue back color.

If the first attempt fails, a message box regarding invalid combination of user ID and password comes up. Simultaneously, the back color of text boxes (user ID & password) changes to light orange, accompanied by a label display (in light orange back color) notifying that it is the second attempt.

If the second attempt fails, a message box regarding invalid combination of user ID and password comes up. Simultaneously, the back color of text boxes (user ID & password) changes to light pink, accompanied by a label display (in light pink back color) notifying that it is the third attempt.

If the third attempt also fails, the database closes down after displaying appropriate message box. If this happens in non-administrative mode, the user is notified that the particular account stands blocked and the administrator should be contacted.

Simultaneously, the following entries get recorded against this user's account in the relevant table:
(a) Field named Blocked (Yes/No type) gets set to True.
(b) Current date / time gets entered in field named DtLastBlocked.
(c) Cumulative count of such blockages for this user is entered in field named BlockCount. This helps identify repeated defaulters if any.

If a user with blocked account tries to log in without clearance from the administrator, he/she is faced with the following as soon as the user Id is entered:
(a) Text box for entering password gets locked.
(b) Command button captioned "OK" gets disabled.
(c) Back color of both text boxes changes to light pink.
(d) A label with light pink back color gets displayed, notifying that the account stands blocked.
(e) Focus moves to command button captioned "Cancel". Clicking this command button results in closure of database.

On successful log in, appropriate switchboard form (Administrator or User) gets opened. Particulars of User_ID, LogStatus and ID (PK) get stored in hidden text boxes on these forms - for further use by the developer as found necessary.

Facility for change of password is available on both the switchboards (Adm / User). The Adm switchboard provides the additional facility for blocking / unblocking of user accounts.

Note - If the user tries to close the log in form prematurely, by clicking the close box at top right of the form, it results in closure of database.

Version: Access 2000 File Format

References: DAO 3.6
====================================

----- Original Message -----
From: Bill Singer
To: MS_Access_Professionals@yahoogroups.com
Sent: Wednesday, October 24, 2012 00:34
Subject: RE: [MS_AccessPros] Login form

John,

I now have one table with one row.

I can get the user ID into the table. I initially set it up so that the
Combo box on the Login form drops the ID in the table. Is that going to
work? It seems to work.

The user selects their name on the Login form from the list of names in the
combo box and the table gets updated.

The problem is that I do not know how to get the value out of the table. If
I want to run a query and sort the results of the query by the UserID I do
not know how to grab that UserID out of the local table. I can't add it to
the criteria filed in the Query grid. When I run the query I get a message
box asking for the UserID.

As you can tell my Rookie-ness is showing. I am guessing this is why I
need to assign a variable rather than pull the number from a table.

Do I put this code on the Login form on the click event of the button that
opens the database? That will assign the public variable and then open the
database.

Option Compare Database
Option Explicit

Public strUserID As String

Function GetUser() As String
' If the public variable isn't set,
If Len(strUserID) = 0 Then
' Fetch it from the local table
strUserID = DLookup("UserID", "t_UserID")
End If
' Return the user ID
GetUser = strUserID
End Function

I am not even sure what questions to ask.

...and am not sure where to put this code.. CurrentDb.Execute "UPDATE
t_UserID Set UserID = " & Me.UserID,
dbFailOnError

Then I will have to figure out how to call a variable in code, which I have
not done before.

Thanks,

The learning continues.

Bill Singer

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John Viescas
Sent: Tuesday, October 23, 2012 2:09 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Login form

Bill-

Your local table should have only one row and one field - and that field
can be the Primary Key. The Execute is simply running an SQL Update query
to stuff the selected login ID in that local table for later use. If the
ID is a number, then the command needs to be modified to drop the quotes:

CurrentDb.Execute "UPDATE ztblCurrentUser Set UserID = " & Me.UserID,
dbFailOnError

My original example was wrong - the command should update the local "ztbl"
table, not your master user table.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: Bill Singer <Bill.Singer@at-group.net
<mailto:Bill.Singer%40at-group.net> >
Reply-To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Date: Monday, October 22, 2012 10:46 PM
To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Subject: RE: [MS_AccessPros] Login form

John

The database is split, a table is now in the local copy, called t_UserID.
I have the login in form completed with a combo box that pulls the ID from
the table of possible users. The ID is a number. The value is stored in
the local table, which has one record. (Do I need a primary key, auto
index?) The field is UserID.

Now is where it gets fuzzy for me.

There are two buttons on the Login form. One says cancel and closes the
database. The other should lead me to the database but is not programmed
yet.

I do not understand this. "CurrentDb.Execute "UPDATE t_User Set = '" &
Me.UserID &
"'", dbFailOnError

I am not sure where it goes. Maybe I am having brain gridlock but it is
not
coming to me.

I am sure I will have another question but I will wait for now.

thanks

Bill Singer

From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of John
Viescas
Sent: Thursday, October 18, 2012 9:54 AM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: Re: [MS_AccessPros] Login form

Bill-

I assume you split out all the tables into the back end. You can now
define a local table in the front end - it won't be a shared link and each
user will have their own copy. Simply write the logged-in user ID to that
table. You could also put it in a Public variable and write a function to
fetch it when needed. Let's say the table is called ztblCurrentUser and
the one field is UserID. The table should have one row in it. When you
get a user ID set in the form, do:

CurrentDb.Execute "UPDATE t_User Set = '" & Me.UserID &
"'", dbFailOnError

Your function could look like:

Option Compare Database
Option Explicit

Public strUserID As String

Function GetUser() As String
' If the public variable isn't set,
If Len(strUserID) = 0 Then
' Fetch it from the local table
strUserID = DLookup("UserID", "ztblCurrentUser")
End If
' Return the user ID
GetUser = strUserID
End Function

Whenever you need to test the ID in code, just call the function:

If GetUser() ="Jviescas" Then C

You can also use the function in an expression in a query.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: Bill Singer <Bill.Singer@at-group.net
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net> >
Reply-To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Date: Thursday, October 18, 2012 3:32 PM
To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Subject: RE: [MS_AccessPros] Login form

John,

Yes, the split went better than I though. I am waiting for my co workers
to
get in so I can test it.

Now I need to get back to the subject that started this conversation.

I am implementing a Login form so that I can sort specific information to
the user.

The login form is going to have a combo box with the user's name and ID
(which will not show) No password.

After each user opens their FE database, logs in, what do I do with the
login form. I need to capture that ID for the person that logs in and if I
close the form the ID goes away.

You mentioned "If you store the ID in a local table in the "code" database
linked to the
rest of the data on a server, you will maintain local info for each user
independently."

Sorry, I do not know what this means. "store the ID in a local table in
the
"code"

Bill Singer

From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of John
Viescas
Sent: Thursday, October 18, 2012 2:10 AM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: Re: [MS_AccessPros] Login form

Bill-

I see from later posts that others have already convinced you to split it.
You've just been lucky to this point to have 4 users share simultaneously
and not get corruption or worse.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: Bill Singer <Bill.Singer@at-group.net
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net> >
Reply-To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Date: Wednesday, October 17, 2012 6:37 PM
To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Subject: RE: [MS_AccessPros] Login form

Sorry John, I do not know what you mean when you say "local table in the
"code" database linked to the
rest of the data on a server"

Just in case this matters. I do not have a split database. One database
with form and queries and tables all together. It is on a network hard
drive. All 4 users access it from there.

Bill Singer

From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of John
Viescas
Sent: Wednesday, October 17, 2012 11:27 AM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: Re: [MS_AccessPros] Login form

Bill-

If you store the ID in a local table in the "code" database linked to the
rest of the data on a server, you will maintain local info for each user
independently.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: Bill Singer <Bill.Singer@at-group.net
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net> >
Reply-To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Date: Wednesday, October 17, 2012 6:05 PM
To: <MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> >
Subject: RE: [MS_AccessPros] Login form

Jim,

I am not exactly sure how that would work. I have 4 people accessing the
database at the same time and I want each user to see their own stuff.

Bill Singer

From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of Jim
Wagner
Sent: Wednesday, October 17, 2012 10:15 AM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: Re: [MS_AccessPros] Login form

Bill

You could store the ID in a table and use the table as reference

Jim Wagner
________________________________

________________________________
From: Bill Singer <Bill.Singer@at-group.net
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net>
<mailto:Bill.Singer%40at-group.net> >
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
<mailto:MS_Access_Professionals%40yahoogroups.com>
Sent: Wednesday, October 17, 2012 7:58 AM
Subject: [MS_AccessPros] Login form

I have created a login form. It does not even have a password, it just has
a combo box so the person can input their name. I want to use the
individuals ID to sort certain queries as the person works on the database.

I believe to do this I will need to keep the login form open. If I close it
I will lose the reference to that ID number. What is the best way to do
this? Maybe there is a better way of identifying who is working on the
database than a login inform. Do I just minimize the login form, can I
hide it, or is there another place to save the ID so I can reference it
later?

Thanks so much?

Bill Singer

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (169)
.

__,_._,___

Tidak ada komentar:

Posting Komentar