mardi 5 mai 2015

Crystal report in VB6

I am using below code to generate crystal report in vb6.

Below code is working properly in live database environment.

Some times I want to display test data using test database.

But it is not working and display report without data.

      Function print_po()
      On Error Resume Next
      Dim dbpath As String
      Dim rptpath As String
      Dim squ As String
      dbpath = "D:\STORE_PROJECT\STORE_DB.db"
      rptpath = "\\192.128.33.12\Public\PROJECT\Report\ERP.rpt"
      squ = "SELECT * FROM purchaseo INNER JOIN purchaseo_header On purchaseo.purchase_or_code=purchaseo_header.purchase_or_code where    purchaseo_header.purchase_or_code=" & "'" & Me!Label31.Caption & "'order by line ASC"
      With CrystalReport1
      .ReportFileName = rptpath
      .DataFiles(0) = dbpath
      .DiscardSavedData = True
      .RetrieveDataFiles
      .SQLQuery = squ
      .ReportTitle = Label31.Caption 
      .WindowTitle = "Purchase Order" + Label31.Caption
      .Action = 1
      End With
      End Function

Aucun commentaire:

Enregistrer un commentaire