Solved

how do i get it to print ?

Posted on 2000-03-21
9
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Add a task in Outlook from access 11 43
clicking a shape in a frame array vb6 3 55
Advice in Xamarin 21 121
Email Excel WB by selecting name from a dropdown  list to Outlook. 5 47
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

752 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