Link to home
Start Free TrialLog in
Avatar of thangaraj
thangaraj

asked on

VB 6 with Crystal Report 7

I am using Crystal Report 7 for VB 6.  I have report file Category.rpt to get a report for SQL Server for the following

Server Name : KUMAR
User ID     : kumar
Password    : 123
Database    : Inventory

What is the code we have to write during Runtime in the VB ?.
It means


With CateRpt
  ??????????
  .PrintReport
End with

Thanks
Avatar of gafftech
gafftech

Are you using the .ocx control?

if so

with CateRpt
..filename = "c\category.rpt"
..Preview
end with

   With CateRpt
      ' Maximize the report viewer
      .WindowState = crptMaximized
   
      ' Select destination to screen
      .Destination = crptToWindow
     
      ' Set the window title
      .WindowTitle = "Preview"
   
    ' Set the report file name
      .ReportFileName = "reportname.rpt"
   
      ' Discard saved data
      .DiscardSavedData = True
   
      ' Connect to database (using ODBC)
      .Connect="DSN=KUMAR;UID=KUMAR;PWD=123"
   
      ' Print the report
      .Action = 1
    End With


Drop me a line if you need further explanations
Avatar of thangaraj

ASKER

I don't have DSN. Because I am using SQL Server 7. What is the Code ?
Yes, I am using .ocx
Any Solution
ASKER CERTIFIED SOLUTION
Avatar of gafftech
gafftech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, It works fine. Can i get ur email ID. I will mail U, if any doubt

Thanks  a  lot