|
-
Jul 26th, 2000, 12:12 PM
#1
Thread Starter
Hyperactive Member
I have a crystal reports (6) control set up correctly in a VB 6 program. I pass it a report which is bound to a table in a database. So far so good.
What i want to do is select 1 row in the table and print that. At the moment i get a report for each row in the table.
I`ve tried setting the SQLQuery property to something sensible but it ignores me.
Does anyone know how to do this?
Thanks,
alex.
-
Jul 27th, 2000, 08:26 AM
#2
Thread Starter
Hyperactive Member
Well, i`ll have a play around with what you`ve put, but i dont understand what you mean about selecting 100 fields...
I have a report that is already created. It takes values from a database. There is 1 table in the database, called trans. Trans has 8 rows. I need a way of saying `i want row 4`. At the moment i dont know how to do this, and when i just set the crystal controls action to 1, it prints a report for each (of the 8) row(s).
I`ve not made much difference by playing around with the SQLQuery property. Do i have to change the report, or is that fine and i just have to pass the crystal control some parameters?
Thanks,
alex
-
Jul 27th, 2000, 08:42 AM
#3
I beleive that what you need is the SelectionFormula property of the CrystalReport control. Although I've used Crystal a lot, I haven't used this property. To do the kind of thing you're talking about, I would generally base the report on a query when I built the report, then in VB re-generate the query dynamically (based on whatever values the user enters at run-time), then run the CrystalReport (which would then be based on the dynamically built query).
Anywho, this SelectionFormula looks pretty useful. From the Crystal help, it looks like you would want to do something like this:
Code:
CrystalReport1.SelectionFormula = "{MyTable.MyField} = 'Whatever'"
CrystalReport1.Action = 1
BTW, the Action property has nothing to do with record selection; the value 1 just tells CR to run, or generate, the report.
Try this and post again to let me know how you make out with this.
"It's cold gin time again ..."
Check out my website here.
-
Jul 27th, 2000, 11:31 AM
#4
Thread Starter
Hyperactive Member
Hi,
this is my first `experience` of crystal reports. I dont like it much; i almost created the form in html using a text control, but i`d started already and created the form in crystal reports, so....
but your SelectionFormula idea worked, so thanks! I almost implemented a version of your query idea, except i was going to create a temp table in access instead. Basically, anything to avoid using crystal reports! The help keeps going on about creating stuff at runtime, and all i wanted to do was pass 1 single param into the report. The SelectionFormula property avoids the need for that!
Thanks again,
Alex.
-
Jul 27th, 2000, 03:26 PM
#5
Hyperactive Member
Err. sorry
I would have suggested including a WHERE clause in your SQL (which may have led you to a solution) but I had not fully appreciated that you were after a specific row.
If you are ever after a specific row, you must know something about that row so yes, something like "SelectionFormula" would be where I look.
My previous reply was suggesting a way to extract just the first row from a query, and the comment about the number of fields was just FYI.
It's good that someone knew how to help you properly 
Cheers
Paul Lewis
-
Jul 28th, 2000, 03:55 AM
#6
Thread Starter
Hyperactive Member
Are you talking about the SQLQuery property of the crystal report? Because i put in some nonsense to test whether it was being used at all, and i got the impression it wasnt! Is the SQLQuery executed by setting Action to 1 or do you have to do something else to get it to run?
Thanks anyway!
Alex.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|