hoping this is easy - passwords

  • Thread starter Thread starter 111
  • Start date Start date
1

111

I would like the application to open asking the user to identify himself and
enter a password. if the password is correct one form would be updated with the
new user info & another form to open.

ie.
Form [User Info All] has the following fields
User, Password, Title & Email

Form [User Info] has the following fields
User, Title & Email.

Once the user enters the correct password for his username [User Info] would be
updated with the correct infomation and then another form would open. If the
password was incorrect - then nothing would happen.

Can someone help me through this please
Thanks
Steve
 
Hi Steve,

From your descriptions, I understood that you would like to specify user
according to their user name and correct password. Have I understood you?
If there is anything I misunderstood, please feel free to let me know:0

Based on my knowledge, unfortunately, there is no easy way to do it.

First of all, Access have it's own security mechanism called workgroup
information files (mdw). With the help of mdw files, you could make your
mdb file user input their user name and password once they are trying to
open the file. Without correct user name or password, they could not even
open the mdb file.

If you have logged in as user1, you could use CurrentUser Method in VBA to
get to know current user of your access file is 'user1'

More information about mdw files and how to set this kind of security could
be found at

Understanding the role of workgroup information files in Access security
http://support.microsoft.com/default.aspx?scid=kb;en-us;305542

Overview of how to help protect a Microsoft Access Database
http://support.microsoft.com/default.aspx?scid=kb;EN-US;289885

Secondly, you may make your own security mechanism. Admittedly, it's rather
complex to do so. You will have to make a table to resotre the user
information(including password and anything else you like) and then use
your own security arithmetic to restore password preventing it is known by
others. Force the user check by means of Load_Form()

In all, I don't think your requirement could be fully realized with ease.
It's risky to make your own security mechanism as it's too easy to be
attacked.

Hope it helps and if you have any questions or concerns, please feel free
to let me know:)


Sincerely yours,

Mingqing Cheng
Microsoft Developer Community Support
 
Hi, thanks for the feedback. actually i'm not too interested security as i am
reports being automatically created with the correct user information. SOme of
these reports are fax coverpages etc which, once the user logged in correctly,
would put his name , email address and phone ext. in the correct place on the
coverpage.

Do you have a simple way of doing this?
tks
 
Hi,

From your descriptions, I think you'd better do it with Form_Load() method.
That's the simplest way I have thought :)

I will show you a small sample to do so
1. Create a form named "frmLogin", create a form name "frmFaxCover"
2. in the Form_Load(), set frmLogin Visable
3. use frmLogin to check whether the correct the password and identify the
customer
4. if correct, set frmLogin not visable and then show frmFaxCover
5. in frmFaxCover, you could get user info from non-visable form frmLogin

Hope it helps and if you have any questions or concerns, please feel free
to let me know:)

Sincerely yours,

Mingqing Cheng
Microsoft Developer Community Support
 
Hi,

I am just checking on your progress regarding the information that was sent
you! Have you tried the steps I provided to you? I wonder how the testing
is going. If you encounter any difficulty, please do not hesitate to let me
know.

Please post here and let me know the status of your issue. Without your
further information. Looking forward to hearing from you soon

Thank you for your patience and cooperation. If you have any questions or
concerns, don't

hesitate to let me know. We are here to be of assistance!


Sincerely yours,

Mingqing Cheng
Microsoft Developer Community Support
 
Thanks for asking, i've been out of town for a bit and plan on working on this
this week.
Best regards
Steve
 
No problem, Steve. If you have any more concerns on it, please feel free to post here. We are closely monitoring the group and will follow up at
then.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Dear Mingqing Cheng,
i thought this might happen.
I'm trying to follow your instructions but here's where i get confused.

btw i have very limited programming experience. I have been doing everything
with macros and wizards .

i created the two forms.
i went into the visual basic screen for the frmLogin form and from the
properties menu set the Visible property to TRUE.

Step 3 you say use frmLogin to check whether the correct password is used etc.
and i don't know how to do this?

Steps 4 & 5 are a mystery to me too...

sorry,
do you have a more basic step by step suggestion i would be able to follow?

Thanks
 
Hi,

You could follow these steps to make a successfully user Login input. Also,
you could email me asking this sample :) I could be reached at
(e-mail address removed) (Leave online for spam :-)

1. Create a new mdb files

2. Create a table "tblUsers"
id autonumber primarykey
userid text
passowrd text

remember to input some data to the table for testing

3. Create a form, named "frmLogin", add label "Login", add text "UserId",
add text "Passowrd", add command button "OK", add command button "Cancel"

4. The following codes are added to the "frmLogin"
''''''''''''''''''START of
Codes''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Compare Database

Private Sub Cancel_Click()
' This code created by Command Button Wizard.
On Error GoTo Err_Cancel_Click

' Close form.
DoCmd.Close

Exit_Cancel_Click:
Exit Sub

Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click


End Sub


Private Sub OK_Click()
On Error GoTo Err_OK_Click

Dim strMsg As String, strTitle As String
Dim intStyle As Integer

' If Sales by Year report is not being opened for previewing or
printing,
' cause an error. (blnOpening variable is true only when report's Open
event
' is being executed.)
If Not Forms![Form1].blnOpening Then Err.Raise 0

Dim varx As Variant
varx = DLookup("userid", "tblUsers", "userid = '" &
[Forms]![frmLogin]![Text3] & "' and password = '" &
[Forms]![frmLogin]![Text5] & "'")
Debug.Print "1"
Debug.Print [Forms]![frmLogin]![Text3]
Debug.Print [Forms]![frmLogin]![Text5]
Debug.Print varx

If IsNull(varx) Then GoTo Input_Error

' Hide form.
Me.Visible = False

Exit_OK_Click:
Exit Sub

Err_OK_Click:
strMsg = "To use this form, you must preview Form1 from the Database
window or Design view."
intStyle = vbOKOnly
strTitle = "Open from Form1"

MsgBox strMsg, intStyle, strTitle
Resume Exit_OK_Click

Input_Error:
strMsg = "Input Error, please check your userName and password is valid"
intStyle = vbOKOnly
strTitle = "Incorrect Input"

MsgBox strMsg, intStyle, strTitle
Exit Sub
End Sub
''''''''''''''''END of
Codes''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

5. Create a new from Form1 (I assume Form1 as the form you will see after
login, you could assign it to whatever form you want)
The following codes should be add to form1
''''''''''''''''''START of
Codes''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Compare Database ' Use database order for string comparisons.
Option Explicit ' Requires variables to be declared before they are used.
Public blnOpening As Boolean

Private Sub Form_Open(Cancel As Integer)
Dim strDocName As String

strDocName = "frmLogin"
' Set public variable to True so Sales by Year Dialog knows that report
' is in its Open event.
blnOpening = True

' Open form.
DoCmd.OpenForm strDocName, , , , , acDialog

' If Sales by Year Dialog form isn't loaded, don't preview or print
report.
' (User clicked Cancel button on form.)
If IsLoaded(strDocName) = False Then Cancel = True

'Set public variable to False, signifying that Open event is finished.
blnOpening = False
End Sub
''''''''''''''''END of
Codes''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

6. Now, it finishes. If you open Form1, you will be shown the form frmLogin
asking you input username first; If you open frmLogin directly, you will be
asked to open Form1 :)


Hope it could meet your requirement and thank you for your patience and
cooperation. If you have any questions or concerns, don't hesitate to let
me know. We are here to be of assistance!


Sincerely yours,

Mingqing Cheng
Microsoft Developer Community Support
 
Back
Top