hello experts

rec.Open "select * from tbl where id="& inputted, con, 2, 3

i used the above code to find records and now the real problem occures when a value is inputted and that doesn't exist in the database so in such a case i wanna display en error message

so how to decide whether record found or not

Recommended Answers

All 3 Replies

If rec.EOF = True Or rec.BOF = True Then
    MsgBox "No Records Found."
End If

Your sql statement is also open to errors...

rec.Open "SELECT * FROM tbl WHERE id=" & inputted & "'", con, 2, 3

thanks for your reply and your answer

but inpuutted always will be a number thats why i did so ....

Ok, no problem then. If this answered your question as to checking if a record has been returned, please mark it as solved, thanx.

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.