Douglas J. Steele said:
It works fine for me.
See whether replacing vbFirstFullWeek with its value (3) is any better.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
=Format(Forms![frm report menu]!startDate,"mmmm") Works fine as does
=DatePart("ww", Forms![frm Report Menu]!StartDate and both together are ok
too
but this doesn't work:
=DatePart("ww", Forms![frm Report Menu]!StartDate, , vbFirstFullWeek)
You can't enter it as an expression in a control source as Access objects
with the invalid syntax error msg.
I will try your other question when I am back at work on Monday but I
don't
think it will work. Access doesn't appear to like the double commas. Have
you
got this syntax to work before?
:
Does =Format(Forms![frm report menu]!startDate,"mmmm") work by itself?
What about =DatePart("ww", Forms![frm Report Menu]!StartDate, ,
vbFirstFullWeek)?
If neither works, does Forms![frm Report Menu]!StartDate contain a proper
date? (Is frm Report Menu open?)
What do you get if you use =Format(Date(),"mmmm") & " wk " &
DatePart("ww",
Date(), , vbFirstFullWeek)?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
I am trying to get Month WeekNo (eg August wk32) as a Heading. Tried
the
following:
=Format(Forms![frm report menu]!startDate,"mmmm") & " wk " &
DatePart("ww",
Forms![frm Report Menu]!StartDate, , vbFirstFullWeek)
but get the syntax error I posted earlier.
Sue
:
If you're trying to use them as a control source, you need an equal
sign
in
front:
=DatePart("ww", Forms![frm Report Menu]!StartDate, , vbFirstFullWeek)
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Thanks Doug, if I put either of these examples in a control source
of
an
unbound text box on my report, I get an error:
The expression you entered contains invalid syntax. You may have
entered
an
operand without an operator.
:
The syntax for the DatePart function is:
DatePart(interval, date[,firstdayofweek[, firstweekofyear]])
You need to use
DatePart("ww", Forms![frm Report Menu]!StartDate, ,
vbFirstFullWeek)
or else use
DatePart("ww", Forms![frm Report Menu]!StartDate,
FirstWeekOfYear:=vbFirstFullWeek)
Note that there are 2 commas in a row in the first option, and a
colon-equal
sign in the second.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Hi all
I have an unbound text field in a report with the control
source
of:
(DatePart("ww",Forms![frm Report Menu]!StartDate)
In 2005 because the 1st was a Saturday, as default, Access
calculates
this
as week one. I actually want Mon 3rd to start as week one. I
know
the
format
function has optional parameters for setting firstweekofyear
but I
am
not
sure of how to use this syntax. Tried putting format around my
datepart
function and adding ,vbFirstFullWeek but this didn't work.
Can anyone help with this please?
Thanks
Sue