Full Version: User ID
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
dashiellx2000
I am having an issue concerning storing the user's ID.

I have a tblUsers and tblRequestData. On my tblRequestData I have set up the field UserID as a FK to the tblUsers PK. However, this ID is not the number that that user actually uses to login to the database. They use what is referred to as their Clock Number to login to the database and I have all the security set up to search the user's table to determine if they are a user, manager, etc...

After they have entered the database, the frmLogin hides.

I have the frmRequests set to look at the login form and pull their clock number onto the requests form, however, this is causing the Clock Number to be stored onto the tblRequestData rather then the UserID number. Now this isn't really that much of an issue except for that would disqualify the database as being considered "normalized" and I don't want to do this. I could create a hidden field on the frmLogin which would store the database's UserID number, but I wasn't sure how to get this field to populate. Presently, I have the following code on the frmLogin:

QUOTE
LoginID = DLookup("ClockNum", "tblTechs", "ClockNum= '" & ClockNumb & "'")

If ClockNumb = "" Or IsNull(ClockNumb) Then
MsgBox ("Clock Number Must Be Entered!")
Exit Sub
End If
If IsNull(LoginID) Or LoginID = "" Then
MsgBox ("INVALID User!" & vbCrLf & "Please TRY again.")
ClockNumb.SetFocus
Exit Sub
End If
If DLookup("[User]", "tblTechs", "ClockNum='" & Me.ClockNumb.Value & "'") = -1 Then
DoCmd.OpenForm "frmTechMenu"
End If
Me.Visible = False


What code can I use to populate the UserID field on this form. Do I have to use another DLookup? Is there an easier way to keep track of this data.

Thanks.
CyberCow
This may help: db Login
dashiellx2000
Thanks Cyber Cow. I actually had downloaded your example when I was first creating my db. Now I'm trying to improve and normalize my db. I was hoping for something easier as at the time I found your example way above me. I'll take another gander.

Thanks.
CyberCow
OK, good luck! It's concepts are implementation are sound and proven. There are others in the archive as well.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.