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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a group in a report using RDC

Status
Not open for further replies.

Fursten

Programmer
Dec 27, 2000
403
PT
Hi,

Im using CR8 and visual Basic. I had included a Report Designer in my VB application. In that designer I made the connection to the database and add some fields.

Now, using code I would like to set a group on that report, so I do something like this:

Dim fld As CRAXDDT.DatabaseFieldDefinition

Set fld = CrystalReport1.Database.Tables.Item(1).Fields.Item(1)

CrystalReport1.AddGroup 0, fld, crGCAnyValue, 1

And then I preview the report but the group isn´t there.

If i use the same code in a report external to the application (rqual to that inside the application) I can set that group without any problem!

Can someone tell me what I´m doing wrong?

Thank you.

 
Sorry, the code is wrong:

Dim fld As CRAXDDT.DatabaseFieldDefinition

is
Dim groupFld As CRAXDRT.DatabaseFieldDefinition

However it doesn´t work! :(
 
You have to add you group field to the group header section. You have to add code similar to:

Dim crSection As CRAXDRT.Section
Dim crField As CRAXDRT.FieldObject

Set crSection = crReport.Sections.Item("GH")

Set crField = crSection.AddFieldObject("{Table.Field}", 100, 0) ' Table.Field is the field you are adding as group and 100,0 are position coordinates.


 
Hi,

I realise that if I put this code inside the code window of the designer, i will make a group (well...more or less):

AddGroup 0, Database.Tables.Item(1).Fields.Item(1), crGCAnyValue, 1

So, the problem is that I can only automate the designer if I code inside the designer code window...?!?!

Can someone tell me why?

thank you

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top