Jacksparrow87
Technical User
Hi people,
I created a topic not soo long ago asking for help with a select statement and the people who helped me out did a great job. However after working on my application for a few days I can see that the select statement doesn't actually work.
Now so far I have the following in a search button:
Dol in the Access database has been set to date.
Now comes the difficult part, its hard to explain because I have a range of data in my database but the answer the above Sql statement gives is not correct, for example I entered a few test data in the month of June, now when I choose a date in June in dtp1 and dtp2 (where the range of data is in between these dates) the answer the sql gives me is not the answer it should be as its empty, another example is I have data on the 30/06/2008 and data on the 01/07/2008 now if I do a search between these dates it doesnt show the correct data.
A lot of the times it shows all counts and not between the dates chosen.
Personally I think the problem is with the dates.
Would it be possible to have something like:
where Dol BETWEEN >#" & dtp.Text & "# AND <#" & dtp2.Text & "#
I think I should put the >< symbols in there somewhere, thanks.
I hope someone could offer me help please.
I created a topic not soo long ago asking for help with a select statement and the people who helped me out did a great job. However after working on my application for a few days I can see that the select statement doesn't actually work.
Now so far I have the following in a search button:
Code:
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & Application.StartupPath & "\CNS.mdb")
Dim adapter As New OleDbDataAdapter("Select [Company], [ChaCode], COUNT(ChaCode) As [NumberofChargeCodes] From Log where Dol BETWEEN #" & dtp.Text & "# AND #" & dtp2.Text & "# And CompID = " & cmbcomp.SelectedValue & " And NoteNumber = 1 Group By [Company], [ChaCode]", conn)
Dim dt As New DataTable("Log")
adapter.Fill(dt)
dglog.DataSource() = dt
dt.DefaultView.AllowNew = False
Dol in the Access database has been set to date.
Now comes the difficult part, its hard to explain because I have a range of data in my database but the answer the above Sql statement gives is not correct, for example I entered a few test data in the month of June, now when I choose a date in June in dtp1 and dtp2 (where the range of data is in between these dates) the answer the sql gives me is not the answer it should be as its empty, another example is I have data on the 30/06/2008 and data on the 01/07/2008 now if I do a search between these dates it doesnt show the correct data.
A lot of the times it shows all counts and not between the dates chosen.
Personally I think the problem is with the dates.
Would it be possible to have something like:
where Dol BETWEEN >#" & dtp.Text & "# AND <#" & dtp2.Text & "#
I think I should put the >< symbols in there somewhere, thanks.
I hope someone could offer me help please.