|
security
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using Windows LoginIs 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 If all you want to do is ensure that the user is valid/expected, why not just put the database in a folder, and use the folder permissions to allow only those users?
-- Joan Wild Microsoft Access MVP Show quote "Anthony Bollinger" <tonyb@noemail.noemail> wrote in message news:eTrWtPGKIHA.5224@TK2MSFTNGP02.phx.gbl... > Is 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 > > "Joan Wild" <jwild@nospamtyenet.com> wrote in message Okay, I can see where I was very unclear. We do want to use Access news:%23D0xhhGKIHA.5624@TK2MSFTNGP04.phx.gbl... > If all you want to do is ensure that the user is valid/expected, > why not just put the database in a folder, and use the folder > permissions to allow only those users? permissions for different users (3 groups), but I was wondering if there is a way to do this based on the Windows login and not need to create separate user/login information for Access. Has anyone implemented something like this? Many thanks, Tony No you can't integrate Access security with Windows usernames.
-- Joan Wild Microsoft Access MVP Show quote "Anthony Bollinger" <tonyb@noemail.noemail> wrote in message news:O8ku5rKKIHA.4592@TK2MSFTNGP02.phx.gbl... > "Joan Wild" <jwild@nospamtyenet.com> wrote in message > news:%23D0xhhGKIHA.5624@TK2MSFTNGP04.phx.gbl... >> If all you want to do is ensure that the user is valid/expected, >> why not just put the database in a folder, and use the folder >> permissions to allow only those users? > > Okay, I can see where I was very unclear. We do want to use Access > permissions for different users (3 groups), but I was wondering if there is > a way to do this based on the Windows login and not need to create separate > user/login information for Access. Has anyone implemented something like > this? > > Many thanks, > Tony > > =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. Show quote "Anthony Bollinger" <tonyb@noemail.noemail> wrote in message news:eTrWtPGKIHA.5224@TK2MSFTNGP02.phx.gbl... > Is 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 > 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" <rocco1***@hotmail.com> Sent: Monday, November 19, 2007 7:57 PMNewsgroups: microsoft.public.access.security Subject: Re: Using Windows Login Show quote > =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@noemail.noemail> wrote in message > news:eTrWtPGKIHA.5224@TK2MSFTNGP02.phx.gbl... >> Is 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 >> I always cringe when people suggest using an environment variable for this
purpose, given how easy it is to reset an environment variable. All that's necessary is to open a DOS box, use the SET command to set the USERNAME variable to whatever you want, then open Access using a command line in that same DOS box. While the USERNAME isn't actually reset, it is for the duration of that DOS box, so Access will see whatever the user tells it to see. Far safer, in my opinion, is to use the GetUserName API call. See http://www.mvps.org/access/api/api0008.htm at "The Access Web" for a complete sample. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) Show quote "Rocky" <rocco***@aol.com> wrote in message news:FFACC60D-627B-4A4B-B597-D6261725AAA8@microsoft.com... > 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" <rocco1***@hotmail.com> > 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@noemail.noemail> wrote in message >> news:eTrWtPGKIHA.5224@TK2MSFTNGP02.phx.gbl... >>> Is 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 >>> Thanks Rocky and Doug! I will check out what is possible with these
options. --Tony crack window vista
Show quote "Anthony Bollinger" <tonyb@noemail.noemail> wrote in message news:eTrWtPGKIHA.5224@TK2MSFTNGP02.phx.gbl... > Is 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 > |
|||||||||||||||||||||||