Pro contributor
24Aug2010,02:40   #31
virxen's Avatar
query1
==============
Code:
SELECT DISTINCT date AS field1, sum([Total Amt]) AS field2
FROM Table1
GROUP BY date;
notice that field1,field2 are the labels of datagrid columns


query2
================
Code:
SELECT DISTINCT date AS field1, sum([Total Amt]) AS field2
FROM Table2
GROUP BY date;
change your queries and try again



p.s. you do not need second database(db27) change in form31 the properties of
adodc1 to use as database the db1.

Last edited by virxen; 24Aug2010 at 02:44..
shabbir, viv345 likes this
Contributor
24Aug2010,16:21   #32
viv345's Avatar
Sir Should I create two data grid in form 31.
Pro contributor
25Aug2010,04:31   #33
virxen's Avatar
it depends on what you are planning to do
viv345 likes this
Contributor
25Aug2010,08:56   #34
viv345's Avatar
Sir,
I want both data grid total in one data grid. But by making two sql queries i have to create two data grids. How can calculate two grid query in one?
Contributor
26Aug2010,16:40   #35
viv345's Avatar
If following Code is written:-
Private Sub Command4_Click() 'GoBack button
Form1.Text1.Text = "i was sent by form27!!!"
Form1.Show
Form27.Hide
End Sub

How I can I get the Total value entered in All Grids
Pro contributor
27Aug2010,02:23   #36
virxen's Avatar
Quote:
Originally Posted by viv345 View Post
Sir,
I want both data grid total in one data grid. But by making two sql queries i have to create two data grids. How can calculate two grid query in one?
one of the many ways is this

Code:
Private Sub Command1_Click()
On Error Resume Next
conn.Execute "drop table table3"
conn.Execute "drop table table4"
conn.Execute "SELECT DISTINCT table2.Date AS dates, Sum(table2.[total amt]) AS sums INTO table3 From table2 GROUP BY table2.Date;"
conn.Execute "SELECT DISTINCT table1.Date AS dates, Sum(table1.[total amt]) AS sums INTO table4 From table1 GROUP BY table1.Date;"
conn.Execute "INSERT INTO table3 ( dates, sums ) SELECT dates, sums FROM table4;"
conn.Execute "drop table table4"
conn.Execute "SELECT DISTINCT table3.Dates AS dates, Sum(table3.sums) AS sums INTO table4 From table3 GROUP BY table3.Dates;"
conn.Ececute "drop table table3"
conn.Close
conn.Open
Form31.Show
Form2.Visible = False
End Sub
and in form31 change adodc1 properties(see picture)
Attached Images
File Type: jpg adodcproperties.jpg (31.2 KB, 2 views)
viv345 likes this
Contributor
28Aug2010,15:11   #37
viv345's Avatar
Private Sub Command4_Click() 'GoBack button
Form1.Text1.Text = "i was sent by form27!!!"
Form1.Show
Form27.Hide
End Sub

If this code is written then how can i get the grand total of all the grids
Contributor
28Aug2010,15:22   #38
viv345's Avatar
I tried this code but the Table 4 is blank and not giving the results in Form 31.
Pro contributor
29Aug2010,01:36   #39
virxen's Avatar
Quote:
Originally Posted by viv345 View Post
I tried this code but the Table 4 is blank and not giving the results in Form 31.
you do something wrong check this
Attached Files
File Type: rar trial.rar (35.5 KB, 3 views)
shabbir likes this
Contributor
29Aug2010,15:52   #40
viv345's Avatar
Private Sub Command4_Click()
Form1.Text1.Text = DataGrid1.Columns(9).Text
Form1.Show
Form27.Hide
End Sub

If this code is written then how can i get the grand total of all the grids