|
-
Aug 10th, 2008, 04:47 PM
#1
Thread Starter
Frenzied Member
[RESOLVED]Second call to CR fail
Hi to all:
I have this code for a report in VB6:
Code:
Set Report = New CRAXDDRT.Application
Set Rpt = Report.OpenReport(App.Path & "\Ficha_Individual.rpt")
If (Rpt.HasSavedData) Then Rpt.DiscardSavedData
'set the section object to the Page Header section of the report.
Set oSection = Rpt.Sections("PH")
For i = 1 To oSection.ReportObjects.Count
If oSection.ReportObjects(i).Kind = CRAXDDRT.crOleObject Then ' if it is a CrOleObject then
Set pic1 = oSection.ReportObjects(i)
End If
Next i
Rpt.ParameterFields.GetItemByName("anilha").AddCurrentValue (FrmFicha_Aves_Mortas.Text1(1))
setviewersize
CRViewer1.ReportSource = Rpt
CRViewer1.ViewReport
When I call the report everything work well...When I make a second call a got this error in this line:
Error:"Object doens't support this action"
Code:
'set the section object to the Page Header section of the report.
Set oSection = Rpt.Sections("PH")
I need to refresh the report or do something?
Thanks
Last edited by sacramento; Aug 11th, 2008 at 11:21 PM.
-
Aug 10th, 2008, 05:19 PM
#2
Hyperactive Member
Re: Second call to CR fail
I would test to see if the current section is already PH or trying the .reset command before you set the section.
-
Aug 10th, 2008, 05:51 PM
#3
Thread Starter
Frenzied Member
Re: Second call to CR fail
You mean this?
but .reset command don't exist in this method
-
Aug 10th, 2008, 10:35 PM
#4
Hyperactive Member
Re: Second call to CR fail
Sorry, I use the ocx more. I am just starting to use the rdc. Try this:
Code:
Report = Nothing
Set Report = New CRAXDDRT.Application
Or
Code:
If oSection <> Rpt.Sections("PH") then
Set oSection = Rpt.Sections("PH")
end if
Hope this helps
-
Aug 11th, 2008, 04:02 PM
#5
Thread Starter
Frenzied Member
Re: Second call to CR fail
Hi:
No in fact the error remain...with the first code the correct syntax is:
but nothing happens...
the second code generate a error...
-
Aug 11th, 2008, 09:04 PM
#6
Hyperactive Member
Re: Second call to CR fail
From the document scr8-ocxtordc.pdf:
RDC:
To Reset the report, set the Report object to “Nothing”, then open the report again and set the new properties. See
the OCX property ReportFileName for the RDC methods for opening reports.
‘Set the Report object to Nothing
-
Aug 11th, 2008, 11:21 PM
#7
Thread Starter
Frenzied Member
Re: Second call to CR fail
Hi:
The problem is resolved...
I had put this in the end of the code:
Code:
Set oSection = Nothing
Thanks for your help
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
|