Solved

Pass selection formula to .Dsr file

Posted on 2002-03-04
7
777 Views
Last Modified: 2008-02-01
Hi,

I am using vb6, crystal report 7 and Access database.

1. I design a report useing a query, use selection formula and call from vb its ok.

2. When i add crystal report in vb project it shows extension dsr and use CRViewer1 to view report. How i pass selection formula in this way.

what is the best way to handle report from upper two ways because i want that report files are compile with the form.

Thanks.

0
Comment
Question by:pak_slm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Expert Comment

by:kzbera
ID: 6841078
If my guess is correct you are trying to build a vb program for internet where you are trying to call a crystal report through your vb application.
So you have created IIS application using a special type of Visual Basic project. The result is an ActiveX DLL project type that automatically includes an instance of the appropriate ActiveX designer. That designer, called a WebClass object, acts as the base on which you create your application and is underneath your pages.

Actually you have created a WebClass project in Visual Basic 6.0 because WebClass designer files have the extension .dsr, for "designer. What happened You save the designer, the default module, and the project file. Designers end with the extension .dsr, whereas modules have the familiar .bas extension and projects have the .vbp extension.
For detail the following link will help you a lot to get rid of your second problem:
http://www.devx.com/upload/free/features/webbuilder/1998/09sep98/cc0998/cc0998.asp
0
 
LVL 1

Author Comment

by:pak_slm
ID: 6841163
No i am not build for internet.

Just open a standard exe project in vb, add some forms for data entry. Right click on project and select crystal report and design report and save it with dsr extension. it also add a form having control CRViewer1 on it.

So i view report in this way but base of my report is sql query and i want to pass where condition i.e. pass selection formula to a .rpt report file.
0
 
LVL 1

Author Comment

by:pak_slm
ID: 6841230
No i am not build for internet.

Just open a standard exe project in vb, add some forms for data entry. Right click on project and select crystal report and design report and save it with dsr extension. it also add a form having control CRViewer1 on it.

So i view report in this way but base of my report is sql query and i want to pass where condition i.e. pass selection formula to a .rpt report file.
0
Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

 
LVL 1

Expert Comment

by:kzbera
ID: 6841238
There are lots of Q & A in this site.
Go through these..
Best of luck
0
 
LVL 7

Accepted Solution

by:
EYoung earned 100 total points
ID: 6842099
Here is the code I use in my vb app to run the SQL query and pass some parameters.  Hope this helps.  This code is in a standard form that I call.  It, in turn, does the following and shows the report.



Option Explicit
Dim Report As dsrDetail_or_Summary

Private Sub Form_Activate()
    Set Report = New dsrDetail_or_Summary

    Report.EnableParameterPrompting = False

    Report.ParameterFields(1).AddCurrentValue mDetail_or_Summary_Parm
    Report.ParameterFields(2).AddCurrentValue mReport_Type_Parm
    Report.ParameterFields(3).AddCurrentValue mTeam_No_Parm
    Report.ParameterFields(4).AddCurrentValue mTotal_WIP_Parm
    Report.ParameterFields(5).AddCurrentValue mShow_Projects_Parm
   
    Select Case mReport_Type_Parm
        Case "One Team"
            If mDWS_Type = "M" Or mDWS_Type = "F" Then
                Report.RecordSelectionFormula = "{Dailies.Team_No} =  " & mTeam_No_Parm & _
                    " And {Dailies.DWS_Type} = " & fncQuoted_String(mDWS_Type)
            Else
                Report.RecordSelectionFormula = "{Dailies.Team_No} =  " & mTeam_No_Parm
            End If
        Case "All Teams"
            If mDWS_Type = "M" Or mDWS_Type = "F" Then
                Report.RecordSelectionFormula = "{Dailies.DWS_Type} = " & fncQuoted_String(mDWS_Type)
            End If
    End Select

    Screen.MousePointer = vbHourglass
    CRViewer1.ReportSource = Report
    CRViewer1.DisplayTabs = False
    CRViewer1.DisplayToolbar = True
    CRViewer1.EnableGroupTree = False
    CRViewer1.EnableExportButton = True
    CRViewer1.ViewReport

    Screen.MousePointer = vbDefault
End Sub

Private Sub Form_Resize()
    CRViewer1.Top = 0
    CRViewer1.Left = 0
    CRViewer1.Height = ScaleHeight
    CRViewer1.Width = ScaleWidth
End Sub
0
 
LVL 1

Author Comment

by:pak_slm
ID: 6846543
EYoung

one thing else

How i can i display my input as criteria as header on report.

0
 
LVL 7

Expert Comment

by:EYoung
ID: 6857654
pak slm,

Sorry for the delay.  I only work at this client on Mondays and Tuesdays and I don't always check EE.

What I do to display input as criteria is to either print the parameter you pass in the report header or create a formula like:  "Input 1:  " & Parameter1 and then print the formula in the header.

Another thing is that I try to always print the report parameters in the header or footer of the report.  That way the user can see what the inputs were that went into creating the report.  (Also, I can more easily understand how the user printed a report if they come to me later and say the report is not working correctly.)

Hope that helps.  EYoung
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question