Results 1 to 7 of 7

Thread: [RESOLVED] VB Error opening CR 4.6.0.1

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    236

    Resolved [RESOLVED] VB Error opening CR 4.6.0.1

    I'm having some trouble opening the correct report using VB6. There are 2 reports (so far). If I simply use:

    CrystalReport1.PrintReport the first report I created is printed no matter how many reports I may have.

    I then created a second report called "TeamStat.rpt" and wish to open it. Using this code I get an error "Object variable or With block variable not set"

    With CrystalReport1
    .ReportFileName = App.Path & "\TeamStat.rpt"
    .Action = 1
    End With

    Can someone shed some light on this for me?
    TIA
    Ken

  2. #2

  3. #3
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: VB Error opening CR 4.6.0.1


    Check that you have the crystal report control on the component and add it. You are using the crystal report control in your project so on the crystal report in the VB how to use it in the VB?, Get the crystal report tutorial from my signature. Link is given at my signature.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    236

    Re: VB Error opening CR 4.6.0.1

    Thank you for the replies RB and Shakti. Turns out the problem was that I didn't have the control on the form. I got the code from your tutorial, Shakti.

    However, how do I pass a SQL statement to the report? For instance, if I only want players from TeamID = 22 to be printed? Normally it would be something like
    "Select * from Players where [TeamID] = " & 22 & " order by [avg] desc"

    Thanks guys ... step by step I'm learning ...
    Ken

  5. #5
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: VB Error opening CR 4.6.0.1


    Check the post 2,3 on my tutorial where I give an example related to the SQL query.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Posts
    236

    Re: VB Error opening CR 4.6.0.1

    Thanks Shatki ... it's a little different from what I'm used to, but a little experimenting solved it.

    Thanks again.
    Ken

  7. #7
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: VB Error opening CR 4.6.0.1


    You are welcome
    If you got the solution then go to the thread tool menu and resloved this thread

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