Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, August 23, 2025 
 
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!
 Architect Forums - SalesLogix Scripting & Customization
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.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Passing field value through to Crystal Reports
Darren Savery
Posts: 51
 
Passing field value through to Crystal ReportsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Matt Dockins
Posts: 159
 
Re: Passing field value through to Crystal ReportsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Arminta Ward
Posts: 1
 
Re: Passing field value through to Crystal ReportsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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
[Reply][Quote]
Matt Dockins
Posts: 159
 
Re: Passing field value through to Crystal ReportsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Apr 08 11:32 AM
EDIT: Nevermind, thought you were trying to get some dynamic text to display in the report, not filter it. Oops.


Arminta is right, you probably need to say txtRANumber.TEXT
[Reply][Quote]
Darren Savery
Posts: 51
 
Re: Passing field value through to Crystal ReportsYour last visit to this thread was on 1/1/1970 12:00:00 AM
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!
[Reply][Quote]
 Page 1 of 1 
  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!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/23/2025 2:22:59 PM