Solved

CRYSTAL REPORT THROUGH A NETWORKED COMPUTER

Posted on 2004-04-14
9
463 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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
 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

17 Experts available now in Live!

Get 1:1 Help Now