Can Anybody help me, i have a problem with auto refresh with access when using crystal report
i made a program in VB6 , it links with access database
here is the code in vb
Option Explicit
Dim cn As ADODB.Connection
Dim rstampil As New ADODB.Recordset
Dim rstampil2 As New ADODB.Recordset
Dim X, y, z As Integer
Dim strSQL As String
Private Sub Form_Load()
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;Data Source=" & App.Path & _
"\db1.mdb;Mode = readwrite"
cn.Open
Set rstampil2 = Nothing
rstampil2.CursorLocation = adUseClient
rstampil2.Open "select * from rekap", cn, adOpenDynamic, adLockOptimistic, adCmdText
Set rstampil = Nothing
Set rstampil = Nothing
If rstampil2.RecordCount = 0 Then
Else
rstampil2.MoveFirst
Set rstampil = Nothing
rstampil.CursorLocation = adUseClient
rstampil.Open "delete * from rekap_print", cn, adOpenDynamic, adLockOptimistic, adCmdText
Set rstampil = Nothing
rstampil.CursorLocation = adUseClient
rstampil.Open "select * from rekap_print", cn, adOpenDynamic, adLockOptimistic, adCmdText
rstampil.AddNew
rstampil("kode pelanggan") = rstampil2("kode pelanggan")
rstampil("nama pelanggan") = rstampil2("nama pelanggan")
rstampil("bulan") = rstampil2("bulan")
rstampil("saldo") = rstampil2("saldo")
rstampil("no invoice") = rstampil2("no invoice")
rstampil("no faktur") = rstampil2("no faktur")
rstampil("bln pemakaian") = rstampil2("bln pemakaian")
rstampil("thn pemakaian") = rstampil2("thn pemakaian")
rstampil.Update
CRViewer1.Top = 0
CRViewer1.Left = 0
Set AppRep = Nothing
Set AppRep = New CRAXDRT.Application
Set Report = Nothing
Set Report = New CRAXDRT.Report
Set Report = AppRep.OpenReport(App.Path & "\faktur_pajak_email_tci.rpt")
For Each RepTable In Report.Database.Tables
RepTable.Location = App.Path & "\db1.mdb"
Next
Report.DiscardSavedData
Report.ReadRecords
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
end if
End Sub
Private Sub Form_Resize()
CRViewer1.Height = Me.ScaleHeight
CRViewer1.Width = Me.ScaleWidth
End Sub
what i'm going to ask is, why the report shown can not be refresh automaticaly, i have to manualy refresh the report after it opens
i already uncheck the report options save data with report, but still it cannot auto refresh
but the weird things happens, if i put more than 1 records in the database then it occasionally refresh, but sometimes it doesn't
this problems making me grazy all the time
pleasee can anyone helpp meee
thxx
Edited by parta - 30 May 2010 at 5:19pm
|