Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21273

Date Expiration

$
0
0
I'm making a Library system with Accounts logging in but it should not be exceeded to the date validation or expiration.

here's my code

Code:

Call bok


If Text1.Text = "" Then
MsgBox "Please Enter Your Username", vbCritical

Else

If Text2.Text = "" Then
MsgBox "Please Enter Your Password", vbCritical

Else

Set rs = New ADODB.Recordset
sql = "SELECT STUDREC.stid, STUDREC.fullname, tblacnt.uname, tblacnt.pword, tblrle.role, tblmem.dte_valid" & _
" FROM ((STUDREC INNER JOIN tblacnt ON STUDREC.stid = tblacnt.userid) INNER JOIN tblmem ON STUDREC.stid = tblmem.userid)" & _
" INNER JOIN tblrle ON STUDREC.stid = tblrle.userid" & _
" WHERE tblacnt.userid = tblrle.userid And" & _
" tblacnt.userid = tblmem.userid And" & _
" tblacnt.uname = '" + Text1.Text + "' And tblacnt.pword = '" + Text2.Text + "'"

With rs
.CursorLocation = adUseClient
.Open sql, con, adOpenStatic, adLockOptimistic

End With
   


  If rs.RecordCount > 0 Then
    If rs.Fields("dte_valid") < Date Then
    MsgBox "Account Expired", vbOKOnly
    Form4.Label4.Enabled = True



Else

If rs.Fields("role") = "Administrator" Then
   
    Form4.Label21.Caption = rs.Fields("fullname")
    Form4.Label3.Caption = rs.Fields("role")
    Form4.Label4.Caption = "LOGOUT"
    Form4.Label4.Enabled = True
    Form4.Frame5.Visible = True
    Form4.Frame3.Visible = True
    Form4.Shape3.Visible = True
    MsgBox "Welcome!", vbInformation, "Success!"
    Unload Me
   

If rs.Fields("role") = "Member" Then

    Form4.Label3.Caption = rs.Fields("role")
    Form4.Label21.Caption = rs.Fields("fullname")
    Form4.Label4.Caption = "LOGOUT"
    Form4.Label4.Enabled = True
    Form4.Frame5.Visible = True
    MsgBox "Welcome!", vbInformation, "Success!"
    Unload Me

Else

MsgBox "Account Not Found", vbCritical, "Please Try Again"

End If
End If
End If
End If
End If
End If



End Sub



can someone point out whats wrong with my codes? Messagebox won't show if the account is expired or not but it won't log in if expired.. just the messagebox :(

thanks for the help.

Viewing all articles
Browse latest Browse all 21273

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>