Solved

CRYSTAL REPORT THROUGH A NETWORKED COMPUTER

Posted on 2004-04-14
9
460 Views
Last Modified: 2008-03-17
I have a VB6 program that I deploy through an intranet.. My server is running on a different computer.. My application is installed in another computer.. My application runs a Crystal Report.. The reports folder is in the client computer.. However, it won't work!!

I tried using the server as the client also (meaning, I am running my application in the computer where the server is located --- the reports folder is there too) and then it worked!!

Is there a special code needed if the application is connecting to a server from a different computer for the reports to run??

Also, does the reports folder need to be where the server/database is located?? Is there a way to code that in my application?? (like RunReport <ip add of server>\reports folder\report name, i guess..)

Here's my code
----------------
'This is upon clicking the View Report button
Private Sub cmdView_Click()

If cmbReports.ListIndex < 0 Then Exit Sub
RunReport App.Path & "\reports\" & cmbReports & ".rpt"

End Sub
----------------
'This is the Run Report procedure
Private Sub RunReport(ByVal vstrFileName)

  On Error GoTo err_handler
   
    Dim period As String
    Dim emptype As String
    Dim empid As Integer
   
    On Error GoTo err_handler
   
    period = txtPeriod.Text
    emptype = DataCombo1.Text
    empid = txtID.Text
   
    With frmPayReports.cr
        .Reset
       
       Select Case cmbReports
            Case "Attendance Summary"
                .ParameterFields(0) = "pID;" & txtID.Text & ";TRUE"
            Case "Credit Union Summary"
                .Formulas(0) = "period = '" & txtPeriod.Text & "' "
                .Formulas(1) = "type = '" & DataCombo1.Text & "' "
                .ParameterFields(0) = "pPeriod;" & txtPeriod.Text & ";TRUE"
                .ParameterFields(1) = "pType;" & DataCombo1.Text & ";TRUE"
            Case "GSIS Summary"
                .Formulas(0) = "period = '" & txtPeriod.Text & "' "
                .Formulas(1) = "type = '" & DataCombo1.Text & "' "
                .ParameterFields(0) = "pPeriod;" & txtPeriod.Text & ";TRUE"
                .ParameterFields(1) = "pType;" & DataCombo1.Text & ";TRUE"
            Case "Others Summary"
                .Formulas(0) = "period = '" & txtPeriod.Text & "' "
                .Formulas(1) = "type = '" & DataCombo1.Text & "' "
                .ParameterFields(0) = "pPeriod;" & txtPeriod.Text & ";TRUE"
                .ParameterFields(1) = "pType;" & DataCombo1.Text & ";TRUE"
            Case "Payslip"
                .Formulas(0) = "period = '" & txtPeriod.Text & "' "
                .ParameterFields(0) = "pPeriod;" & txtPeriod.Text & ";TRUE"
                .ParameterFields(1) = "pID;" & txtID.Text & ";TRUE"
            Case "Payroll Sheet"
                .Formulas(0) = "period = '" & txtPeriod.Text & "' "
                .Formulas(1) = "type = '" & DataCombo1.Text & "' "
                .ParameterFields(0) = "pPeriod;" & txtPeriod.Text & ";TRUE"
                .ParameterFields(1) = "pType;" & DataCombo1.Text & ";TRUE"
            Case "RATA Payroll"
                .Formulas(0) = "period = '" & txtPeriod.Text & "' "
                .Formulas(1) = "type = '" & DataCombo1.Text & "' "
                .ParameterFields(0) = "pPeriod;" & txtPeriod.Text & ";TRUE"
        End Select
       
        .ReportFileName = vstrFileName
        .WindowTitle = cmbReports.Text
        .WindowState = crptMaximized
        .Action = 1
    End With
   
Exit Sub

err_handler:
    MsgBox "Printing is not allowed.", vbExclamation, "Print"
    'MsgBox (Err.Description), vbInformation
    Exit Sub

End Sub
--------------
'This is my Class Module
Function PrintFile(ByVal Trans As String, ByVal strFileName As String, ByVal intDestination As Integer, ByVal strFormula As String)
 On Error GoTo errhandler
   
        Dim myFile As String
             myFile = App.Path & "\Reports\" & strFileName
        If intDestination = 0 Then frmReports.cr.Destination = crptToWindow
        If intDestination = 1 Then frmReports.cr.Destination = crptToPrinter
        If intDestination = 2 Then
            frmReports.cr.PrintFileType = crptWinWord
            frmReports.cr.Destination = crptToFile
        ElseIf intDestination = 3 Then
            frmReports.cr.PrintFileType = crptExcel50
            frmReports.cr.Destination = crptToFile
        End If
        frmReports.cr.ReportFileName = myFile
        frmReports.cr.SelectionFormula = strFormula
 
 'Crystal Report Action
    frmReports.cr.Action = 1

   
Exit Function
errhandler:
 MsgBox (Err.Description), vbExclamation

End Function
--------------

Hope you can help me.. I badly need this to work.. :(
0
Comment
Question by:jlmabutas
  • 5
  • 3
9 Comments
 
LVL 42

Accepted Solution

by:
frodoman earned 250 total points
ID: 10822396
The first place I'd look is at the datasource of your report.  If you designed the report pointing to a local database and then move the report it isn't going to work (unless the identical db is also on the new system).  I don't see you setting the datasource in your code so are you using a dsn inside your report?  Does that dsn exist on the client computer?
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10823088
What database?

How did you install the applicatiion on the client machine?  Did you build an installation package and install it or simply copy the executable?

mlmcc
0
 

Author Comment

by:jlmabutas
ID: 10824227

frodoman:

A dsn exist on the client computer. We set the ip address of the server in the connection string (conn.________). The code for that is in another module…that works since the application can retrieve records from the server, it just wont display the reports. By the way, if you use a dsn inside the report, where should it be? Coz i dont remember setting anything there/




mlmcc:

We are using MySQL. We packaged  the application using  package & deployment wizard.
0
 

Author Comment

by:jlmabutas
ID: 10829212
I just remembered.. I'm using a User DSN/System DSN.. And the report refers to this.. I just read that it applies only to a certain computer..

Does that mean I have to use a File DSN instead (which I read is machine-independent)??

And does the report have to be referred to this File DSN?? If so, will it work if I just update the reports and use the Set Location.. dialog to change the DSN that it is referring to??
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:jlmabutas
ID: 10829239
Wait... I also re-checked my code and it seems that I just set the datasource in my code (in the connection string) for the other functions of the application and not for the report...

If I have to place it in my code, HOW WILL I DO THAT?? Is there a specific code for that??

Or if I should just use a dsn inside the report.. again, HOW WILL I DO THAT??
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10829407
This is for Access but it does show how to change the data source

http://support.businessobjects.com/communityCS/FilesAndUpdates/SCR8_VB_RDC_DBPassword.exe.asp

mlmcc
0
 

Author Comment

by:jlmabutas
ID: 10829515
mlmcc,
Hi.. I tried opening the Visual Basic Project but errors occurred when it loaded the Crystal Report1 file (the Visual Basic Designer Module).. I don't know why.. Do you have any other samples??
0
 

Author Comment

by:jlmabutas
ID: 10829559
Hey.. I solved it already.. I think I really had to check the DSN.. I had to use a File DSN instead of just a User and System DSN..
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10829633
Great.  No i don't have other samples and the errors are probably because the app includes a different Crystal library than you have.

mlmcc
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now