Time format changes when going from Access to Word

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,
I'm not sure if this is the right forum but based on other questions I've
read, I should at least start here. I have a field in a table called
StartTime and the datatype is Date/Time and the format is Medium Time. I
also have a phone number field that is stored in Access with hyphens in the
appropriate places. This all works great in Access. However, when I output
this field to a Word document the time is printed with the seconds. So in
Access is looks like this:
1:30PM, 999-999-9999
In Word, it looks like this:
1:30:00 PM, 9999999999

I've tried changing the Dim statement for each variable that holds these
values from a Varient to a String but still the formatting is lost. Does
anyone have any ideas? Thank you very much.
Debbie
 
Debbie said:
Hello all,
I'm not sure if this is the right forum but based on other questions I've
read, I should at least start here. I have a field in a table called
StartTime and the datatype is Date/Time and the format is Medium Time. I
also have a phone number field that is stored in Access with hyphens in the
appropriate places. This all works great in Access. However, when I output
this field to a Word document the time is printed with the seconds. So in
Access is looks like this:
1:30PM, 999-999-9999
In Word, it looks like this:
1:30:00 PM, 9999999999

I've tried changing the Dim statement for each variable that holds these
values from a Varient to a String but still the formatting is lost. Does
anyone have any ideas?


It all depends on how your data is interacting with Word.

Maybe all you need is to tell Word to format the time.

Alternatively, you can format it in the query you are using
to export the data to Word.

Since you mentioned using a VBA variable, maybe you are
using a procedure to export the data?? In this case, you
can Dim the variable as String and format the time when you
set the variable:
strStartTime = Format(StartTime, "h:nn AM/PM")
 
Back
Top