UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> pulling my hair out! (access dates)    
 
   
s_adlam
post Jun 15 2010, 07:42 AM
Post #1

UtterAccess Addict
Posts: 151



Hi....
I'm struggling with a particular problem with dates! I have a form in which the date of completion is added in a text box. with format set to medium date. (dd-mmm-yy) however the date in this text box is being stored as mm/dd/yyyy in the table, so even when the text box on the form reads "01-Jul-10" the data in the table is stored as 07/01/2010.
This knackers up my reporting structure as it then thinks it's the 1st jan! do all my calculations are out......

the code i'm using to get this data from the text box into the table is:
CODE
UpdateSQL = "UPDATE TblDPAAction SET TblDPAAction.Updatecomp = [forms]![frmdpaactionupdate].[txtuc], " & _
    "TblDPAAction.DTuc = #" & Format( [Forms]![frmdpaactionupdate].[TxtTime],"dd/mm/yyyy") & "#, TblDPAAction.Staffupdatecomp = [forms]![frmunit].[txtusername] " & _
    "WHERE (((TblDPAAction.id)=[forms]![frmdpaactionupdate].[txtid]));"
    DoCmd.SetWarnings False
    DoCmd.RunSQL UpdateSQL
    DoCmd.SetWarnings True


Any help would be much appreciated........ don't know where to go next! (IMG:style_emoticons/default/shrug.gif)

Thanks
Steve
Go to the top of the page
 
+
John Spencer
post Jun 15 2010, 07:57 AM
Post #2

UtterAccess VIP
Posts: 2,446
From: Columbia, Maryland



Try changing your update query to use the unambiguous date format of yyyy-mm-dd.

UpdateSQL = "UPDATE TblDPAAction SET TblDPAAction.Updatecomp = [forms]![frmdpaactionupdate].[txtuc], " & _
"TblDPAAction.DTuc = #" & Format( [Forms]![frmdpaactionupdate].[TxtTime],"yyyy-mm-dd") & "#, TblDPAAction.Staffupdatecomp = [forms]![frmunit].[txtusername] " & _
"WHERE (((TblDPAAction.id)=[forms]![frmdpaactionupdate].[txtid]));"
DoCmd.SetWarnings False
DoCmd.RunSQL UpdateSQL
DoCmd.SetWarnings True

For an explanation of what is going on see
International Dates in Access at:
http://allenbrowne.com/ser-36.html
Go to the top of the page
 
+
s_adlam
post Jun 15 2010, 08:14 AM
Post #3

UtterAccess Addict
Posts: 151



Hooray, that worked! thanks.
I've had a good look through allens stuff too.. thanks for the help.... just need to put the clumps of hair back now!
Steve
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 06:30 AM