Ive got the following code. I wish to be able to select income for a spesific month. as it is now, I`ll pick Income for on specific day in month, not the total for the whole month. How can I achieve this? It`s an Access database
i.e if I`ve got dtpDate.value = 22.01.2002 (month value would be 1)
and tblIncome.Date = 22/01/2002 (mont value would be 01 if I`m not wrong.)
i.e if I`ve got dtpDate.value = 22.01.2002 (month value would be 1)
and tblIncome.Date = 22/01/2002 (mont value would be 01 if I`m not wrong.)
Code:
Dim myString As String
Dim aString As String
myString = (dtpDate.Value)
aString = (Replace(myString, ".", "/"))
MessageBox.Show(aString)
Exit Sub
Try
Me.OleDbConnection.Open()
adIncome = New OleDb.OleDbDataAdapter("select (tblIncome.Amount) as Tot FROM tblIncome where (tblncome.date) = #" & aString & "#;", Me.OleDbConnection)
adInntekt.Fill(dsIncome, "dtIncome")
dgView.DataSource = dsInntekt.Tables("dtIncome")
Catch ex As OleDb.OleDbException
MessageBox.Show(ex.Message)
End Try
Me.OleDbConnection.Close()