|
-
Jul 31st, 2012, 01:05 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Getting Sum on right side
Can i sum two left columns in datareport of vb6, I have two bounded textboxes which obtained data from database and i want to display sum of every record on their right side. Can i do this? If yes then what is the procedure?
-
Jul 31st, 2012, 02:25 AM
#2
Re: Getting Sum on right side
You can probably do it with your sql statement, but need a lot more info on how you designed the report.
-
Aug 1st, 2012, 07:32 AM
#3
Thread Starter
Hyperactive Member
Re: Getting Sum on right side
So, you can guide me through the whole process
-
Aug 4th, 2012, 12:15 AM
#4
Thread Starter
Hyperactive Member
Re: Getting Sum on right side
Can anybody give me reply? I need it urgently.
-
Aug 4th, 2012, 05:26 PM
#5
Re: Getting Sum on right side
You SQL statement would look something like this, "Select field1, field2, (field1 + field2 ) as sumtotal from yourtablename". This is just a guess, you haven't explained what your using for the reports datasource.
-
Aug 5th, 2012, 11:56 AM
#6
Thread Starter
Hyperactive Member
Re: Getting Sum on right side
I used following code for displaying data in two textboxes and want to insert a label on right side which will used for getting sum of two left columns:
Private Sub cmdPrint_Click()
Dim str As String
If modText.myConn.State = adStateOpen Then
modText.myConn.Close
End If
Set myRs = Nothing
If cmbMonth.Text = "" Or txtYear.Text = "" Then
MsgBox "Please enter both values for Monthly Income Report", vbOKOnly, "Ideal"
cmbMonth.SetFocus
Else
Call modText.OpenMyConn
myRs.Open "SELECT query3.fcd AS `CURRENTDATE`, sum(query3.fdf) AS `DEPOSITEDFEE`, sum(query3.ta) AS `INCOME` from query3 where month(query3.fcd)= " & cmbMonth.Text & " and year (query3.fcd)= " & txtYear.Text & " group by query3.fcd UNION select query4.tcd, sum(query4.fdf), sum(query4.ta) from query4 where month(query4.tcd)=" & cmbMonth.Text & " and year (query4.tcd)= " & txtYear.Text & " group by query4.tcd", myConn, adOpenKeyset, adLockOptimistic
Set rptMonIncome.DataSource = myRs
rptMonIncome.DataMember = myRs.DataMember
rptMonIncome.Show
Unload Me
End If
End Sub
-
Aug 8th, 2012, 07:25 AM
#7
Thread Starter
Hyperactive Member
Re: Getting Sum on right side
I have solved this problem
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
|