473,323 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Date Fields in VB 2005

I have a form that involves a datagrid view to be filled after a start and
end date are selected from 2 DateTimePicker fields using the Short Format.
The query works without error but...

I have records to be returned that have dates such as 5/14/2008 and when the
start date is selected as 5/14/2008 the query doesn't include it unless I
select 5/13/2008.

I'm guessing this has to do with the time?? Is there a way to have it
ignore the time or make it the date + 12:00:00AM??
code:
Try
Me.TotalsTableAdapter.FillPOTotalByDate(Me.Invento ry_management_databaseDataSet.Totals,
New System.Nullable(Of Date)(CType(StartDateTimePicker.Value, Date)), New
System.Nullable(Of Date)(CType(StopDateTimePicker.Value, Date)))

Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try

query:
SELECT [Purchase Orders].OrderDate, [Purchase
Orders].PurchaseOrderNumber, Suppliers.SupplierName, SUM([Inventory
Transactions].UnitPrice)
AS [Sum Of UnitPrice]
FROM (([Purchase Orders] INNER JOIN
Suppliers ON [Purchase Orders].SupplierID =
Suppliers.SupplierID) INNER JOIN
[Inventory Transactions] ON [Purchase
Orders].PurchaseOrderID = [Inventory Transactions].PurchaseOrderID)
WHERE ([Purchase Orders].OrderDate >= ?) AND ([Purchase
Orders].OrderDate <= ?)
GROUP BY [Purchase Orders].OrderDate, [Purchase Orders].PurchaseOrderNumber,
Suppliers.SupplierName

Thank you,

Tony K

Oct 7 '08 #1
2 1396
Tony K wrote:
>
I have records to be returned that have dates such as 5/14/2008 and
when the start date is selected as 5/14/2008 the query doesn't include it
unless I select 5/13/2008.

I'm guessing this has to do with the time?? Is there a way to have it
ignore the time or make it the date + 12:00:00AM??
Me.TotalsTableAdapter.FillPOTotalByDate(Me.Invento ry_management_databaseDataSet.Totals,
New System.Nullable(Of Date)(CType(StartDateTimePicker.Value, Date)),
You can get the date only part of a datetime as a property of the datetime
variable:
CType(StartDateTimePicker.Value, Date).Date

Oct 7 '08 #2
Tony,

A DateTime structure is based on ticks in a long which starts at 01 01 00 .

As it is used as DateTime, then it contains a Date part and a Time part
which are given back in the format as is set in the local setting of the
computer.

However, as Steve wrote, you can select only the date part.

Cor
"Tony K" <my*********@kingprogramming.comschreef in bericht
news:1F**********************************@microsof t.com...
>I have a form that involves a datagrid view to be filled after a start and
end date are selected from 2 DateTimePicker fields using the Short Format.
The query works without error but...

I have records to be returned that have dates such as 5/14/2008 and when
the start date is selected as 5/14/2008 the query doesn't include it
unless I select 5/13/2008.

I'm guessing this has to do with the time?? Is there a way to have it
ignore the time or make it the date + 12:00:00AM??
code:
Try

Me.TotalsTableAdapter.FillPOTotalByDate(Me.Invento ry_management_databaseDataSet.Totals,
New System.Nullable(Of Date)(CType(StartDateTimePicker.Value, Date)), New
System.Nullable(Of Date)(CType(StopDateTimePicker.Value, Date)))

Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try

query:
SELECT [Purchase Orders].OrderDate, [Purchase
Orders].PurchaseOrderNumber, Suppliers.SupplierName, SUM([Inventory
Transactions].UnitPrice)
AS [Sum Of UnitPrice]
FROM (([Purchase Orders] INNER JOIN
Suppliers ON [Purchase Orders].SupplierID =
Suppliers.SupplierID) INNER JOIN
[Inventory Transactions] ON [Purchase
Orders].PurchaseOrderID = [Inventory Transactions].PurchaseOrderID)
WHERE ([Purchase Orders].OrderDate >= ?) AND ([Purchase
Orders].OrderDate <= ?)
GROUP BY [Purchase Orders].OrderDate, [Purchase
Orders].PurchaseOrderNumber, Suppliers.SupplierName

Thank you,

Tony K

Oct 7 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: tilak.negi | last post by:
Hello ! I'm trying to update one table field with another table searched first date record. getting some problem. If anyone have experience similar thing or have any idea about it, please guide....
2
by: Si | last post by:
Hi all, I have an events database (Access) that contains 2 fields, StartDate and EndDate. The fields are set as Date/Time long date. The server is UK date format (dd/mm/yyyy) I have a small...
1
by: bafidi | last post by:
i have a table: RECORDS1 fields: DATE1,NAME1 data is 21,10,2005 10:24:34 ANDY 21,10,2005 15:24:45 DAVID i search date with this sql
8
by: Jeremy | last post by:
We have some date fields in our HTML forms in various places. In the accounts package we use, there is some pretty nifty date handling. It has a standardised date format of dd/mm/yyyy and if you...
7
by: Nicolae Fieraru | last post by:
Hi All, I have a table tblProducts where I have four fields:\ Index, ProductName, EnterDate (as Date/Time - Medium Date), PurchaseDate (Date/Time - Medium Date) The EnterDate is automatically...
2
by: rivka.howley | last post by:
I wrote some code that creates a table with a date/time field at 15-minute intervals. Here's how I create and populate the table With tblDataTemp ..Fields.Append .CreateField("CT_ID", dbLong)...
5
by: Helen R Martin | last post by:
I'm struggling once more with the dates in one of my Access projects.. I'd like the date/time fields to be just date fields.. its just confusing the folks using the database, and its making it...
11
by: Dixie | last post by:
How can I programatically, take some Date/Time fields present in a table in the current database and change their type to text? dixie
3
by: Glencannon4424 via AccessMonster.com | last post by:
Hello, I have what I believe amounts to a Date Serial issue. I have the following columns in my table: Hire-Date Hire-Year WTD-RATE Wks-in-Yr
2
by: drurjen | last post by:
Good morning. I am importing an XLS file into one of my tables. The fields are: Date Id Time IO 12/22/2006 2 12:48:45 PM 9 12/22/2006 16 5:40:55 AM 1 12/22/2006 16 12:03:59 PM 2 ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.