Results 1 to 12 of 12

Thread: Crystal Report help

  1. #1

    Thread Starter
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621

    Angry

    Hi everybody

    I have a report set up in VB6 which is attached to an access query.

    I want to be able to specify certain criteria to search on before the report opens.

    This is what I have so far

    Code:
    Dim Report As New ImportDesigner
    
    Private Sub Form_Load()
    
    sSQL = "SELECT * " _
                 & "From tblImport " _
         & "WHERE " _
                 & "Import_Date=#8/22/2000#;"
    
    'Open the recordset
    Set rstTemp = New ADODB.Recordset
    rstTemp.CursorType = adOpenKeyset
    rstTemp.LockType = adLockBatchOptimistic
    
    rstTemp.Open sSQL, cnnMIS
    'This section is meant to set the report data source to the recordset.
    Report.Database.SetDataSource rstTemp
    
    CRViewer1.ReportSource = Report
    CRViewer1.ViewReport
    Now the report works but brings back everything as in the original query and seems to ignore the code to set the data source to the recordset.

    Does anybody have any ideas.

    Thanks
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  2. #2
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Question Rusty but.....

    I'm a little rusty on Crystal and when I did use the blessed thing it was with an Informix Db.

    I had similar problems though and no matter what you thought it should be displaying it displayed the original report. First off I assume you did de-select the 'save data with report' option?

    The way around this problem that I used was to set up a formula field - just a blank one. And then within the 'selection formula' set up, in your case the date to be equal to the formula field. Within VB before calling the report you set the formula field to be equal to your date. Can't recall syntax, something like, "crystalrep.formula(0) = '@date = ' & yourdate"

    Hope this hasn't been completely useless!
    Anakim

    It's a small world but I wouldn't like to paint it.

  3. #3
    Member Red Thread's Avatar
    Join Date
    Aug 2000
    Location
    Europe-Belgium
    Posts
    44

    Talking

    i don't know if your problem is solved, but here you find a possible solution

    http://forums.vb-world.net/showthrea...threadid=27353

    Greetings !

  4. #4
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284
    There is an option on the file menu in Crystal - 'Save data with report' or something like that. You might want to check that that was not checked when you last saved the report otherwise the report will not refresh.

  5. #5

    Thread Starter
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    I am only using the Crystal reports data control.

    I found if I use the wizard part to create the main report and then butcher it, it then let me specify the data source.
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  6. #6
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    I had that exact same problem with Crystal once too. I called them up and this is what they suggested I do. Along with de-selecting the "Save data with report option" I also put this in code when doing the report.

    CR1.ReportFileName = App.Path & "\REPORT.rpt"
    CR1.DiscardSavedData = True
    CR1.WindowState = crptMaximized 'optional of course
    CR1.Action = 1

    Hope thhis helps.
    ande211
    VB6 SP3

  7. #7
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    Oh sorry I forgot to say. That you use that code I posted along with whatever code you use to pull records for the report. But you probably knew that.
    ande211
    VB6 SP3

  8. #8
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274
    I posted some code for someone else here:

    http://forums.vb-world.net/showthrea...threadid=22060

    I think it may have something to do with the way you're declaring your report object variable

    Dim Report As New ImportDesigner
    I always use
    Code:
    Dim Report As ImportDesigner
    
    Set Report = New ImportDesigner
    
    ...
    I hope this helps.





  9. #9

    Thread Starter
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Thanks Everybody.

    I installed the application to the network lastnight and ran all but the report functions. Everthing has worked fine with the exception of the reports.

    On the PC it was installed on it worked fine but if I try and access it from another PC I get the following error.

    430: Class does not support automation or does not support expected interface.

    Does anybody have any idea what this is?

    When the application is installed any dll's, ocx's are installed to the app path. There should'nt be anything installed on the pc.

    As I said earlier everthing else works. When the report is accessed the error is diplayed but the form will open but not display anything.


    Can you help?


    Thanks
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  10. #10
    Hyperactive Member
    Join Date
    Apr 2000
    Location
    Sudbury, Ontario, Canada
    Posts
    274
    Try reinstalling the lastest mdac on the problem system. If that doesn't work install dcom98.

  11. #11
    Lively Member
    Join Date
    Jul 2000
    Location
    Brunei
    Posts
    100
    Originally posted by ande211
    I had that exact same problem with Crystal once too. I called them up and this is what they suggested I do. Along with de-selecting the "Save data with report option" I also put this in code when doing the report.

    CR1.ReportFileName = App.Path & "\REPORT.rpt"
    CR1.DiscardSavedData = True
    CR1.WindowState = crptMaximized 'optional of course
    CR1.Action = 1

    Hope thhis helps.
    Hi there,

    As a Crystal report expert, I hope you could help me this beginner.

    I want to do a very simple thing. When the user presses the command button, the crystal report has to opened in the crystal report program,

    Any help would be greatly appreciated.

    Thank you.

    sincerely,

    Rathi.J

  12. #12
    Lively Member
    Join Date
    Jul 2000
    Location
    Brunei
    Posts
    100

    Talking

    Originally posted by Gary.Lowe
    Hi everybody

    I have a report set up in VB6 which is attached to an access query.

    I want to be able to specify certain criteria to search on before the report opens.

    This is what I have so far

    Code:
    Dim Report As New ImportDesigner
    
    Private Sub Form_Load()
    
    sSQL = "SELECT * " _
                 & "From tblImport " _
         & "WHERE " _
                 & "Import_Date=#8/22/2000#;"
    
    'Open the recordset
    Set rstTemp = New ADODB.Recordset
    rstTemp.CursorType = adOpenKeyset
    rstTemp.LockType = adLockBatchOptimistic
    
    rstTemp.Open sSQL, cnnMIS
    'This section is meant to set the report data source to the recordset.
    Report.Database.SetDataSource rstTemp
    
    CRViewer1.ReportSource = Report
    CRViewer1.ViewReport
    Now the report works but brings back everything as in the original query and seems to ignore the code to set the data source to the recordset.

    Does anybody have any ideas.

    Thanks
    Hi Gary,

    I'm trying to do the same thing, that is passing a parameter to the crystal report.

    I tried to copy your code (hope you don't mind). But I don't know, how to declare the ImportDesigner object.

    I am stuck up with this for the past few days. Hope you could help me.

    So, how can can I declare the ImportDesigner? How did you refersh the data in the report?

    Thanks for your valuable time and support.

    Rathi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width