First WHAT was the parametric query? Did it ask for NewDateField? If that is
the case, you either did not add that field to your table (azQuick?) or you
have misspelled the field name.
If you ran the query, did you simply switch to datasheet view. That will show
you what will be updated, but does not run the query. Try selecting Query:
Run from the menu and see what happens.
As a check try the following and see if any records get returned
SELECT *
FROM AZQuick
WHERE IsDate(Format([WLCREATEDATE], "@@@@\-@@\-@@")) and
IsDate(Format([WLCREATETIME], "@@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@"))
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Amin wrote:
Hi John,
I still can't get this to work. When I ran this code:
UPDATE azquick
SET [newdatefield] = CDate(Format([WLCREATEDATE],"@@@@\-@@\-@@") & " " &
Format([WLCREATETIME],"@@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@"))
WHERE WLCREATEDate is not null and WLCreateTime is Not Null;
The parametric query popped up, and whatever I put in there it gave an error
message as field is not updateable. I then changed [newdatefield] to
[WLCREATEDATE], and the update query ran, but nothing changed.
Any thoughts?
Amin
:
If either the date field or the time field is blank (null or otherwise) or
cannot be interpreted as a date, you will get the errors. Also your QUERY
syntax is wrong and the FORMAT function for the time is missing a comma.
UPDATE [Name of Your Table]
SET [Name of a Field] = CDate( Format([WLCREATEDATE], "@@@@\-@@\-@@") & " " &
Format([WLCREATETIME], "@@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@") )
WHERE CLCREATEDate is not null and WLCreateTime is Not Null
A better check would be the following
WHERE IsDate(Format([WLCREATEDATE], "@@@@\-@@\-@@")) and
IsDate(Format([WLCREATETIME], "@@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@"))
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Amin wrote:
I keep getting an error when I run this query to change the number to a date?
UPDATE CDate( Format([WLCREATEDATE], "@@@@\-@@\-@@") & " " &
Format([WLCREATETIME]
"@@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@\
![Mad :mad: :mad:](/styles/default/custom/smilies/angry.gif)
@")) FROM [WFLOW,OLD]
Why is this? Can I run a Macro to convert this?
Thanks,
Amin
:
Thanks! So I've decided to import all of documents with data type, "text",
and you have shown me how to change these to date/time. How would I change
them to numbers?
Well... if the data represented by the value is in fact a date, you would be
doing yourself a disservice by casting them as numbers. If you are importing
data and want a number value, you can use CLng() to convert a text string to a
Long Integer, or CDbl to convert it to a Double Float, or CCur() to convert to
Currency.