Hi,
When I enter roll no in (which is available in query) text1.text the report is generated. but when i enter another number not available in query then runtime error window appears.
I know the code to search the database and show the message.
(eg. if rs.eof then
msgbox "not available"
else
<next command> ..)
but what is the code to search the query so that if I enter fake no then message like "record not available" shold promt.
So will anyone help me so solve the problem.

(Kehar)

use the following code :-

dim rs as new adodb.connection
dim str as string
dim conn as new adodb.connection

conn="<your db connection string>"

''the following becomes the query string to be passed to the recordset object
str="select * from student where roll_no in(10,20,30)"
rs.open str,conn,1,2       ''opening the recordset to fetch data from the student table

if rs.recordcount>0 then           ''some records found
       msgbox "record found."
else           ''no matched data found
       msgbox "the rollno supplied by you is not found in the specified values parsed into the query string."
endif

hope this will help you in some context.
regards
Shouvik

By the way what about your crystal report project? did you finish it?

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.