Date format in export query

G

Guest

I have a DateDue field and a TimeDue field. I lose the formatting when
exporting my query result.

I am selecting Microsoft Word Merge (*.txt.

The query looks fine with those the format property set to short date and h
ampm, respectively, but I get a full blown date/time for each. 01/31/2005
00:00:00 for DateDue and then a wierd 12/30/1899 10:00:00 for TimeDue.

How do I get the transferred output to display just 01/31/2005 for Date Due
and 10AM for TimeDue?

Thanks in advance your help!
 
D

Douglas J. Steele

Use the Format function on those fields in your query (do not just apply a
format to the field).
 
G

Guest

Thanks for responding, Doug. I tried that first and couldn't get it to work.
Would you reply with the specific syntax, please?

e.g. NewDate: Format([dateDue]...... or whatever.

Thanks!
 
D

Douglas J. Steele

NewDate: Format([dateDue], "mm/dd/yyyy")

or

NewDate: Format([dateDue], "Short Date")

NewTime: Format([timeDue], "hAM/PM")

Is there some reason why you've split the date and time? I've always found
it far easier to work with them when they're combined.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



KADL said:
Thanks for responding, Doug. I tried that first and couldn't get it to
work.
Would you reply with the specific syntax, please?

e.g. NewDate: Format([dateDue]...... or whatever.

Thanks!

Douglas J. Steele said:
Use the Format function on those fields in your query (do not just apply
a
format to the field).
 
G

Guest

Thanks, Doug! I discovered that using CDate also made the date come out
correctly.
 
G

Guest

I'm finally back at this!

How do you control data entry of date and time if they are not separated? I
only use the combined when it is a date/time stamp.

The delimited export of the time field looks great using NewTime:
Format([timeDue], "h AMPM")

However, NewDate: Format([dateDue], "mm/dd/yyyy") still gives me "2/17/2005
0:00:00" in the exported .txt file. It does look fine in the query. The same
is true using "Short Date".

This is bizarre!

Thanks for any further help you can give me.

Douglas J. Steele said:
NewDate: Format([dateDue], "mm/dd/yyyy")

or

NewDate: Format([dateDue], "Short Date")

NewTime: Format([timeDue], "hAM/PM")

Is there some reason why you've split the date and time? I've always found
it far easier to work with them when they're combined.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



KADL said:
Thanks for responding, Doug. I tried that first and couldn't get it to
work.
Would you reply with the specific syntax, please?

e.g. NewDate: Format([dateDue]...... or whatever.

Thanks!

Douglas J. Steele said:
Use the Format function on those fields in your query (do not just apply
a
format to the field).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have a DateDue field and a TimeDue field. I lose the formatting when
exporting my query result.

I am selecting Microsoft Word Merge (*.txt.

The query looks fine with those the format property set to short date
and
h
ampm, respectively, but I get a full blown date/time for each.
01/31/2005
00:00:00 for DateDue and then a wierd 12/30/1899 10:00:00 for TimeDue.

How do I get the transferred output to display just 01/31/2005 for Date
Due
and 10AM for TimeDue?

Thanks in advance your help!
 
G

Guest

Nevermind the part of my reply cocerning formatting. I believe a schema.ini
file caused the problem because when I deleted it and re-ran the export, the
dates looked fine.

I guess I don't fully understand when and how the schema.ini file gets
created, because it didn't reappear, but my export file got created and it
looks great.

Douglas J. Steele said:
NewDate: Format([dateDue], "mm/dd/yyyy")

or

NewDate: Format([dateDue], "Short Date")

NewTime: Format([timeDue], "hAM/PM")

Is there some reason why you've split the date and time? I've always found
it far easier to work with them when they're combined.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



KADL said:
Thanks for responding, Doug. I tried that first and couldn't get it to
work.
Would you reply with the specific syntax, please?

e.g. NewDate: Format([dateDue]...... or whatever.

Thanks!

Douglas J. Steele said:
Use the Format function on those fields in your query (do not just apply
a
format to the field).

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have a DateDue field and a TimeDue field. I lose the formatting when
exporting my query result.

I am selecting Microsoft Word Merge (*.txt.

The query looks fine with those the format property set to short date
and
h
ampm, respectively, but I get a full blown date/time for each.
01/31/2005
00:00:00 for DateDue and then a wierd 12/30/1899 10:00:00 for TimeDue.

How do I get the transferred output to display just 01/31/2005 for Date
Due
and 10AM for TimeDue?

Thanks in advance your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top