A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date Format



 
 
Thread Tools Display Modes
  #1  
Old August 12th, 2004, 07:45 PM
Date Formating Problem
external usenet poster
 
Posts: n/a
Default Date Format

I have an import file (from Excel) that has a date in the following format:
yyyymmdd

I have created an input mask that adds a forward slash / to the date when I
do the import and thus creating yyyy/mm/dd

I would like to have it as mm/dd/yyyy either in the table (preferred) or
when I open the form and pull the data through a query have the date format
as mm/dd/yyyy.

Any suggestions on an expression I can use in the query?

On the form I have a combo box that the user selects a number and then a
list box is populated with all of the data (6 different fields) related to
that particular number.

Even though the input mask on the table improves the date format, when I
open the form the date reverts back to the yyyymmdd format, no slashes.

Thanks,

John
  #2  
Old August 12th, 2004, 11:01 PM
Tim Ferguson
external usenet poster
 
Posts: n/a
Default Date Format

"=?Utf-8?B?RGF0ZSBGb3JtYXRpbmcgUHJvYmxlbQ==?=" Date Formating
wrote in
:


I have an import file (from Excel) that has a date in the following
format: yyyymmdd


Importing from Excel is a notoriously cross-your-fingers-and-maybe-it'll-
work kind of affair. Is the field data type definitely a DateTime?

I have created an input mask that adds a forward slash / to the date
when I do the import and thus creating yyyy/mm/dd


Huh? Input mask only constrains user keystrokes, and does not affect data
values at all.

I would like to have it as mm/dd/yyyy either in the table (preferred)
or when I open the form and pull the data through a query have the
date format as mm/dd/yyyy.


It's stored as a double-precision floating point serial number, but that
should not matter to you (as long as it really is a DateTime value). You
can have any output format you want.

Any suggestions on an expression I can use in the query?


How about Format(MyDateField, "mm/dd/yyyy")

On the form I have a combo box that the user selects a number and then
a list box is populated with all of the data (6 different fields)
related to that particular number.


Don't sound very Normalised... :-(

Even though the input mask on the table improves the date format, when
I open the form the date reverts back to the yyyymmdd format, no
slashes.


I strongly suspect that this is a text or a numeric field rather than a
DateTime. There is no legal date format in the world that looks like
yyyymmdd so I would not be surprised that it was not parsed. You probably
need a conversion like

DateSerial(CInt(Mid(DateString,1,4)), _
CInt(Mid(DateString,5,2)), _
CInt(Mid(DateString,7,2)))

or if it's a numeric, do the same thing with Div and Mod operators. If you
can get a reliable and safe conversion you can do lots of useful things
with a proper date value.

On the other hand, the yyyymmdd still sorts, compares, and selects in the
right way, so do you really need to massage it further?

Best wishes


Tim F


  #3  
Old August 16th, 2004, 06:05 PM
John Daily
external usenet poster
 
Posts: n/a
Default

Thanks Tim!

The field that imports into the table shows up in the table as a text field.
I have everything set up in a form to pull the data I need. I just wanted
it to show up in the form as a an actual date format (mm/dd/yyyy) instead of
the text format of (yyyymmdd).

What do you mean below by "Normalized"?

On the form I have a combo box that the user selects a number and then
a list box is populated with all of the data (6 different fields)
related to that particular number.


Don't sound very Normalised... :-(



Thanks,

John
  #4  
Old August 16th, 2004, 06:41 PM
Tim Ferguson
external usenet poster
 
Posts: n/a
Default

"=?Utf-8?B?Sm9obiBEYWlseQ==?=" wrote
in :


What do you mean below by "Normalized"?



Among other things, it means Holding Exactly One Piece of Information in
One Field -- in other words not six bits. Six dates ought to be held in six
fields, or, more probably, in one field in six records of another table.

Normalisation is a design process that is based on Relational Theory, which
in turn is based on Set Theory, which you probably covered in school. R is
the basis of the current generation of (relational) database systems: if
you want to do anything useful with Access, you really do need some working
knowledge of the background.

(That is the short version: the long story fills entire textbooks and
postgrad courses!)

All the best


Tim F

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Dilema! Kagsy General Discussion 8 July 13th, 2004 03:45 AM
Date format for Track Changes Stuart K New Users 1 June 13th, 2004 11:09 AM
Pivot Table - Format of Date Field Peo Sjoblom Worksheet Functions 0 February 3rd, 2004 07:20 PM
Does date fall between two ranges? MR Worksheet Functions 4 January 14th, 2004 04:08 PM
Changing date format to text only Worksheet Functions 0 January 1st, 2004 07:37 AM


All times are GMT +1. The time now is 05:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.