0

There are three columns of date information (month, day, year) in a table and I would like to create a new column in the table and combine those 3 columns into a the new column so that I can have a single formatted date. How can I do this? I know how to query this but I am trying to figure out how to copy this information to the original table. Thanks in advance.

3
  • 1
    Take a look at the DATESERIAL function. Commented May 18, 2011 at 21:33
  • please add the working query you have. Commented May 19, 2011 at 9:26
  • What data type are your 3 existing columns? Commented May 19, 2011 at 13:22

2 Answers 2

2

If I understood well, you need to alter your table and add a datetime column You need to do something like this

UPDATE YourTable
SET DATECOLUMN = '#' & DAYCOLUMN & '/' & MONTHCOLUMN & '/' & YEARCOLUMN & '#'

It was the sintaxis in access if i remember it well.

Greetings.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried the following and I got the error "Microsift access didn't update 10 fields due to a type conversion failure": update Autographs set full_date = '#' & day & '/' & month & '/' & year& '#';
The type conversion errors are probably from some invalid day, month or year values in your fields that are causing an invalid date to be generated. Look for values like Day=30 and Month=2.
2

There are a number of way of managing such a data scrubbing exercise e.g.

  • CREATE a new table including a new NOT NULL column and omitting the now-redundant columns, INSERT..SELECT into the new table only the data you require, DROP the old table (you'll end up with a different table name which may not be a bad thing).
  • ADD a new nullable column to the existing table (or NOT NULL if you have an appropriate DEFAULT), UPDATE the new column, alter the column to make it NOT NULL then DROP the now-redundant columns.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.