Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to refresh data in RDC

Status
Not open for further replies.

RollyS

Programmer
Jan 28, 2001
42
PH
I read from MalcolmW that to refresh data without using the Refresh button on the Viewer is to not use "Save Data With Report".

I tried this before importing my RPT file to my VB but it didn't work. My Viewer still doesn't refresh, and still have to rely on that cumbersome Refresh button.

Could you tell me how to solve this. It's been my perenial frustration with RDC.
 
I had the exact same problem about a month ago. You probably need to use the setlogoninfo command to initialize the report's connection with the database at runtime. Here's an example from one of my programs. This goes in the code for the viewer that calls the report.

Dim Report As New RDCComponentName

Private Sub Form_Load()

Screen.MousePointer = vbHourglass
Report.Database.Tables(1).SetLogOnInfo Server, Database, User, Pwd
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


Good Luck! :)
CrystalVisualBOracle
 
Also,

Make sure you change an existing report's setting in "File - Report Options"
in addition to
"File - Options" Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Thanks a lot, guys, for responding to my SOS. : ) Sorry, but I'm new to this syntax:

Report.Database.Tables(1).SetLogOnInfo Server, Database, User, Pwd

I know what to write under "User" and "Pwd", but what do I write under "Server", and "Database"? Is the subscript on "Tables" always 1 (one)?.

By the way, if this can aid you, I'm using Access 2000 for my database, and it has a password.

Sorry if I have to be spoonfed here. Thanks in advance. : )
 
Strange, I replied to this earlier but it doesn't seem to appear now. Anyway, what I said was, the syntax for accessing Access via the setlogoninfo is slightly different. Check the seagate help. I think it has parenthesis around the server,db,user and pwd. The table(1) is just an index. I think it's so if you have two different tables in different databases you can connect them both independently and then link them through the sql statement. - That's only a guess though. The username is the username you put in with the password to access the database. This may be optional - again check the syntax with seagate.

Good Luck.

CrystalVisualBOracle
 
I've had this same issue for a long time.
I checked "don't save data with report"
I checked "verify on every print"
what I found was that in the form that contained the dsr.viewer I needed to wait about 3 seconds before I showed the form for the data to update. I don't know why, it is a local path access2000 .mdb file with a simple select query.

This is what did it for me:
Put this code in the form containing the viewer

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
DoEvents
If Report.HasSavedData = True Then
Report.DiscardSavedData
Wait (3) 'must wait about 3 seconds to discard data
End If

CRViewer.ReportSource = Report
CRViewer.Refresh
CRViewer.ViewReport
Screen.MousePointer = vbDefault

End Sub

'********************************
'* Wait *
'********************************
Function Wait(WaitTime As Integer)
Dim sTargetTime As String

sTargetTime = DateAdd("s", WaitTime, Time)

Do Until Time >= sTargetTime
DoEvents
Loop

End Function

Good luck.
If anyone can tell me why I must wait 3 seconds,
please tell me.
Rick_Warda@yahoo.com
 
I have the same problem above. But i use crystalreport control. I dont use RDC or crystal report viewer. My complete code is :
Code:
Private Sub CmdReport_Click()

CrystalReprort.Destination=1 ‘ to window

CrystalReport1.ReportFileName = "\\Kp_sakd1\drive_E\VBSipakd\customer.rpt"

CrystalReport2.Action = 1

End Sub

Further i have got : 
* checked "don't save data with report"
* checked "verify on every print"
Then, what should i do? What VB code i must added in my VB program above? Is there any property i have to set.

thank in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top