Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

help! database check

hi guys! im doin a program that if the user logged-in to computer and someone also input the same account number, the system will locate the code on the database,if the code is already entered... a window will prompt that the code is already logged in.. and it will not continue...

here is my code.. if the user entered his account code his name will appear on the window and if he click the button it will continue to the next page... my 2nd question, where will i put the code that i askeD? tnx guys!

Private Sub cmdCancel_Click()
Unload Me
frmMenu.Enabled = True
frmMenu.Show
End Sub

Private Sub cmdGo_Click()

Dim moo As String
If txtclassno.Text = "" Then
moo = MsgBox("Please fill out the fields!", vbExclamation)
Exit Sub
End If
Call lname
txtclassno.Text = ""
frmAddRecord.lblstudname.Caption = ""
End Sub
Private Sub lname()
tclassno = txtclassno.Text
opn_sql
sqlcmd = "Select * from studlist where (CLASSNO = '" & tclassno & "');"
Set rst = cnn.Execute(sqlcmd)
If Not rst.EOF Then
frmStudentRecord.Show
frmStudentRecord.lblStno.Caption = rst("STUDNO")
frmStudentRecord.lblClno.Caption = rst("CLASSNO")
frmStudentRecord.lblFName.Caption = rst("NAMEFIRST")
frmStudentRecord.lblLName.Caption = rst("NAMELAST")
Else
moo = MsgBox("No Record Found!", , "Search Error")
txtclassno.Text = ""
End If

cls_sql
End Sub

Private Sub Form_Load()
frmMenu.Enabled = False
End Sub

Private Sub txtclassno_Change()
If Len(txtclassno.Text) = 4 Then
Clno = txtclassno.Text
opn_sql
sqlcmd = "Select * from studlist where CLASSNO = '" & Clno & "';"
Set rst = cnn.Execute(sqlcmd)
If Not rst.EOF Then
frmAddRecord.lblstudname.Caption = rst("namelast") + ", " + rst("namefirst")
Else
moo = MsgBox("No Record Found!", , "Search Error")
txtclassno.Text = ""
End If
cls_sql
End If
End Sub
[2028 byte] By [mackyboy07] at [2007-11-11 6:49:19]