By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

Date and time formatting not working (apparently)...

Expert 100+
P: 931
Good afternoon all,

This is one of those seemingly simple problems. I've searched through many posts here, and many people have date and time issues, but not quite what mine is.

I've got a table called tblTicket, with a field fldReceivedDateTime (among many other non-date/time fields). This field is of Date/Time type, and formatted like "mm/dd/yy h:nn:ss AM/PM". Whenever a record is added, I stamp the record with the current date/time in that field. The assignment in the VB module looks like:

Expand|Select|Wrap|Line Numbers
  1. !fldReceivedDateTime = DateTime.Now
Later on, when I go to display the information in a text box on a form, txtReceivedDate, using

Expand|Select|Wrap|Line Numbers
  1. Me.txtReceivedDate = !fldReceivedDateTime
it displays as a number. For example, 12/20/07 9:36:01 AM appears in the text box as 39436.4000115741. This happens despite the fact that I have the text box formatted exactly the same way as the field in the table (mm/dd/yy h:nn:ss AM/PM). Nothing I do seems to rectify this.

Dec 21 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 931
In addition, when I set a breakpoint in the VB code at the point where I make the textbox assignment, and look at the value that VB is passing to the textbox, it is exactly what I want. This leads me to believe that there is something wrong with the textbox or form itself...

Thanks again.
Dec 21 '07 #2

Expert 100+
P: 931
Problem fixed.

I forgot that, as part of my form's initiailization process in the VB module, I was going through all the text boxes, clearing them, and setting the format equal to ">"...all caps. You can't put a date value into a text box formatted in all caps. So I set the format for my date text boxes equal to "General Date", and it works fine.
Dec 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.