Private Sub Form_Load()
s = InputBox("please enter staff id")
t = InputBox("please enter your password")
Set db = OpenDatabase("C:\Program Files\Microsoft Visual Studio\VB98\my new prj\prj1.mdb")
Set rs = db.OpenRecordset("staffper", dbOpenDynaset)
Set ro = db.OpenRecordset("timetable", dbOpenDynaset)
Set rm = db.OpenRecordset("staffattend", dbOpenDynaset)
Set rt = db.OpenRecordset("staffmsg", dbOpenDynaset)
Set rp = db.OpenRecordset("staffpass", dbOpenDynaset)
'rs.MoveLast
'While rs.Fields(6) <> s And rs.BOF = False
'rs.MovePrevious
'Wend
'If rs.BOF = True Then
'MsgBox ("check your id")
'End If
'ro.MoveLast
'While ro.Fields(40) <> s And ro.BOF = False
'ro.MovePrevious
'Wend
'If ro.BOF = True Then
'MsgBox ("check your id")
'End If
'ro.MoveLast
'lab: If (ro.Fields(40) <> s) Then
'ro.MovePrevious
'GoTo lab
'End If
rs.MoveLast
lab1: If (rs.Fields(6) <> s) Then
rs.MovePrevious
GoTo lab1
End If
If s = rs.Fields(6) And t = rp.Fields(1) Then
MsgBox ("welcome")
Else
MsgBox ("access denied")
Form27.Show
Unload Me
End If
rt.MoveLast
lab2: If (rt.Fields(0) <> s) Then
rt.MovePrevious
GoTo lab2
End If
For i = 0 To 39
Label1(i).Caption = ro.Fields(i)
Next i
Label16.Caption = ro.Fields(40)
Label18.Caption = rs.Fields(0)
Label20.Caption = rm.Fields(2)
Label22.Caption = rm.Fields(1)
If rt.Fields(1) = " " Then
Label23.Visible = False
Label24.Visible = False
Label26.Visible = False
Else
Label23.Caption = rt.Fields(1)
End If
End Sub
can some one pls find the fault in there,,,the problem is that i always get the msgbox which says access denied,,,,here "s" is the id and "t" stores the password,,,i check it wid the correspondin table,,but yet i get a access denied error,,,,,im about to correct all the codes type i've declared cos vb5 prgmer already told me abt tat,,i'l do it,,but i hv this piece of thing buggin me,,,i dono wats the prob,,,,pls,,some one help me out,as soon as possible,,,