Click to See Complete Forum and Search --> : problem with SelectionFormula in Crystal Report Ctrl.
pos
May 8th, 2001, 10:17 PM
Developed a report in Crystal report using 5 tables having primary key and foreign key relationship among them. using Crystal report control 4.6 in VB, it prints whole the records of all the dept in the Crystal Report's Query but have to print the employee records of the only one department.
co-operate me.
Cimperiali
May 9th, 2001, 02:52 AM
I have crystalReport 8.0 so maybe this do not apply to you. But have a try with this kind of sintax:
Dim sql As String
'reset control do discard old saved invormation
Cr1.Reset
'report pathName
Cr1.ReportFileName = "D:\Condivisa\report\Report04.rpt"
'type of report= use crystalreport type
Cr1.ReportSource = 0
'discard stored data
Cr1.DiscardSavedData = True
'change -if you wish - a where clause
sql = "{persona.Cognome}='Imperiali'"
Cr1.SelectionFormula = sql
'make it print: two ways
Cr1.Action = 1
'or:
'myvar = Cr1.PrintReport
'MsgBox myvar
another thing that may help you:
'(Special thanks to SurrenderMonkey for this)
'A simply report with one parameter field
'called SelectMe in a omit formula for a section.
'Matter is not to make the selection (I can workaround using
'formulas). Matter is to pass a parameter value to a rpt file
'through Ocx - or: to make parameter fields to be filled
'via code form VB.
Cr1.Reset
Cr1.ReportFileName = "D:\Condivisa\Cesarevb\Crystol\cryweb\Report1.rpt"
Cr1.ReportSource = 0
Cr1.DiscardSavedData = True
Cr1.ParameterFields(1) = "SelectMe;1;false" 'parameter field name={?SelectMe}
'Cr1.ParameterFields(0) = "SelectMe;1;false"
Cr1.Action = 1 'make it print
Special thanks to Lothar "the Great" Haensler, Tom Archer, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
pos
May 9th, 2001, 07:34 AM
Again thanx for quick reply from nice guy like u.
Thanx for u have send me coding, I was prefering coding only.
Thanking u.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.