Return week number

G

Guest

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
 
D

Douglas J Steele

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.
 
G

Guest

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.

Douglas J Steele said:
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!)


hughess7 said:
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
 
D

Douglas J Steele

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!)


hughess7 said:
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.

Douglas J Steele said:
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!)


hughess7 said:
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
 
G

Guest

I know, it is when I put the equal sign I get that error


Douglas J Steele said:
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!)


hughess7 said:
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.

Douglas J Steele said:
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
 
G

Guest

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

Douglas J Steele said:
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!)


hughess7 said:
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.

Douglas J Steele said:
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
 
D

Douglas J Steele

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!)


hughess7 said:
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

Douglas J Steele said:
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!)


hughess7 said:
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
 
G

Guest

=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?

Douglas J Steele said:
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!)


hughess7 said:
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

Douglas J Steele said:
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
 
D

Douglas J. Steele

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!)



hughess7 said:
=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?

Douglas J Steele said:
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!)


hughess7 said:
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
 
G

Guest

Mmm very odd.

Replacing vbFirstFullWeek with 3 made no difference and if I put
=Format(Date(),"mmmm") & " wk " & DatePart("ww",Date(), , 3) or
=Format(Date(),"mmmm") & " wk " & DatePart("ww",Date(), , vbFirstFullWeek)

I still get the error 'The expression you entered contains Invalid syntax
....' and it will not let me enter it in the control source of an unbound text
field using Access 2003.

Sue

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!)



hughess7 said:
=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?

Douglas J Steele said:
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
 
G

Guest

Cracked it finally :). Seems you have to put a value in for the other
optional argument too. This seems to work...

=Format(Forms![frm report menu]!startDate,"mmmm") & " wk " &
DatePart("ww",Forms![frm Report Menu]!StartDate,1,3)


Thanks
Sue


hughess7 said:
Mmm very odd.

Replacing vbFirstFullWeek with 3 made no difference and if I put
=Format(Date(),"mmmm") & " wk " & DatePart("ww",Date(), , 3) or
=Format(Date(),"mmmm") & " wk " & DatePart("ww",Date(), , vbFirstFullWeek)

I still get the error 'The expression you entered contains Invalid syntax
...' and it will not let me enter it in the control source of an unbound text
field using Access 2003.

Sue

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!)



hughess7 said:
=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
 
D

Douglas J Steele

Glad it worked. Odd that I don't need the 3rd parameter when I run.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hughess7 said:
Cracked it finally :). Seems you have to put a value in for the other
optional argument too. This seems to work...

=Format(Forms![frm report menu]!startDate,"mmmm") & " wk " &
DatePart("ww",Forms![frm Report Menu]!StartDate,1,3)


Thanks
Sue


hughess7 said:
Mmm very odd.

Replacing vbFirstFullWeek with 3 made no difference and if I put
=Format(Date(),"mmmm") & " wk " & DatePart("ww",Date(), , 3) or
=Format(Date(),"mmmm") & " wk " & DatePart("ww",Date(), , vbFirstFullWeek)

I still get the error 'The expression you entered contains Invalid syntax
...' and it will not let me enter it in the control source of an unbound text
field using Access 2003.

Sue

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
 

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