connecting and passing query in VB6 and CR
Sir, I have prepared programme using VB6 and Access2003. The programme is working very fine so far as adding,deleting,modifying the record through VB is concerned. I have installed Crystal Report 8.5 and have prepared a report and save as (bill.rpt) but I dont know how to connect the report with VB. The path of report is C:\ks\bill.rpt and path of database in Access is C:\ks\exp.mdb
I shall be grateful if you kindly help me
1. to connect the report with VB and
2. to pass a query in which if I enter America in Text1.text in VB and Click the command button VIEW the report should generate only the name and age of all the person who live in America within the field (address).
The Data base fieldname are Name, age and address
I am very new to CR so pl write all the code to write within the click event procedure of command button VIEW so that I may not add anything else.
thanking you in anticipation
Keshar
kehar
Junior Poster in Training
72 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
Sir,
thanks for your reply
I am very new to CR so I could not understand second part of your reply starting from
create query ....
I know how to prepare DSN in database
for your information I am giving you some hints
my dsn is exp
my database file path is C:\home\exp.mdb
database field are billno, chequeno, chequedt,month
In vb form I've placed crystal report control , one text box (text1.text) and one command window.
my problem is - when I run the VB and type "January" in text1.text and click the command botton the report should contain all billno,chequeno,chequedt pertaining to the month of January
similarly if I write February the report should contain all billno,chequeno,chequedt pertaining to the month of February.
I know the query statement to retrieve data from database to grid in VB that is written as :-
Select * from exp where month=' " & text1.text & " '
but I dont know the statement to retrieve the data from the Report
So I shall be grateful if you write the step by step procedure. I am dummy so far as CR is concerned.
kehar
Junior Poster in Training
72 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
Sir,
thanks for your reply
I am very new to CR so I could not understand second part of your reply starting from
create query ....
I know how to prepare DSN in database
for your information I am giving you some hints
my dsn is exp
my database file path is C:\home\exp.mdb
database field are billno, chequeno, chequedt,month
In vb form I've placed crystal report control , one text box (text1.text) and one command window.
my problem is - when I run the VB and type "January" in text1.text and click the command botton the report should contain all billno,chequeno,chequedt pertaining to the month of January
similarly if I write February the report should contain all billno,chequeno,chequedt pertaining to the month of February.
I know the query statement to retrieve data from database to grid in VB that is written as :-
Select * from exp where month=' " & text1.text & " '
but I dont know the statement to retrieve the data from the Report
So I shall be grateful if you write the step by step procedure. I am dummy so far as CR is concerned.
kehar
Junior Poster in Training
72 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
The Zip file is not opening even after log in with daniweb as such I once again request your goodself to send the zip file at my email id - [email]kehar2005@gmail.com[/email] as attach file ple.
Thanks
K.S. Chhetri
kehar
Junior Poster in Training
72 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
yes, download over and extracted the file and I have to try with my programme. I will see it tell you later.
thanks
k.s
kehar
Junior Poster in Training
72 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
Sir,
When I run the programme prepared by you the following error is shown
Run time error 20599
Cannot open SQL Server
So what is this error how is this rectified.
secondly when I tried to open your report only and tried to see the preview it ask for number of things how is this prepared and why ?
K.s.
kehar
Junior Poster in Training
72 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0
Sir,
Your programme is working fine but I think I am missing something while preparing report.
I am writing the procedure that I am following to create the report pl see it and pl inform me where I am wrong and what is still left.
1. After creating the DSN of the database I close the access and switch over to CR
a. open the CR and select the as a blank radio botton >click OK.
b. Data explorer window open > expand the ODBC >further expand the DSN name>select the database file >click Add botton and Close it.
c. In field explorer window >expand the database field >select file name>select the field one by one and place it under details section of report and close the field explorer window.
d. Save the report as exp.rpt.
So it the above procedure true ? If not then pl mention the other steps in detail. this is because when I open your report alone and try to see preview I could not see. Whereas when I open my report alone I can see it in preview mode. So some thing is wrong in my report.
Waiting for your valuable suggestion.
thanks
kehar
Junior Poster in Training
72 posts since Sep 2007
Reputation Points: 10
Solved Threads: 0