Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Data Connectivity
Message Icon Topic: Auto Refresh Report with Microsoft Access Post Reply Post New Topic
Author Message
parta
Newbie
Newbie


Joined: 30 May 2010
Online Status: Offline
Posts: 1
Quote parta Replybullet Topic: Auto Refresh Report with Microsoft Access
    Posted: 30 May 2010 at 5:08pm
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
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 02 Jun 2010 at 6:59am
I suspect that the report has "Save Data With Report" turned on.  Open the report in Crystal, go to the File menu, turn it off and save the report then try again to open it from your code.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.