Format Ordinal date in Report using Visual Basic

  • Thread starter Thread starter h.a. collins
  • Start date Start date
H

h.a. collins

Hi There,

I have an Access 2003 database with a monthly report that needs to
include the text "Dated this 15th day of February, 2004" at the bottom
of the report.

I have seen a couple of postings related to formatting dates this
way--they all use VB code, and an unbound field directed to this data
source. I have tried to follow the directions and code posted using a
new VB module, but it doesn't seem to work for me.

I am specifically using the code in the reply to this posting:
http://groups.google.com/[email protected]

In my actual VB window, this part of the code is in red:
dteX = dteX & Nz(Choose(IIf((Abs(dteX) Mod 100) \ 10 = 1, 0,
Abs(dteX)) Mod
10, "st", "nd", "rd"), "th")

I don't know VB at all, so am at a loss how to troubleshoot. Any
ideas?

Many thanks,
Heather
 
h.a. collins said:
I have an Access 2003 database with a monthly report that needs to
include the text "Dated this 15th day of February, 2004" at the bottom
of the report.

I have seen a couple of postings related to formatting dates this
way--they all use VB code, and an unbound field directed to this data
source. I have tried to follow the directions and code posted using a
new VB module, but it doesn't seem to work for me.

I am specifically using the code in the reply to this posting:
http://groups.google.com/[email protected]

In my actual VB window, this part of the code is in red:
dteX = dteX & Nz(Choose(IIf((Abs(dteX) Mod 100) \ 10 = 1, 0,
Abs(dteX)) Mod
10, "st", "nd", "rd"), "th")

That line of code looks fine. Are you sure it's really all
on one line?
 
A-ha. There actually was a return in the line between 'Mod' and '10'
(dangers of copying and pasting I suppose). I put it all on one line
and that did the trick. Thanks for your help!
 
Back
Top