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
Form1.Show
End If

End Sub

//need help pls correct my code

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 >_<

do u know how to open a recordset in code by using SQL ?

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

plz check it.

try something like this

rs.open "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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.