quynhtuan
04-14-2004, 08:34 PM
Hi,
I'm use VB6.0 to do input form, MS. Access 2000 as Database and Crystal Report 8.5 is Report.
Everything are alright, but sometimes I find out Crystal Report do not refesh database although I used Report.Database.Verify method and in Crystal Report I do not choice 'Save Data with Report' Option. I have checked the data in table was alright.
Here is my code in the form which is loading Crystal Report in my VB6.0 Application:
Dim Report As New rptSoChiTietVL
Dim SubReport As Report
-----------------------------------
Private Sub Form_Load()
Dim sAppPath1 As String
sAppPath1 = App.Path
If Right$(sAppPath1, 1) <> "\" Then sAppPath1 = sAppPath1 & "\database\"
Screen.MousePointer = vbHourglass
Report.Database.Tables(1).Location = sAppPath1 & "IMTransaction.mdb"
Report.Database.Verify
Report.txtMonth.SetText "Thałng" & " " & frmGiaVonHangXuat.txtMonth
Report.Text41.SetText frmGiaVonHangXuat.cboPrd
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
-----------------------------------------
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
-------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
MdFunctions.ConnectionDb.Execute "Delete * from SoChiTietVL"
MdFunctions.ConnectionDb.Execute "Delete * from Ton_tmp"
End Sub
I'm use VB6.0 to do input form, MS. Access 2000 as Database and Crystal Report 8.5 is Report.
Everything are alright, but sometimes I find out Crystal Report do not refesh database although I used Report.Database.Verify method and in Crystal Report I do not choice 'Save Data with Report' Option. I have checked the data in table was alright.
Here is my code in the form which is loading Crystal Report in my VB6.0 Application:
Dim Report As New rptSoChiTietVL
Dim SubReport As Report
-----------------------------------
Private Sub Form_Load()
Dim sAppPath1 As String
sAppPath1 = App.Path
If Right$(sAppPath1, 1) <> "\" Then sAppPath1 = sAppPath1 & "\database\"
Screen.MousePointer = vbHourglass
Report.Database.Tables(1).Location = sAppPath1 & "IMTransaction.mdb"
Report.Database.Verify
Report.txtMonth.SetText "Thałng" & " " & frmGiaVonHangXuat.txtMonth
Report.Text41.SetText frmGiaVonHangXuat.cboPrd
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
-----------------------------------------
Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth
End Sub
-------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
MdFunctions.ConnectionDb.Execute "Delete * from SoChiTietVL"
MdFunctions.ConnectionDb.Execute "Delete * from Ton_tmp"
End Sub