|
-
May 24th, 2009, 10:49 AM
#1
Thread Starter
Member
[RESOLVED] print loop data using data report
Code:
Private Sub Command1_Click()
Dim MyDates As Date
For MyDates = DateSerial(2009, 5, 1) To DateSerial(2009, 5, 31)
Debug.Print MyDates
DBPATH = App.Path & "\db1.mdb"
Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH
SQL = "Select SUM(amount) As GTotal from table1 WHERE Date=" & MyDates & " "
rs.CursorType = adOpenDynamic
rs.LockType = adLockPessimistic
rs.Open SQL, cn, , , adCmdText
TotalAmount = rs.Fields("GTotal")
'Debug.Print TotalAmount ----> using this i got the ryt output for totalamount but i need it to be displayed in my datareport
'DataReport2.Sections("Section2").Controls("lblNew").Caption = DataReport2.Sections("Section2").Controls("lblNew").Caption & Chr(10) & totalamount ----> I've try using this code but there where no output displayed in my datareport
rs.Close
cn.Close
Next
End Sub
plz help .tnx
-
May 24th, 2009, 11:52 AM
#2
Re: print loop data using data report
Not clear on what your doing, need more info.
If you want to display the field "GTotal" then assign it to a text box control.
Code:
rptAssessment.Sections("users_header").Controls.Item("txtGTotal").DataMember = "users"
rptAssessment.Sections("users_header").Controls.Item("txtGTotal").DataField = "GTotal"
-
May 25th, 2009, 11:59 AM
#3
Thread Starter
Member
Re: print loop data using data report
tnx wes4dbt for ur reply 
ive already solved my problem..
my posted code is working.. it is just i didnt set the correct datareport properties: datasource and datamember
Last edited by kirara22; May 25th, 2009 at 12:05 PM.
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
|