Re: Using Windows Login
- From: "Rocky" <rocco81b@xxxxxxx>
- Date: Mon, 19 Nov 2007 20:17:59 -0000
This is how I did it. First, I created a table with a name like of LeadTech,
since that was the access level I wanted. I inputed my user ID into this
table as a record, and any other user who needed this "higher" access. So in
this case, my login ID is Rocky.Bolin
On the form, in VB, I did the following.
Private Sub Form_Activate()
DoCmd.Restore
On Error Resume Next
Dim rst As Recordset, strString As String, tempstring As String
UserName = Environ("USERNAME")
Me.Filter = "UserName = '" & Environ("USERNAME") & "'"
Me.FilterOn = True
End Sub
// The Environ("USERNAME") takes your windows login ID. Remember it!
Then, to gain access to the higher level form, on the button to goto the
form, I did this.
Private Sub Label2_Click()
Dim rst As Recordset, x As String
Set rst = CurrentDb.OpenRecordset("select * FROM LeadTech WHERE UserName =
'" & Environ("USERNAME") & "'", dbOpenDynaset)
If Not rst.EOF Then
If rst!UserName = Environ("USERNAME") Then
x = MsgBox("Access granted for '" & Environ("USERNAME"))
DoCmd.OpenForm "Tool_Requests", acNormal
'Me.Visible = False
Exit Sub
End If
End If
rst.Close
x = MsgBox("Not a Lead Tech. Access Denied.")
End Sub
// These commands look up the record in table LeadTech, where I added my
username. If I use someone not in the table, it tells me "Not a lead tech.
Access Denied."
--------------------------------------------------
From: "Rocky" <rocco1981@xxxxxxxxxxx>
Sent: Monday, November 19, 2007 7:57 PM
Newsgroups: microsoft.public.access.security
Subject: Re: Using Windows Login
=Environ("USERNAME") takes the user name from windows. or it may be without the " ", I can't remember. My database is on the network at work. I will look at it tomorrow and let you know for sure..
"Anthony Bollinger" <tonyb@xxxxxxxxxxxxxxx> wrote in message news:eTrWtPGKIHA.5224@xxxxxxxxxxxxxxxxxxxxxxxIs there a way to use the Windows login credentials/user to apply Access 2003 security without the need for a separate login? All we need to be sure of is that the user is valid/expected. It is not necessary to have a separate login if we can take advantage of the already valid user login to Windows. How is this accomplished?
Thanks,
Tony
- Follow-Ups:
- Re: Using Windows Login
- From: Douglas J. Steele
- Re: Using Windows Login
- References:
- Using Windows Login
- From: Anthony Bollinger
- Re: Using Windows Login
- From: Rocky
- Using Windows Login
- Prev by Date: Re: Using Windows Login
- Next by Date: Removing Licensing Info: office 2004 mac
- Previous by thread: Re: Using Windows Login
- Next by thread: Re: Using Windows Login
- Index(es):