How to fix a Field with a Date Mix

User avatar
sistemaPR
2StarLounger
Posts: 119
Joined: 01 Jul 2013, 14:08

How to fix a Field with a Date Mix

Post by sistemaPR »

I have a table with field that the date look short date and other record looks like a date together with the time, can do an update query to make it all short date, How ?

User avatar
HansV
Administrator
Posts: 78484
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to fix a Field with a Date Mix

Post by HansV »

Let's say that the field is named MyDate.
Create a query based on the table.
Add the MyDate field to the query grid.
In the Query Type group of the Design tab of the ribbon, click Update Query.
Enter the following in the Update to line:

Int([MyDate])

using the actual name of the field, of course.
Click the Run button (the red exclamation mark) and confirm that you want to update the records.
Best wishes,
Hans

User avatar
sistemaPR
2StarLounger
Posts: 119
Joined: 01 Jul 2013, 14:08

Re: How to fix a Field with a Date Mix

Post by sistemaPR »

That works, perfectly

Thanks

If I want the date, to enter like that always, how should create this date field ?

and how about that command ( Int )

User avatar
HansV
Administrator
Posts: 78484
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to fix a Field with a Date Mix

Post by HansV »

You could set the Input Mask property of the field - click the ... on the right hand side of the property and select Short Date or Medium Date as Input Mask.

The Int function rounds a number down to a whole number.
Access stores dates and times as numbers, with 1 day as unit. The time is the decimal part of the number, e.g. 6:00 AM is 0.25 (6/24 of 1 day). Rounding the date+time to a whole number removes the time part.
Best wishes,
Hans