Reply
username and password
Old 09-05-2006, 10:02 AM username and password
lushh's Avatar
Novice Talker

Posts: 10
Name: Eunice
hi.. i am working on a system and it needs a username and password for security. i am using ms access 2003. and my form looks like this:



the user will enter a username and password in order to get into the system. the system will have 2 or more users. i just wanna ask if anyone has a sample VBA code for this kind of form. your replies wil surely be appreciated. thank you very much.
lushh is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 09-06-2006, 08:32 AM Re: username and password
Rufo's Avatar
Extreme Talker

Posts: 173
The easiest (but not best!) way to do this would be using a case/if combo:
Code:
Private Sub cmdLogin_Click()

  un = txtUsername.Text
  pw = txtPassword.Text

  ok = False

  Select Case un
    Case "user1"
      If pw = "pw1" Then ok = True
    Case "user2"
      If pw = "pw2" Then ok = True
    Case "user3"
      If pw = "pw3" Then ok = True
  End Select

  If ok Then
    'login was ok - do something
  Else
    'login was not ok - do something else
  End If

End Sub
Rufo
__________________
mp3blog.us
Rufo is offline
Reply With Quote
View Public Profile Visit Rufo's homepage!
 
Old 09-06-2006, 09:48 PM Re: username and password
lushh's Avatar
Novice Talker

Posts: 10
Name: Eunice
thanks for the reply. it really did help.. =)
lushh is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to username and password
 

Thread Tools

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12515 seconds with 12 queries