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

Data Report w/o using Data Enviroment Desinger 1

Status
Not open for further replies.

intrepid101

Programmer
Aug 8, 2001
13
0
0
US
Is there a way to create a DataReport without using the Data Enviroment Designer to create the DataSource and so forth. I know how to create a DataSource from a class module, but I guess the Data Report links to a DataEnviroment object. I am learning the database end of VB so I may have the whole approach wrong. I am using VB6 with an ADO connection to Access.

Any help to point me in the right direction would be well appreciated.

Thanks Scott
 
There are a ton of articles out there on using the data report with the data environment. Actually, that's what I've found to be the best for me anyway. But there is a little blurb in the below article. And further down, another programmer I work with does his data reports from scratch and there's a snippet of code.

hope it helps
Stacey



Private Sub SetupReport()

Set rptAgentActivity.DataSource = rstReportRecords

With rptAgentActivity
.Sections("secPageHeader").Controls("lblHeader3"). _
Caption = Format(dtpStartDate.Value, "Short Date") & _
" - " & Format(dtpEndDate.Value, "Short Date")
.Sections("secGroupHeader").Controls("txtGroupHeader"). _
DataField = rstReportRecords.Fields(0).Name
.Sections("secGroupHeader").Controls("lblGroupHeader").Caption = _
rstReportRecords.Fields(0).Value
.Sections("secDetail").Controls("txtAgentNumber").DataField = _
rstReportRecords.Fields(1).Name
.Sections("secDetail").Controls("txtNew").DataField = _
rstReportRecords.Fields(2).Name
.Sections("secDetail").Controls("txtPayments").DataField = _
rstReportRecords.Fields(3).Name
.Sections("secDetail").Controls("txtOptions").DataField = _
rstReportRecords.Fields(4).Name
.Sections("secDetail").Controls("txtLateTS").DataField = _
rstReportRecords.Fields(6).Name
.Sections("secDetail").Controls("txtRevenue").DataField = _
rstReportRecords.Fields(5).Name

If optByState.Value Then
.Sections("secPageHeader").Controls("lblHeader2").Caption = _
"by State"
ElseIf optByMarket.Value Then
.Sections("secPageHeader").Controls("lblHeader2").Caption = _
"by Market"
Else
.Sections("secPageHeader").Controls("lblHeader2").Caption = _
"by Agent"
.Sections("secGroupHeader").Visible = False
End If

.Show
End With

End Sub
 
HI Stacey

Thank you very much for your quick reply and answer, it was very helpful and exactley what I needed.

I do however have one question concerning the RecordSet 'rstReportRecords' and 'rptAgentActivity'.
Do I create the recordset as a normal ADODB Record Set

example:
******
DIM rstRecordSet AS ADODB.Recordset
SET rstRecordSet AS NEW ADODB.Recordset

open.rstRecordset = "SqlQuery",connection,curser,lock
******

What do I set up rptAgentActivity to?
DIM rptAgentActivity as ?
SET rptAgentActivity = NEW ?
******

I apologize if these questions seem trivial, but I have been having a brain meltdown trying to learn all this stuff, but dang its sooo fun. I thought PHP was a blast!
Thanks again
Scott

 
Yes, rstReportRecords is just a normal Recordset, see below

dim rstreportrecords as adodb.recordset
set rstreportrecords=new adodb.recordset
rstReportRecords.Open strSQL, dbAgentPay, adOpenKeyset, _
adLockPessimistic


rptAgentActivity IS a data report created in advance, so you wouldn't define or create it (although maybe you could, but that's a different story), with several unbound fields added into the detail (and report footer) area. Then he named those unbound fields for easy reference. This would account for his binding in the above procedure.

These aren't dumb questions, and I know...it is sickly fun, isn't it?
Stacey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top