View Single Post
  #2 (permalink)  
Old March 29th, 2016, 04:04 AM
lakpriya lakpriya is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Public HR As New ADODB.Connection
Public Function DBConnect()


Set HR = New ADODB.Connection

HR.Open "DATABASE=" & DatabseName & ";UID=" & UserName & ";PWD=" & Password & ";DSN=" & DSNName '& "'"

End Function


Dim FromDate As Date
Dim ToDate As Date
Dim x As String

x = DateAdd("d", -1, Now)

'FromDate = Format(X, "mm-dd-yyyy")
Set DBCon = New DBManage
DBCon.DBConnect
Set recCom = New Recordset
sSql = "exec OrderT '" & Format(x, "mm-dd-yyyy") & "','" & Format(x, "mm-dd-yyyy") & "'"
DBCon.HR.Execute (sSql)
DBCon.DBDisconnect

SLR_ASupCReport.Connect = "DSN=DSNName;UID=sa;PWD=xxxx;DSQ=dbname;"


SLR_ASupCReport.ReportFileName = app.Path + "\Reports\Order Summary.rpt"

SLR_ASupCReport.DiscardSavedData = True

SLR_ASupCReport.Action = 1

SLR_ASupCReport.WindowTitle = "Order vs Invoice Analysis"
SLR_ASupCReport.ReportTitle = "Order vs Invoice Analysis"
SLR_ASupCReport.DiscardSavedData = False

' crystal report to pdf export
' CRAXDRT dll down load and register
Dim crxApplication As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim crxExportOptions As CRAXDRT.ExportOptions

Set crxApplication = New CRAXDRT.Application
Set oReport = crxApplication.OpenReport(app.Path + "\Reports\Order Details.rpt", 1)
oReport.Database.LogOnServer "p2sodbc.dll", "DSNNAME", "", "USERNAME", "PASSWORD"
With oReport
With .ExportOptions
.UseReportDateFormat = True
.UseReportNumberFormat = True
.FormatType = crEFTPortableDocFormat
.DestinationType = crEDTDiskFile
.DiskFileName = app.Path + "\PDF\Order Details" + Format(Now, "mm-dd-yyyy") + ".pdf"

End With
.Export False
End With
Reply With Quote