×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

HELP needed with using Select statement to pass parameters to Crystal

HELP needed with using Select statement to pass parameters to Crystal

HELP needed with using Select statement to pass parameters to Crystal

(OP)
Hey guys! Need some help with this...might be simple but I must be overlooking something here coz it doesn't work! I have 2 Crystal reports which I need to pass parameters to from an asp page. Both of them accept the same parameter, so I have a select statement in the Runreport page which picks what selection formula to use for the report according to which report it is. My reports both accept 2 parameters from another asp page....first is the report name and second is the Ordernumber which is called 'Soeno'. Here is the code....

ReportName = Request.QueryString("ReportName") & ".rpt"

if Request.QueryString("Debug") = "Y" then
  Response.Write "ReportName = " & ReportName & "<BR>" & vbcrlf
  session("debug")="Y"
end If

' CREATE THE APPLICATION OBJECT   
On error resume next
If Not IsObject(session("oApp")) or session("oApp") is nothing Then                              
  Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
  'session("oApp").SetMorePrintEngineErrorMessages(True)
End If

' CREATE THE REPORT OBJECT        
Path = Request.ServerVariables("PATH_TRANSLATED")                     
While (Right(Path, 1) <> "\" And Len(Path) <> 0)                      
iLen = Len(Path) - 1                                                  
Path = Left(Path, iLen)                                               
Wend                                                                  


'OPEN THE REPORT (but destroy any previous one first)     
if session("debug") = "Y" then
    Response.Write "exec:Al Path=" & path & "<br>" & vbcrlf
end if

If IsObject(session("oRpt")) then
    Set session("oRpt") = nothing
End if

On error resume next
if  session("debug") = "Y" then
    Response.Write "Report=" & path & reportname & "<br>" & vbcrlf
end if
Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1)

If Err.Number <> 0 Then
  Response.Write "Error Occurred creating Report Object: " & err.number  & Err.Description
  Set Session("oRpt") = nothing
  Set Session("oApp") = nothing
   Response.write "<script language=JavaScript>"
   Response.write "setTimeout(""window.close()"", 1500)"
   Response.Write "</script>   "   
  'Session.Abandon
  Response.End
End If

session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False
session("oRpt").DiscardSavedData


OrderNum = Request.QueryString("soeno")
'Building the selection formula...

select case reportname
case "soa.rpt"
 
  SelectionFormula = "{soa_header.soeno}= '" & OrderNum & "'"
  session("oRpt").RecordSelectionFormula = cstr(SelectionFormula)

  
  
case "invoice1.rpt"
     SelectionFormula = "{t_invoice.sonum}= '" & OrderNum & "'"
    session("oRpt").RecordSelectionFormula = cstr(SelectionFormula)
   
 end select


When I don't use the select statement and just consider one report...like the code shown below, it works fine and accepts the parameter but if I try to use the select statement its as if it doesn't hit that code at all because it will open the reports without passing the selection criteria. Here is the code which works....when I try to open a single report. Any idea why the select statement won't work?

OrderNum = Request.QueryString("soeno")

  SelectionFormula = "{soa_header.soeno}= '" & OrderNum & "'"
  


session("oRpt").RecordSelectionFormula = cstr(SelectionFormula)


 Thanks in advance for any help offered!

RE: HELP needed with using Select statement to pass parameters to Crystal

I responded to your CE post.

-k

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close