473,398 Members | 2,165 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,398 software developers and data experts.

Update Query for Date

Hi. I would appreciate help an Update Query for Microsoft Access 2003 to change the date format for some entries.

Some of the dates are written to the table in this format:20130410112143 , which is YYYYMMDDHHMMSS .
The column name is PickupDate (data type=Text) , and the Table name is Tracking

I need to change only the entries in this format to a YYYY-MM-DD format.
Nothing else in the table should change.

So first filter for dates with 14 Characters (or any other way to filter for YYYYMMDDHHMMSS), drop the right 6 characters, and then re-format the date.
This would be my novice approach to this, but all that matters to me is the result.

Thank you in advance.
Apr 10 '13 #1

✓ answered by TheSmileyCoder

Start by writing a select query in the query designer where you successfully select all those rows with len([PickupDate])=14.

Then switch the select query to a update query, and use the following DateSerial function to update the information:
Expand|Select|Wrap|Line Numbers
  1. dateserial(left([PickupDate],4),mid([PickupDate],5,2),mid([PickupDate],7,2))

4 1532
TheSmileyCoder
2,322 Expert Mod 2GB
Start by writing a select query in the query designer where you successfully select all those rows with len([PickupDate])=14.

Then switch the select query to a update query, and use the following DateSerial function to update the information:
Expand|Select|Wrap|Line Numbers
  1. dateserial(left([PickupDate],4),mid([PickupDate],5,2),mid([PickupDate],7,2))
Apr 10 '13 #2
Hi, Thank you so much.
Is there a way to make it in one query as I need to run this daily.
I was hoping to have a shortcut to the query I can just run each day to fix the dates in the Tracking Table.
Apr 10 '13 #3
TheSmileyCoder
2,322 Expert Mod 2GB
It is only 1 query. I just instructed you to start of with a selection query as a test to make sure you have selected the right records. Once the selection is properly in place, you can then switch the type of query from select to update.
Apr 10 '13 #4
Excuse me for being thick :) I got it and it works like a charm. Much obliged.
Apr 10 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: rrh | last post by:
I am trying to update a field in one table with data from another table. The problem I'm running into is I need to base the update on a range of data in the 2nd table. Table 1 has: date field...
2
by: nadmasl | last post by:
I have an MS Access form, where a user enters the date by selecting it from three combo boxes for day, month and year. I convert it to 11-Jan-2004 format and attempt to write to the table with an...
1
by: Riley DeWiley | last post by:
I have an UPDATE query that is always setting 0 records. When I cut and paste the SQL into Access and use it, it fails in the same way unless I coerce the date fields to be '=now()', in which case...
2
by: bobabooey2k | last post by:
I have an update query with one field having in its "Update to" cell a DLookup statement. This query takes 2-3 minutes on 3000 records. Can I avoid dlookup here using multiple queries? An...
4
by: jofo | last post by:
Hello all, I have project form and an hours form and related tables for each. The project table has a status flag to determine if the project is open or closed. When a user enters hours on a...
3
by: John | last post by:
Hi How can I ensure that date is always assigned in dd/mm/yyyy format to a date filed, in an update query? Thanks Regards
9
by: Jeff Gardner | last post by:
Greetings: I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that appears to execute with no errors (php,mysql, or apache) but the data in the "UPDATED" table doesn't change. I've...
9
by: pandaking | last post by:
Hi there everyone, new here but after reading around it seems like I might hang about - so many helpful threads! I have a slight problem. This flying club near me has employed me to make them a...
3
by: ringer | last post by:
I am trying to add a functionality into a db I use for my checkbook that will help me plan for and save money for future large expenses. Into a table called tblFutureTransactions I want to enter...
8
by: ndeeley | last post by:
Hi! I have data returned from a database displayed on a webpage for amending. A date on the form is selected using a pop-up calendar which returns it to Access. When the date is retrieved the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.