0
viv345's Avatar, Join Date: Feb 2010
Contributor
1) No one form (Form 27) will be visible and to go for second form (Form1) GO command key is pressed.
2) The second form we can do any thing
a) either form will be informed immediately after every change it will be nice than i have not click the text button to get the result;
b) or I can click the text button to get the result from Form (Form 27)
3) In second form I have used Adodcto display/add the results of whole day/week/month in Data Grid
4) In second form I have used add and delete button so that i can add[B/[B] the result in Data Grid and Delete Button for deleting data from Data Grid after whole day/month/week so that I can know the SUMMARY of a day/month/week.
0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
1) try this instead

form27
Code:
Private Sub Command4_Click() 'GoBack button
Form1.Show
Form27.Hide
End Sub
form1
Code:
Private Sub Form_Unload(Cancel As Integer)
conn.Close
Form27.Show
Form1.Hide
End Sub
shabbir, viv345 likes this
0
viv345's Avatar, Join Date: Feb 2010
Contributor
Shabbir

How can I get the Results in Form No. 1?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Many ways and one of them is by accessing variables
viv345 like this
0
viv345's Avatar, Join Date: Feb 2010
Contributor
How?
0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
first of all correct your errors ,for example
Code:
Private Sub Text8_Click()
If Text4.Text = 1 Then'the correct is if val(Text4.text)=1 then
 Text8.Text = 1 * 10#'....=Cstr(1*10#)
 End If
If Text4.Text = 2 Then
   Text8.Text = 2 * 10#
 End If
 If Text4.Text = 0 Then
 Text8.Text = "0"
 End If
   End Sub
and now for your question

change the code in your project with this and see how is done


form27
Code:
Private Sub Command4_Click() 'GoBack button
Form1.Text1.Text = "i was sent by form27!!!"
Form1.Show
Form27.Hide
End Sub
you access a value of an object following its path(where it belongs)

now try it alone and if you get stacked post again.

Last edited by virxen; 20Aug2010 at 04:27..
shabbir, viv345 likes this
0
viv345's Avatar, Join Date: Feb 2010
Contributor
Tried but it is not taking the total. I have added two entries. The total comes 20 but it takes only one entry.

Project attached
Attached Files
File Type: zip Time Cal.zip (28.0 KB, 3 views)
0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
your code is only passing the value of field10 of the current selected record.

if i understand correctly what you want to do,i think you should use sql queries.

open ms access
create a new query--->query1 for example
goto sql view and write

Code:
SELECT DISTINCT field1, sum(field10) as field2
FROM Table1
GROUP BY field1;
save and exit ms access.

now go to your vb project

go to form1-->go to adodc1 properties-->go to recordsource tab
in table or stored procedure name-->select query1-->ok

now go to datagrid1,right click and retrieve fields.

when you press go button
Code:
Private Sub Command4_Click() 'GoBack button
Form1.Show
Form27.Visible = False
End Sub
you will see the datagrid1 filled automatically with the values you want.

if something is not working as you want tell me.


p.s. table2 is not used
shabbir, viv345 likes this
0
viv345's Avatar, Join Date: Feb 2010
Contributor
I tried it works. THANKS!

My next query is if their are two data grid in one form. What sql code will be written?
0
viv345's Avatar, Join Date: Feb 2010
Contributor
Trial.zip attached
Attached Files
File Type: zip trial.zip (39.5 KB, 4 views)