Date range in header and date format

G

Guest

I've created a database to track timecards and I've run across two issues I
can't find an answer to:

How do I change the date format without using the presets. We work in
yyyy/mm/dd; also on one report I need to display mmm/dd. Neither of these
options appears in the presets.

I've added a date range requirement to a query, when the report is run the
user is prompted "start date: mm/dd/yy" then "end date: mm/dd/yy" (see above
note on changing the date format). I would like the date range selected to
appear in the report header as "Pay Period: YYYY/MM/DD to YYYY/MM/DD".
Suggestions?

Thanks!
Pamala
 
D

Douglas J. Steele

You type the desired format string in, rather than chosing a named format.

For the header, you'd set the control source of the text box to:

"Pay Period: " & Format([start date: mm/dd/yy], "yyyy\/mm\/dd") & " to " &
Format([end date: mm/dd/yy], "yyyy\/mm\/dd")

Note the \ in front of the / in the format statement: that guarantees you'll
get / as separators (otherwise, it'll use whatever has been defined as the
Date Separator in Regional Settings)
 
G

Guest

Use Format([YourDateField], "yyyy/mm/dd") and for report header use
"Pay Period: "& Format([YourFromDateField], "yyyy/mm/dd") & " To " &
Format([YourToDateField], "yyyy/mm/dd") in the textbox.
 
G

Guest

Thanks! It worked. I didn't know that you could override the presets just by
typing - that tidbit helped with a lot of minor issues.

And the heading info worked to,

Again, thanks!

Pamala

Douglas J. Steele said:
You type the desired format string in, rather than chosing a named format.

For the header, you'd set the control source of the text box to:

"Pay Period: " & Format([start date: mm/dd/yy], "yyyy\/mm\/dd") & " to " &
Format([end date: mm/dd/yy], "yyyy\/mm\/dd")

Note the \ in front of the / in the format statement: that guarantees you'll
get / as separators (otherwise, it'll use whatever has been defined as the
Date Separator in Regional Settings)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


PureEvil said:
I've created a database to track timecards and I've run across two issues
I
can't find an answer to:

How do I change the date format without using the presets. We work in
yyyy/mm/dd; also on one report I need to display mmm/dd. Neither of these
options appears in the presets.

I've added a date range requirement to a query, when the report is run the
user is prompted "start date: mm/dd/yy" then "end date: mm/dd/yy" (see
above
note on changing the date format). I would like the date range selected
to
appear in the report header as "Pay Period: YYYY/MM/DD to YYYY/MM/DD".
Suggestions?

Thanks!
Pamala
 

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