Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Control Logins from and Access Database

Posted on 1998-12-27
2
Medium Priority
?
167 Views
Last Modified: 2010-05-03
Does anybody have code available to Use the standard VB5 Login screen with a table of users and passwords from and Access 7.0 db.
0
Comment
Question by:dwadswor
2 Comments
 
LVL 3

Expert Comment

by:Sendoh
ID: 1452578
Hi !
Is it what you need here is the sample code on how to create login screen ??
If so please post your e-mail add and if not, state cleary what is your problem.

Thanks.
0
 
LVL 2

Accepted Solution

by:
cedricd earned 200 total points
ID: 1452579
here is the code i put on the visual basic login screen

Public cpt As Integer

Private Sub Bt_Cancel_Click()
    Continue = True
    Unload Me
    Util = ""
    Ok = Close_All
End Sub

Private Sub Bt_OK_Click()

    Dim poub As Integer
    Dim nb As Double
    Dim Fstatus As String
   
    Me.MousePointer = vbHourglass
   
    Util = UCase(Utilis.Text)
    If Not Already_Logged Then
       poub = 0
       Call Search_Dpt
       Fstatus = Find_Status
       If Fstatus = MANAGER Or Fstatus = GENMAN Then
          poub = Dpt
          Dpt = NUM_MAN
       End If
       Fstatus = Trim(Fstatus)
       If Fstatus = "VDR" Or Fstatus = "Guest" Or Fstatus = MANAGER Or Fstatus = GENMAN Or _
          Fstatus = "SPECIAL" Then
          If Dpt <> 0 Then
             If Password.Text = "" Then
                Password.Text = " "
             End If
             nb = crypt(Password.Text)
             If Not Verif_Passwd(nb) Then
                rc = MsgBox("Incorrect Password", vbCritical)
                Password.Text = ""
                Password.SetFocus
                cpt = cpt + 1
             Else
                Change_Done = True
                Ok = Init_Langage
                If Not Ok Then
                   Langage = "UK"
                End If
                Niveau = Find_Niveau
                Call logged(True)
                Continue = True
                Unload Me
             End If
          Else
             rc = MsgBox("User unknow ! Retry ", vbCritical)
             Utilis.Text = ""
             Password.Text = ""
             Utilis.SetFocus
             cpt = cpt + 1
          End If
       Else
             rc = MsgBox("You don't have the autority to run this program ! ", vbCritical)
             Utilis.Text = ""
             Password.Text = ""
             Utilis.SetFocus
             cpt = cpt + 1
       End If
       If poub <> 0 Then
          Dpt = poub
       End If
       If cpt > 2 Then
          Unload Me
       End If
    Else
           rc = MsgBox("This user is already logged !")
           Utilis.Text = ""
           Password.Text = ""
           Utilis.SetFocus
    End If
    Me.MousePointer = vbDefault
   
End Sub

Private Sub Form_Activate()
    Me.MousePointer = vbDefault
    Utilis.SetFocus
End Sub

Private Sub Form_Load()
    Change_Done = False
    cpt = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Me.MousePointer = vbDefault
End Sub

Private Sub Password_KeyPress(KeyAscii As Integer)
    Dim nb As Double
   
    If KeyAscii = 13 Then
       Call Bt_OK_Click
    End If
   
End Sub

Private Sub Utilis_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
       Password.SetFocus
    End If
End Sub

Function Verif_Passwd(nbre As Double) As Boolean
   
    Dim rs As Recordset
   
    On Error GoTo Error_Db
    Set rs = db.OpenRecordset("Select * from " + ACSS + " where login = " + Str(Dpt), dbOpenDynaset, 0, dbPessimistic)
    If rs!passwd = nbre Then
       Verif_Passwd = True
    Else
       Verif_Passwd = False
    End If
    rs.Close
    Exit Function
Error_Db:
    Verif_Passwd = False
    rc = MsgBox(Err.Description, vbCritical)
    On Error Resume Next
    rs.Close
End Function

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question