954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to pass querystring to crystal report

Hi, all this is my question:-

I am creating a double tier vb6 application with access in format 7.0 mdb. For this application i'm creating reports using crystal report 9. Now i want to show the report to view data from tables after passing some criteria.

I have a table called Quotation. There i'm storing 'quot_no ' as the primary key. Now i want to select an quotation no. from my vb6 apps and then the report will be called to show the data for the selected quotation no. only.

So, how can i do that?
Is there a way or do i have to convert my database to network db such as sql server?

Plz Reply me soon.
It's very urgent

choudhuryshouvi
Posting Pro
553 posts since May 2007
Reputation Points: 30
Solved Threads: 49
 

try the following code

Public Sub DailyReportDisplay(Query As String)
Set CRXReport = CrystalReport2
Set CRXDb = CRXReport.Database
CRXReport.DiscardSavedData
inti = 1
Do Until inti = CRXReport.Database.Tables.count + 1
CRXReport.Database.Tables.Item(inti).SetLogOnInfo strdblocation, "das", "debasis", "debasis"
inti = inti + 1
Loop
CrystalReport2.SQLQueryString = Query
With FrmReport
.Show
.CRV1.ReportSource = CRXReport
.CRV1.ViewReport
End With
Set CRXReport = Nothing
End Sub


the above code uses crystal report viewer.

u need to add crystal report library and a crystal report viewer.

The above is for Oracle connection.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

ok i have understood the coding. but my question was from msaccess point of view. now could u plz tell me which portion of the code should i need to modify to make it fit for accessing msaccess database.

choudhuryshouvi
Posting Pro
553 posts since May 2007
Reputation Points: 30
Solved Threads: 49
 

I use datareport instead of crystal report o if you want try this out...
http://www.martin2k.co.uk/forums/index.php?act=Attach&type=post&id=1134

jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 
I use datareport instead of crystal report o if you want try this out... http://www.martin2k.co.uk/forums/index.php?act=Attach&type=post&id=1134


Hi jireh,
i didn't find anything there which could answer my question. Can you tell me the steps or some example codings?

choudhuryshouvi
Posting Pro
553 posts since May 2007
Reputation Points: 30
Solved Threads: 49
 

No, the answer is all there. first in your mdb file, you must create first a query, 2nd in VB in Data Environment you must configure it because there you will connect to the database. then get your query and make some code in your form. please browse my sample program.

jireh
Posting Whiz
316 posts since Jul 2007
Reputation Points: 11
Solved Threads: 49
 
No, the answer is all there. first in your mdb file, you must create first a query, 2nd in VB in Data Environment you must configure it because there you will connect to the database. then get your query and make some code in your form. please browse my sample program.



JIREH...............
ok man. i searched there again but found nothing. plz do me a favour. could u attach ur sample program here plz plz plz...............

plz help me out
its very very urgent

choudhuryshouvi
Posting Pro
553 posts since May 2007
Reputation Points: 30
Solved Threads: 49
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You