sql - How to add time (years) to a date column in a table -


I am working in Acceess 2007 on the Northwind Microsoft Access database. There are three date fields in the Order table: OrderDate, Essential Date and Shipment

All these areas are in 1994-1996. I am trying to input it into ETL system, but this system does not allow dates of 15 years of age.

I want to add 10 years for each of those three areas.

I'm trying something like this: Update Order OrderDate = DateAdd ("yyyy", 10, OrderDate)

Set ... but error "Get very little parameters . 1 Expected "When I see this error, it is usually used to call a typo in a column name, but I do not see it anywhere. Any suggestions?

The issue is definitely not caused by a syntax error with dateAdd . This instant window example indicates that your add date syntax is valid.

 ? DateAd ("Yay", 10, Date ()) 2/18/2024  

And it will work in the same VBA code or in a query.

Be careful that an entry field can contain both names and captions properties.

Field properties showing names and captions

When a field When a caption is specified in, in many cases the caption is used instead of the field name. This is such a situation when you open the table directly in the datasheet view.

In your case, the table may contain a field whose caption is "OrderDate ", but the actual field name is something else in one question, you use the name Because entry will not recognize captions, suppose it should be a parameter, and you expect to supply a value for the parameter.

Check the table design to make sure you are using the actual field name in your query.

You can avoid this problem by creating your query in the Access Query Designer. Start it as a SELECT query and select from available field names. After you have done it correctly as SELECT , you can actually convert it to UPDATE .

Access facilitates handheld handheld many times they find it their way and become upset. But this is a case where accessibility can be helpful to helpful trends with the help of: -)

I have a copy of Northwind from Access 2007. At least in my copy, the field is named "order date". So the caption was not the culprit simply the name of the bracket field so the access would be identified as "one thing" instead of two.

  update command SET [order date] = add date ("Yyyy", 10, [order date]);  

Another example of this problem is that the query designer can help you avoid it.


Comments