Private Sub cmdgo_Click()

//txtsearch.text is where you going to input student number and the StudentNo is database field name or should i say it is table name the one that contains student number

If txtsearch.Text = StudentNo Then

Data1.Recordset.OpenRecordset //hmm... i made this cause it looks like its going to find what i need

End If

err1 = MsgBox("Student number did not found!", vbExclamation + vbOKOnly, "Error")
If err1 = vbOK Then
End If

End Sub

//need help pls correct my code

Edited 7 Years Ago by Ghost34: n/a

you need to open the recordset by passing the value at runtime dynamically. Use count to find the number of records in the recordset. If it is >0 then process further else display your message box

i got no idea left in my head can you make it easier?
i dont know what runtime dynamically your saying >_<

i dont use SQL and i think thats going to be teach to us by our prof in 3rd year i think..for now im using access 97

try something like this "select count(student_id) from students where student_id=" & std_id

if it returns >0 then proceed further.

i already got what i need but i still got problem in browser button i have no i idea on that to put picture

this is my code in search button

Private Sub cmdgo_Click()

If Data1.Recordset.NoMatch = False Then
Data1.Recordset.FindFirst "StudentNo = '" & txtsearch & "'"
End If

If Data1.Recordset.NoMatch = True Then
stn = MsgBox("Student Number Not Found!", vbExclamation + vbOKOnly, "Error")
End If

End Sub

for me i suggest to be familiar with file streaming. Once u have file streaming learnt. YOu can just open a file write values there close it and open search it anyway you want. I don't use SQL i create my own database handling routines.. such as add, find, and delete to a record. Frank

This article has been dead for over six months. Start a new discussion instead.