8/23/2025 1:29:24 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Passing field value through to Crystal Reports
Posted: 29 Apr 08 8:18 AM
|
Hi,
I have a button on a form and I would like to use the value of a different field (called 'txtRANnumber') on the same form as selection criteria in the crystal report it generates. Without the selection criteria, the button works and the report generates as a PDF, but as soon as I add the selection criteria to the code, it doesn't work.
The specific code i'm having trouble with is :
Report.RecordSelectionFormula = _ "{RETURNS_AUTHORIZATION.RAN_NUMBER} = '" & _ txtRANnumber & "'"
Here is the full code i'm using:
Sub lueAccountClick(Sender) On Error Resume Next If Sender.LookupID <> "" Then objBasic.SetCurrentAccountID Sender.LookupID ErrorCheck Application.Translator.Localize("Error accessing SalesLogix VBScript functions:") End If On Error Goto 0 End Sub
Sub btnReportClick(Sender) Const crEDTDiskFile = 1 Const crTextObject = 2 Const crEFTPortableDocFormat =31
Const TemporaryFolder = 2
Dim Report Dim crxObject
Dim ReportFileName Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Dim tfolder Set tfolder = fso.GetSpecialFolder(TemporaryFolder) ReportFileName = fso.GetTempName & ".pdf" Set tfolder = nothing Set fso = nothing
Dim ReportName ReportName = "RAN:RAN - HS10 Form"
Set report = _ Application.BasicFunctions.GetCrystalReport(ReportName)
Report.RecordSelectionFormula = _ "{RETURNS_AUTHORIZATION.RAN_NUMBER} = '" & _ txtRANnumber & "'"
Report.ExportOptions.DestinationType = crEDTDiskFile Report.ExportOptions.DiskFileName = ReportFileName Report.ExportOptions.FormatType = crEFTPortableDocFormat
Report.Export False
Set Report = nothing
Dim ws Set ws = CreateObject("WScript.Shell") ws.Run ReportFileName, 1 Set ws = nothing
End Sub
Can anyone help?
Thanks,
Darren |
|
|
|
Re: Passing field value through to Crystal Reports
Posted: 29 Apr 08 8:59 PM
|
You can do this using formula fields, you have to loop through the rdc objects formulafields collection and when you find the right one set it, see below: my 'objRDC' is the same as your 'Report' variable.
while k <= objRDC.FormulaFields.Count if (objRDC.FormulaFields.Item(k).name = "{@FAXCOVERID}") then objRDC.FormulaFields.Item(k).text = chr(34) & strFaxCoverID & chr(34) end if k=k+1 wend |
|
|
|
Re: Passing field value through to Crystal Reports
Posted: 30 Apr 08 11:27 AM
|
Is "txtRANnumber" a variable, or are you referencing a control. If you're referencing a control, I think you may need to change the code to look at the text property:
Report.RecordSelectionFormula = _ "{RETURNS_AUTHORIZATION.RAN_NUMBER} = '" txtRANnumber.text & "'"
Also, if the value is numeric, you'll need to drop the single quotes.
Hope that helps,
Arminta |
|
|
| |
|
Re: Passing field value through to Crystal Reports
Posted: 01 May 08 5:30 AM
|
Hi guys, I found the problem. I was using a variable but I hadn't defined it proerly elsewhere in my include files. I've changed this and it's working now. Thanks for the help! |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|