Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how do i get it to print ?

Posted on 2000-03-21
9
Medium Priority
?
158 Views
Last Modified: 2012-05-04
like this, i has 1 crystal report and 1 data control and 1 123.rpt file.

and i using the below code .

CR1.ReportFileName = "C:\ZERO\123.RPT"
CR1.PrintFileName = "C:\ZERO\123..RPT"
CR1.RetrieveDataFiles
CR1.Action = True

that will print all the data in that database.

but what i want is it just print the data that i just selected by using the below code

 cr1.SQLQuery = "SELECT * FROM comp " & strWhere1 & strwhere2 & strWhere3 & strwhere4 _
  & strWhere5 & strwhere6 & strWhere7 & strwhere8 & strwhere9

CR1.ReportFileName = "C:\ZERO\123.RPT"
CR1.PrintFileName = "C:\ZERO\123.RPT"
CR1.RetrieveDataFiles
CR1.Action = True

but y i didnt print the data that i select by using the sql statement ?

i hope u understand n find a way to help me .


thanks

0
Comment
Question by:JOHNHO
9 Comments
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 2640275
create another table\query containing only the fields you need to display.
0
 

Author Comment

by:JOHNHO
ID: 2640377
can u give me the other solutions ?

if i do that, i will still get the same the same results.
0
 

Author Comment

by:JOHNHO
ID: 2640416
can u give me the other solutions ?

if i do that, i will still get the same the same results.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:jonder
ID: 2640831
cr1.SQLQuery = "SELECT * FROM comp " & strWhere1 & strwhere2 & strWhere3 & strwhere4 _
  & strWhere5 & strwhere6 & strWhere7 & strwhere8 & strwhere9

CR1.ReportFileName = "C:\ZERO\123.RPT"
CR1.PrintFileName = "C:\ZERO\123.RPT"
cr1.SQLQuery = "SELECT * FROM comp " & strWhere1 & strwhere2 & strWhere3 & strwhere4 _
  & strWhere5 & strwhere6 & strWhere7 & strwhere8 & strwhere9
CR1.RetrieveDataFiles
CR1.Action = True
CR1.REFRESH
0
 
LVL 1

Expert Comment

by:simonstre
ID: 2641076
can u display what's in strWhere1, strWhereX ?
0
 
LVL 5

Accepted Solution

by:
Voodooman earned 100 total points
ID: 2644019
You cant  change the query in Crytstal reports apart from the where clause.

Its in the documentation.

What you should be doing is changing the selection formula.


like this

MyReport.ReplaceSelcetionFormula=""

MYReport.ReplaceSelectionFormula ("{Q_ViewStockTransactions.Type} = 'Sale')

If you want to pass a variable

MyReport.ReplaceSelectionFormula ("{Q_ViewStockTransactions.Type} = '" & SelectOptions & "'")

Set up the selection formula that works in the designer and copy it is a good starting point.

This is absolutely the right way to do it.

Voodooman!
0
 

Author Comment

by:JOHNHO
ID: 2644839
fails .

pls be more specific.


increase points if success.

thanks
0
 
LVL 5

Expert Comment

by:Voodooman
ID: 2648371
From Voodooman

OK!

I assume you are using the Crystal Report Designer to design a report.

Design your report without any selection.

Now from the Report Menu choose Select Expert.

Select a field

Now Click Show Formula

Now you will see the formula building.

Now copy the formula by highlighting it and using Ctrl+C.

Example: {Label_Temp.Label} = "Voodoo"

Now remember to change the quotes like this so VB can use


Change to {Label_Temp.Label} = 'Voodoo'

Using the Code I have given You paste in the selection Criteria

MyReport.ReplaceSelectionFormula ("Put Your Selection Formula between these quotes")


To get something like this:
MyReport.ReplaceSelectionFormula ("{Label_Temp.Label} = 'Voodoo'")

When you have this working you can start to change the Select string with your variables.

Also always remember when you save your report in the designer to make sure that the 'Save Data with Report' is not selected.

Good Luck

Voodooman!!
0
 

Author Comment

by:JOHNHO
ID: 2679459
sorry a lot to voodoman.
im a munch munch more stupid and not an easy understan person please forgive me.

can u explane it more details.

how about u do it for me.

i has 3 field .
which is computer type and id number and person incharge.

that 3 field include in abc.mdb databse.


so how do i ask it to show in crystal report the thing i had sort it.

pls show the full one because i just need to copy the formula only and show me where do i go and how do i get it.

for previous solution i just can go to select formula then dont know where to go.

pls help me and i will increase the points for u.


thanks a lot.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question