View Single Post
  #4  
Old July 8th, 2009, 10:09 PM posted to microsoft.public.access
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Update Query Questions

While Dave's given you the correct answer (i.e.: you shouldn't store
DischargeYear as it's redundant), the other reason your query didn't work is
because dates need to be delimited with #, not quote:


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Chuck W" wrote in message
...
Hi,
I have a table called AHRQ with a date/time field called DISCHARGEDATE and
a
numeric field that is currently blank called DISCHARGEYEAR. The
DISCHARGEDATE field has normal date values (i.e. 6/1/2008). I want to run
an
update query that will populate the DISCHARGEYEAR field with the value
2008
if the discharge date is a 2008 date. I keep getting an "Data Type
mismatch
in criteria expression" error when I run the following query. I have
changed
the format of the DISCHARGEYEAR field from text to numeric but get the
same
error. Can someone help?

Thanks,



UPDATE AHRQ SET AHRQ.[DISCHARGEYEAR] = "2008"
WHERE (([DISCHARGEDATE] Between "1/1/2008" And "12/31/2008"));