I'm a newbie working in vb6 and would like some help with some code from an expert...
I am working on a restaurant program where the daily sales are saved into a table. There is a column for the month,(January 2012) and a column for food_sales, and bar_sales.
I will have two text boxes for food sales, and two for bar sales where one will display the month (January 2012 for example) and after clicking on a command button, the second text box will sum the total sales under that month.
The database is CHEF_HELPER1.MDB
The table is housesales
The month column name is month
The food sales column name is food_sales
The bar sales column name is bar_sales
I have code that will sum the sales in housesales, but I want to sum it by the month in text1.text. So if January 2912 is in text2.text, it will sum all the sales in housesales where January 2012 is the month. The same for the rest of the months. (I might put the months into a combo box)
I will use the code in two separate command buttons.
Code listed below is for bar_sales.
I also would like the text1.text formatted as "#########.00"
Could some kind soul please help me with the code?
What I have now which works is the following.
Private Sub Command2_Click()
Dim MyCon As New ADODB.Connection
Dim housesales As New ADODB.Recordset
Dim sConnect As String
Make sure you post in the correct forum. You have posted in MySQL forum yet you are using the JET database which is a microsoft product and not the same database at all. ask a moderator to move the thread to the correct forum.