PC Review


Reply
Thread Tools Rate Thread

Checking user's credentials

 
 
IgorM
Guest
Posts: n/a
 
      8th Apr 2010
Hi

I build an app in Excel where user is obligated to enter a user name and
password. If the given user name with password exists in an Access database
the application will start.
But how to check if the given user (with such password) exists in the mdb
file? I wouldn't like to try to run a random query to see if it returns
results. I was rather thinking about something more advanced - a solution
that checks only the user name and password. In VBA of course.


Kind regards
IgorM

 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      8th Apr 2010
On Thu, 8 Apr 2010 07:52:54 +0200, "IgorM" <(E-Mail Removed)> wrote:

>Hi
>
>I build an app in Excel where user is obligated to enter a user name and
>password. If the given user name with password exists in an Access database
>the application will start.
>But how to check if the given user (with such password) exists in the mdb
>file? I wouldn't like to try to run a random query to see if it returns
>results. I was rather thinking about something more advanced - a solution
>that checks only the user name and password. In VBA of course.
>
>
>Kind regards
>IgorM


So use a query with the desired username and password as parameters. That's
hardly a "random query". You may also be able to use the DLookUp function.

--

John W. Vinson [MVP]


 
Reply With Quote
 
IgorM
Guest
Posts: n/a
 
      8th Apr 2010
Ok. But what if I want to check the group which the user belongs to?


Uzytkownik "John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> napisal w
wiadomosci grup dyskusyjnych(E-Mail Removed)...
> On Thu, 8 Apr 2010 07:52:54 +0200, "IgorM" <(E-Mail Removed)> wrote:
>
>>Hi
>>
>>I build an app in Excel where user is obligated to enter a user name and
>>password. If the given user name with password exists in an Access
>>database
>>the application will start.
>>But how to check if the given user (with such password) exists in the mdb
>>file? I wouldn't like to try to run a random query to see if it returns
>>results. I was rather thinking about something more advanced - a solution
>>that checks only the user name and password. In VBA of course.
>>
>>
>>Kind regards
>>IgorM

>
> So use a query with the desired username and password as parameters.
> That's
> hardly a "random query". You may also be able to use the DLookUp function.
>
> --
>
> John W. Vinson [MVP]
>
>

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      8th Apr 2010
On Thu, 8 Apr 2010 08:31:54 +0200, "IgorM" <(E-Mail Removed)> wrote:

>Ok. But what if I want to check the group which the user belongs to?


Well, include that in the query.

I'm groping in the dark here, Igor, because you haven't posted anything about
the structure of your tables, where the group and user information is stored,
etc. Is this Access Workgroup security, or something you've implemented
yourself?
--

John W. Vinson [MVP]
 
Reply With Quote
 
IgorM
Guest
Posts: n/a
 
      9th Apr 2010
Appologies for not being too specific. I set a password for the Admin
account in the database. So when I try to open the file in Windows Explorer
a userform pops up asking for user name and password. if I don't provide
them it shuts down the database. So when user types her user name and
password I'd like to query the database for the collection of groups the
user belongs to.
I wrote a macro as below. I'll copy and past my other post:

I have an access mdb file with an Admin user and a password set for the
user. So basically when I try to open the mdb file in Windows Explorer a
userform pops up
asking to provide user name and password for the database. If I don't
give a correct password or user name I cannot access the file. I tried
to use this in Excel VBA (see code below). It takes a user name and
password from a userform, connects to the database and retrieves each
table name. Unfortunately, if I provide a password (ie the same password
when opening the file through Windows Explorer) I cannot access the
file. I get an error: "Cannot start your application. The workgroup
information file is missing or opened exclusively by another user."

But if I leave the password blank it connects to the database and
retrieves table names. Why is that?

Private Sub cmdLogIn_Click()
Dim objCatalog As ADOX.Catalog
Dim objTable As ADOX.Table

Set objCatalog = New ADOX.Catalog

' Check if the database file path is set. If Not Len(gsDatabaseFilePath)
> 0 Then MsgBox gsMSG_DATABASE_FILE_NOT_SPECIFIED, vbInformation +
> vbOKOnly, gsAPP_NAME

Exit Sub
End If

On Error GoTo ErrorHandler ' Check if user name is not a null string. If
Len(txtUserName.Text) > 1 Then gsDatabaseConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0; " & _ "Data Source=" &
gsDatabaseFilePath & "; " & _ "User ID=" & txtUserName.Text & "; " & _
"Password=" & txtPassword.Text objCatalog.ActiveConnection =
gsDatabaseConnectionString

For Each objTable In objCatalog.Tables MsgBox objTable.Name
Next objTable
Exit Sub
Else MsgBox gsMSG_WRONG_CREDENTIALS, vbInformation + vbOKOnly,
gsAPP_NAME Exit Sub
End If

ErrorHandler: MsgBox gsMSG_WRONG_CREDENTIALS & " " & Err.Description,
vbInformation + vbOKOnly, gsAPP_NAME

End Sub


Uzytkownik "John W. Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> napisal w
wiadomosci grup dyskusyjnych:(E-Mail Removed)...
> On Thu, 8 Apr 2010 08:31:54 +0200, "IgorM" <(E-Mail Removed)> wrote:
>
>>Ok. But what if I want to check the group which the user belongs to?

>
> Well, include that in the query.
>
> I'm groping in the dark here, Igor, because you haven't posted anything
> about
> the structure of your tables, where the group and user information is
> stored,
> etc. Is this Access Workgroup security, or something you've implemented
> yourself?
> --
>
> John W. Vinson [MVP]


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 checking for network credentials??? Sergej Prokoviev Microsoft Outlook Discussion 0 24th Jan 2007 05:07 PM
Outlook 2003 hangs when checking Exchange credentials chris@axtionsystems.net Microsoft Outlook 0 14th Dec 2006 07:13 PM
Can a service account be embedded in Workbook so that by default the macros are run with service account credentials and not the user credentials??? Divya Sanam Microsoft Excel Misc 0 20th Jul 2006 05:15 PM
Download user credentials and create a user profile locally via API - possible? Ga Windows XP Security 0 21st Jan 2005 08:55 AM
Download user credentials and create a user profile locally via API - possible? Ga Windows XP Setup 0 21st Jan 2005 08:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:56 AM.