Record Log in name ??

fibayne

Registered User.
Local time
Today, 04:20
Joined
Feb 6, 2005
Messages
236
Hi..i am using this code to forcing users to enter their password which will allow them to open a form, which is working fine, I would like if possible by using a tick box on the opened form have their username stored for use on subsequent report, would anyone be able to give me some help / point me in the correct direction ...as always thanks in advance :confused: cheers Fi

Private Sub cmdOK_Click()
If txtPassword.Value = DLookup("Password", "tblAccess", "[UserId] = txtUserID.Value") Then
CheckFlag
DoCmd.Close acForm, "frmLogin"
Else
MsgBox "Invalid Password, please enter the correct password or contact the database administrator"
End If
End Sub
 
I don't understand the need for a checkbox. You want to save the username so that if the user prints a report while logged in you can print their name on the report?
 
You could save the username and other informations you may need later in the registry with SaveSetting and retreive the information on the "onload" of the form frmLogin with GetSetting.

Registry is a good place to store information but...yes there is a but... if you know jack about registry, you should use another method like the following.

Make a table with all the info you need like UserName, Emp. Number, Access Level and other thing and save the information you gathered in the login form to that table. On the "onclose" event of the frmLogin form you put a SQL string to delete all information of that table.

Many many many things to do, many many many way to do them, you just need to get YOUR way ;O)
 
Hi lagbolt..I am using the form, opened from the Login form if the correct password is entered, for an authoriser to check info which if they agree with it they can select the tickbox which will add their name to the form and the subsequent report ..giving authority for the users to carry out the transaction, i imagine the login name would need to be stored in a table to do this ?? very possibly I am trying to achieve this in the wrong way... and if you have any suggestions they would be hugely appreciated....cheers Fi
 
hi AngelsGuardian...thanks for your reply, I have created a table to store the info, would I need to make this the record source for frm_Login ?? so that it can be saved there ?? your registry suggestion sounds good but I indeed know Jack, the OnClose SQL string would you be able to give some help on that also ??? cheers Fi
 
- Still not sure I understand the problem, or what the checkbox does. If the user logs in isn't that authorization enough? What additional confirmation does the checkbox provide?
- But yes, you can store this status information to a table, and retrieve it from there as required, but also if you have data, like a username, that you might need very commonly during the course of processing data, you could store this is a global variable.
- In standard module you can make a declaration like...
Code:
Public g_UserName as string
After the user's password is correctly entered you do this...
Code:
g_UserName = me.txtUserName
And then you can use 'g_UserName' anywhere, anytime. In reports, for instance, to indicate who printed them.
- Hope this helps!
 
Hi...I have come up with this solution (helped of course by a few strings on the forum)which seems to be working, on the authorisation form I have an unbound textbox with the following code

Private Sub txtPIN_BeforeUpdate(Cancel As Integer)

txtUserID.Value = DLookup("[Authoriser]", "tblAccess", "[PIN]= '" & Me!txtPIN & "'")

Forms!frm_ChqRecAuthorisation![authoriser] = UserID
Forms!frm_ChqRecAuthorisation![txtAuthStore] = txtUserID
Forms!frm_ChqRecAuthorisation![txtPINStore] = txtPIN


End Sub

any comments / improvements welcome...cheers Fi
 
Hi Lagbolt, on the Login Form the authoriser must enter their password to open the authorisation form, this info is not stored, on the authorisation form I originally had a combo box where the the authoriser selected their nam this was stored and used on the reports, prob was that once into the authorisation form the authoriser could select any name from the list I wanted to restrict them to only their name the code I just posted uses a 'PIN' which has the input mask password (shows ****) if correct it fill in hte authoriser field with their name...what do you think ???? thanks for your earlier reply...cheers fi
 
Thanks for posting back with your success.
 

Users who are viewing this thread

Back
Top Bottom