Search code examples
vb6

Data Report and Grouping (Shape Append)


I hard-coded a data report's DataMember and Datafields (I'm not using a DataEnviroment, and don't know how either. I'd rather code it personally) but the more I check the code, I can't get to solve this thing.

The error message I'm getting is:

Error '8526' Can't find DataField 'Omisions.Date'

in this part of the code:

rpt.Refresh

Just before I do a rpt.Show at the end of the code. rpt is my current datareport. Here's the relevant code:

  sql = "Shape {exec Usp_HoraExtra_Rut 1} As Normal " _
  & "Append ({exec Usp_HoraExtra_Rut 2} As Omisions " _
  & "Relate Nit To Nit)"
  rptrs.Open sql, db, adOpenStatic, adLockReadOnly

I'm using two stored procedures instead because of the large queries.

Then I add the DataMember:

.Sections("Section1").Controls.Item("t_fecha").DataMember = "Omisions"

and then the DataFields:

.Sections("Section1").Controls.Item("t_fecha").DataField = "date"

and then:

rpt.Refresh
rpt.Show

If anyone can give me a hand, it'd be greatly apreciated.

Edit: typo, cleaned up the code.


Solution

  • For anyone who might read this... I solved this problem by switching from stored procs to views. For some reason SHAPE doesn't work with sotred procs and I refuse to code a big giant SQL query. I just created a view on my database and query'd it.

    Also, the connnection string needs changing. All in all, hard nut.