0

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)

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by choudhuryshouvi
0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.