-
July 21st, 2017, 05:32 PM
#16
Re: [RESOLVED] CR8.5 - Error in Formula on 2nd time opening report from VB6 applicati
Hello fubak !!!
type the following at the top of the code in the print button click event:
crystalreport1.reset
I am sorry if i am typing it in 2017. But i am happy coz someone may get benefit from this.
Using CrystalReport 8.5 CrystalReport.OCX on vb6 form.
Imaging that the main report also posses one or more sub reports.
You will also see two time Cr.Connect Method don't worry its requirement
one for main report and the other for sub report or reports.
Cr.Reset
Cr.Connect = "DSN=MyDataSource;UID=sa;PWD=MyPassword;DSQ=MyDatabaseName"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Cr.ReportFileName = App.Path & "\Reports\crv.rpt"
Cr.Destination = crptToWindow
Cr.WindowState = crptMaximized
Cr.WindowTitle = "Bank Payment Voucher"
Cr.DiscardSavedData = True
Cr.SelectionFormula = "{crv_main.sno}=" & txtID.Text
''''''''Also connect any subreports to the proper database'''''''''''''''''''''''''''''''''
nRpt = Cr.GetNSubreports
nCurr = 0
While nCurr < nRpt
szName = Cr.GetNthSubreportName(nCurr)
Cr.SubreportToChange = szName
Cr.Connect = "DSN=MyDataSource;UID=sa;PWD=MyPassword;DSQ=MyDatabaseName"
nCurr = nCurr + 1
Wend
'''''''''End of Connect''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Cr.Action = 1
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|