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

Storing Crystal Report field names and formulas in an array 1

Status
Not open for further replies.

RWWAMS

Technical User
Jan 3, 2003
104
US
Hi everyone, I'm using VB 6.0, Crystal Reports 8.5 and the data is in an Access 2000 database.

I have a report already built and now I working on my parameter interface in vb. The details section of the report contains a running total, several database fields and a formula. All are visible. It is a pretty simple report. I am attempting to store all the fields (table and field name) in an array. I am struggling with the syntax.
Here is the approach I would expect to work:


Dim crpFIELD As CRAXDRT.FieldObject
I = 1
For Each crpFIELD In REPORT.Sections("D").ReportObjects
Set crpFIELD = REPORT.Sections("D").ReportObjects(I)
FIELDS_ARRAY(I) = crpFIELD.Name
I = I + 1
Next



When stepping through the code above, crpFIELD.NAME = "Field1", "Field2", ...

Any pointers or advice would be greatly appreciated.
Regards.
 
I'm using 9.0 and using your code it works fine here, what's happening on your end?



Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
I bet you are getting a type mismatch error. If you run across a Textobject and try to set the crpFIELD to the ReportObject or Textobject, you'll get a type mismatch error.



Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Thanks for replying.

Instead of getting table.field name or formula names, I'm getting "Field1" then "Field2" then "Field3" ...
 
Field1" then "Field2" then "Field3" is exactly what I would expect. Those are the names of the fields on the report. I suppose you could go to the report and rename each field to something like fldFirstname, fldLastname, etc and then it would return those values. If not you might try posting in forum768 the Business Objects: Crystal Reports 3 Integrate Forum. Alot of good people over there.



Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
I'll try that, thank you for your advice.
 
I responded to your other thread (thread768-1001873).

For anyone else who stumbles upon this, the solution for RWWAMS is:
Code:
Dim crpFIELD As CRAXDRT.FieldObject
I = 1
For Each crpFIELD In REPORT.Sections("D").ReportObjects
  Set crpFIELD = REPORT.Sections("D").ReportObjects(I)
  FIELDS_ARRAY(I) = crpFIELD.[b][COLOR=red]Field[/color][/b].Name
  I = I + 1
Next
-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top