hi, im using vb6 and i dont know how to work on a commandbutton that will trigger to another form. For example, i have a commandbutton in form1 and when i click it, there will be an effect in form2. Example, form1 1+1 and the answer will go to form2. Please Help.

Also in our database, we declare this code so that we can delete the entire data stored to our datagrid and database, we are using ADODC and Data to have access to the ms access. But if there are many data to be erased and error appear. "Key Column information is insufficient or incorrect. Too many rows were affected by update".

Lastly, from database how can i filter the data, based on we wanted. Example, there are Mondays to Saturdays record of payment of the students and i want to compute for all payment of student in the day of wednesday? help me guys please.

Please help. Thanks

first of all please dont ask a lot questions in one post
i think there should be a seperate post for each question
thats why i am gonna tell you right direction for the first question which is regarding to command button

try this on click event of comand button


here form2 is the target form

hope this helps you

for the last question...

i think its better if you will have listbox for the days or create a calendar that will identify which of the date will be computed...and of course after you create a lecords that is needed..
hope this helps you/

Using Another Form

On Form1, in the command button Click handler, do the work you want to do and store the value in a variable, say intResult. Then, at the end of the handler, put:

Form2.lblResult.Caption = intResult

The first line actually sets the value that will be displayed on Form2. The second line makes the form visible, and if it was already visible, bring the form to the front. Keep in mind you have to close both forms in order to shut down the program.

Totalling Daily Payments

To get the total of daily payments from a table of individual payments, use an aggregate function.

SELECT Payment_Date, SUM(Amount_Paid) AS Total_Payment
FROM Student_Payments
WHERE Payment_Date BETWEEN [Start_Date] AND [End_Date]
GROUP BY Payment_Date
ORDER BY Payment_Date

You specify the starting and ending dates, as parameters to a query (as written), or by hard coding the dates when you write the query. If the starting date and ending date are the same, you could replace the BETWEEN condition with an equality test.

Other Stuff

I do not know how to handle your database datagrid issue.

It is best to ask one question per posting so that the people who are answering the question can deal with a smaller and more direct component and that people who are searching for an answer do not have to get though other things irrelevant to their question to get their answers.

Your first question was answered. Please open seperate threads for the other 2 questions.

It keeps the question and answers clear for future users. We can not allow multiple questions in one post.

All other users, please answer OP's questions on his new posts and not here.


commented: Good advice. +5