password on a form (1 Viewer)

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
Hi

does someone have a example, how can i put a password on a form

i have a table with this fields

id_user
username
password

so how can i make a form to ask me the password, so i can enter!??

thanks!
 

khawar

AWF VIP
Local time
Tomorrow, 01:23
Joined
Oct 28, 2006
Messages
870
on open event of the form you can ask user to enter a password and checking it against the password in your table if doesnt match cancel the open event
 

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
oh ok

can you put a example of the code, im so dummy for that!! thanks!!
 

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
actualy it doenst work

it ask my password, but it doesnt works, i put the correst password and still tell me that its wrong
 
Last edited:

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
another thing, what about the username!!, this example, make me to need a password to enter to a form, but it doesnt ask me a username
 

JohnLee

Registered User.
Local time
Today, 14:23
Joined
Mar 8, 2007
Messages
692
Hi,

The problem with that example DB is that everyone will need to know the password to access that form.

Another way to protect access to specific forms is to use the security features built into access, whereby the user has to use a password and User ID to access the database, but using the security features in access limit what parts of the database the user can gain entry into. That way you have no requirement for a form specific password and you don't have the issue of everybody who needs gain entry to that form knowing the same password.

If you go down the route of a form specific password which lots of people know, at somepoint you will need to change it if it became compromised or someone left the companies employ or any other reason, you therefore you have the added problem of having to notifiy all concerned that the password has changed.

If you search this forum, you will find that there are threads that cover this subject and provide a better solution than this particular one, but be warned it is heavy in the use of code.

John
 

dkinley

Access Hack by Choice
Local time
Today, 16:23
Joined
Jul 29, 2008
Messages
2,016
Login Demo (with Global Variables)

Hey Jav .....

I am attaching a demo of user login which demos users and administrators which I wrote for Access 2007. It's purpose is to lock-down user access in the front-end because '07 doesn't have any sort of cool security features like previous versions.

This demo uses global variables so the the system can recall who is logged in (in case you want to store their name/initials in a table when they make changes) and security group level (so you can set controls and/or forms for group level access). Since it is a global variable, it will persist until changed (so they can use a form automatically without having to log into it).

To demonstrate this, it has user add/remove functions for the administrator including password reset (for a user) or change their own password. Users can only change their own password. Same form, different views depending on group level.

Note: I wrote this because this is the sort of demo I wished I could have had when first starting out to help me understand global variables, modules, and functions.

Again, this isn't a replacement for workgroup security in previous versions or ironclad security (especially for data).

-dK

Disclaimer: The posting of this demo in way holds the author responsible for its use or the security provided by its content. It is for demonstration purposes only.
 
Last edited:

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
hi dk, thanks for your example!! im taking a look

when i write the password and click the enter to databse bottom, it show me a error about a that a is missign a library or proyecto

i this part

If IsNull([cmbLogin]) Or IsNull([txtPassword]) Then
MsgBox "You must enter the correct name and/or password, please try again."
ElseIf Me!txtPassword = DLookup("Password", "tDBUser", "[DBUserID] =" & Me!cmbLogin) Then
sInitials = DLookup("Initials", "tDBUser", "[DBUserID] =" & Me!cmbLogin)
sAccessGroup = DLookup("UserGroup", "tDBUser", "[DBUserID] =" & Me!cmbLogin)
sName = DLookup("NameFirst", "tDBUser", "[DBUserID] =" & Me!cmbLogin)
sName = sName & " " & Left(DLookup("NameLast", "tDBUser", "[DBUserID] =" & Me!cmbLogin), 1)
 

dkinley

Access Hack by Choice
Local time
Today, 16:23
Joined
Jul 29, 2008
Messages
2,016
Hey Jav .....

I am attaching a demo of user login which demos users and administrators which I wrote for Access 2007. It's purpose is to lock-down user access in the front-end because '07 doesn't have any sort of cool security features like previous versions.

This demo uses global variables so the the system can recall who is logged in (in case you want to store their name/initials in a table when they make changes) and security group level (so you can set controls and/or forms for group level access). Since it is a global variable, it will persist until changed (so they can use a form automatically without having to log into it).

To demonstrate this, it has user add/remove functions for the administrator including password reset (for a user) or change their own password. Users can only change their own password. Same form, different views depending on group level.

Note: I wrote this because this is the sort of demo I wished I could have had when first starting out to help me understand global variables, modules, and functions.

Again, this isn't a replacement for workgroup security in previous versions or ironclad security (especially for data).

-dK

Disclaimer: The posting of this demo in way holds the author responsible for its use or the security provided by its content. It is for demonstration purposes only.

Repaired on older machine.

-dK
 
Last edited:

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
dk, you oare codding do!!

Again THANKS A LOT!!

what can i do for you!!, you help me alot!!
 

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
this is something i just think

is there a way to save on a table wich person login and at what time?
 

dkinley

Access Hack by Choice
Local time
Today, 16:23
Joined
Jul 29, 2008
Messages
2,016
Yes you can ...

A simple way would be to modify the users table with a field of LoginDate.

On the login click (where they are successful) you can write to the LoginDate field (=Now()) using any method of choice (i.e., SQL UPDATE).

Then to find out who logged in when, you can run a query against the user table.

Note: This method will only keep track of the last login time. You will need to create a whole new table to add the login records if you want a history.

-dk
 
Last edited:

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
actually i want to make another table

maybe with this field
- id_user
- username
- time

what do you think¡?
 

dkinley

Access Hack by Choice
Local time
Today, 16:23
Joined
Jul 29, 2008
Messages
2,016
That will work ... then use the SQL INSERT, AddNew method or whatever.

Where I find this the most useful is in the following scenario ...

In my data tables, I put in two fields (UserInitials, ModifiedDateTime). On the bound form I have two controls bound to these fields and set their visibility to false.

Once the user save's changes, I update these fields with the global variable of the user name and the (=Now) so when another user goes in, they see who made the last changes.

-dK
 

javier_83

Registered User.
Local time
Today, 16:23
Joined
Jul 9, 2008
Messages
49
how can i use the sql insert codE?

somethking like this? will work to save the date and time??

Set db = CurrentDb()
Set rs = db.OpenRecordset("Select * From hacessos")
rs.Edit
rs.AddNew
rs![Username] = [Forms]![user_password]![cmbLogin]
rs![Fecha] = Date
rs![Hora] = Time
rs.Update
rs.Close
Set rs = Nothing
End Sub
 
Last edited:

dkinley

Access Hack by Choice
Local time
Today, 16:23
Joined
Jul 29, 2008
Messages
2,016
Something just like (with a wee bit of tweaking) should work.

-dK
 

Users who are viewing this thread

Top Bottom