Week number

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

Guest

Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on this string?

Thanks in advance.
an
 
Try:

DatePart("ww", BckDay)

Read the Help file, too. There are a couple of additional parameters you can
pass to the function to control what is used for the first day of the week,
and the first week of the year.
 
An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt() as in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))
 
I obviously missed the fact that you were talking about a literal string.
Bill's given you what you need.
 
Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an
 
Whenever you're using functions for control sources, you need to prefix the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))
 
When using an expression in a ControlSource, you must use an equal sign in
front of it.
=week(mid("BckDay 20-11-2006 15:8:5",8))
 
Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one textbox
txtWeekNumber

Thanks
an
 
Sorry.
Return the same error.
Read my previous reply to Douglas Steele, please.
an
 
In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like "BckDay *";

Work fine. After to choose the table date in cbo, show us the correspondent
table .
In adition, I would like to show week number too, in one textbox, based in
same date...

an
 
I meant the control source for the text box that's raising the error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like "BckDay *";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox, based in
same date...

an

Douglas J. Steele said:
Post exactly what you've got for the ControlSource.
 
=Week(Mid("BckDay 20-11-2006 15:8:5";8))
and
Format=Medium Date

Douglas J. Steele said:
I meant the control source for the text box that's raising the error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like "BckDay *";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox, based in
same date...

an

Douglas J. Steele said:
Post exactly what you've got for the ControlSource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one textbox
txtWeekNumber

Thanks
an

:

Whenever you're using functions for control sources, you need to
prefix
the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an

:

An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt() as in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))

--
Bill Mosca, MS Access MVP


Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on this
string?

Thanks in advance.
an
 
Remove the formatting. I don't know if that is affecting it or not, but a
week number is not a date. It is a number. In the solution I provided, the
number is actually a string. But it is still not a date.

--
Bill Mosca, MS Access MVP


an said:
=Week(Mid("BckDay 20-11-2006 15:8:5";8))
and
Format=Medium Date

Douglas J. Steele said:
I meant the control source for the text box that's raising the error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like "BckDay
*";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox, based
in
same date...

an

:

Post exactly what you've got for the ControlSource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one textbox
txtWeekNumber

Thanks
an

:

Whenever you're using functions for control sources, you need to
prefix
the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an

:

An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt() as
in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))

--
Bill Mosca, MS Access MVP


Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on this
string?

Thanks in advance.
an
 
Ooops!
Exactly.
Thank you.
But return same error...
(?)


Bill Mosca said:
Remove the formatting. I don't know if that is affecting it or not, but a
week number is not a date. It is a number. In the solution I provided, the
number is actually a string. But it is still not a date.

--
Bill Mosca, MS Access MVP


an said:
=Week(Mid("BckDay 20-11-2006 15:8:5";8))
and
Format=Medium Date

Douglas J. Steele said:
I meant the control source for the text box that's raising the error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like "BckDay
*";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox, based
in
same date...

an

:

Post exactly what you've got for the ControlSource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one textbox
txtWeekNumber

Thanks
an

:

Whenever you're using functions for control sources, you need to
prefix
the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an

:

An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt() as
in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))

--
Bill Mosca, MS Access MVP


Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on this
string?

Thanks in advance.
an
 
ARGH! I just noticed you do not have the right code. My fault.

It should be:
=Format(Mid("BckDay 20-11-2006 15:8:5",8),"ww")

--
Bill Mosca, MS Access MVP


an said:
Ooops!
Exactly.
Thank you.
But return same error...
(?)


Bill Mosca said:
Remove the formatting. I don't know if that is affecting it or not, but a
week number is not a date. It is a number. In the solution I provided,
the
number is actually a string. But it is still not a date.

--
Bill Mosca, MS Access MVP


an said:
=Week(Mid("BckDay 20-11-2006 15:8:5";8))
and
Format=Medium Date

:

I meant the control source for the text box that's raising the error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like
"BckDay
*";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox,
based
in
same date...

an

:

Post exactly what you've got for the ControlSource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one
textbox
txtWeekNumber

Thanks
an

:

Whenever you're using functions for control sources, you need to
prefix
the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an

:

An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt() as
in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))

--
Bill Mosca, MS Access MVP


Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on
this
string?

Thanks in advance.
an
 
Oooops!

Now already show us 47. Because is "BckDay 20-11-2006 15:8:5"...
But if change to another table, in combo, it doesn't update to week...
Thanks

Bill Mosca said:
ARGH! I just noticed you do not have the right code. My fault.

It should be:
=Format(Mid("BckDay 20-11-2006 15:8:5",8),"ww")

--
Bill Mosca, MS Access MVP


an said:
Ooops!
Exactly.
Thank you.
But return same error...
(?)


Bill Mosca said:
Remove the formatting. I don't know if that is affecting it or not, but a
week number is not a date. It is a number. In the solution I provided,
the
number is actually a string. But it is still not a date.

--
Bill Mosca, MS Access MVP


=Week(Mid("BckDay 20-11-2006 15:8:5";8))
and
Format=Medium Date

:

I meant the control source for the text box that's raising the error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like
"BckDay
*";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox,
based
in
same date...

an

:

Post exactly what you've got for the ControlSource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one
textbox
txtWeekNumber

Thanks
an

:

Whenever you're using functions for control sources, you need to
prefix
the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an

:

An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt() as
in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))

--
Bill Mosca, MS Access MVP


Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on
this
string?

Thanks in advance.
an
 
Try putting

Me.txtWeekNumber.Requery

in the AfterUpdate event of the combo box.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


an said:
Oooops!

Now already show us 47. Because is "BckDay 20-11-2006 15:8:5"...
But if change to another table, in combo, it doesn't update to week...
Thanks

Bill Mosca said:
ARGH! I just noticed you do not have the right code. My fault.

It should be:
=Format(Mid("BckDay 20-11-2006 15:8:5",8),"ww")

--
Bill Mosca, MS Access MVP


an said:
Ooops!
Exactly.
Thank you.
But return same error...
(?)


:

Remove the formatting. I don't know if that is affecting it or not,
but a
week number is not a date. It is a number. In the solution I provided,
the
number is actually a string. But it is still not a date.

--
Bill Mosca, MS Access MVP


=Week(Mid("BckDay 20-11-2006 15:8:5";8))
and
Format=Medium Date

:

I meant the control source for the text box that's raising the
error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like
"BckDay
*";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox,
based
in
same date...

an

:

Post exactly what you've got for the ControlSource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one
textbox
txtWeekNumber

Thanks
an

:

Whenever you're using functions for control sources, you need
to
prefix
the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an

:

An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt()
as
in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))

--
Bill Mosca, MS Access MVP


Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on
this
string?

Thanks in advance.
an
 
Don't change

If to read in combo don't change week number.
Only change if we change in "formulae" directly...
:-(

Douglas J. Steele said:
Try putting

Me.txtWeekNumber.Requery

in the AfterUpdate event of the combo box.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


an said:
Oooops!

Now already show us 47. Because is "BckDay 20-11-2006 15:8:5"...
But if change to another table, in combo, it doesn't update to week...
Thanks

Bill Mosca said:
ARGH! I just noticed you do not have the right code. My fault.

It should be:
=Format(Mid("BckDay 20-11-2006 15:8:5",8),"ww")

--
Bill Mosca, MS Access MVP


Ooops!
Exactly.
Thank you.
But return same error...
(?)


:

Remove the formatting. I don't know if that is affecting it or not,
but a
week number is not a date. It is a number. In the solution I provided,
the
number is actually a string. But it is still not a date.

--
Bill Mosca, MS Access MVP


=Week(Mid("BckDay 20-11-2006 15:8:5";8))
and
Format=Medium Date

:

I meant the control source for the text box that's raising the
error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


In cboBckTables ControlSource
SELECT [Name] FROM MSysObjects WHERE [Type]=1 and [Name] like
"BckDay
*";

Work fine. After to choose the table date in cbo, show us the
correspondent
table .
In adition, I would like to show week number too, in one textbox,
based
in
same date...

an

:

Post exactly what you've got for the ControlSource.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Sorry.
Return the same error.

For another words:
The table name it is selected in one combobox
cboBckTables

Remembering:
The tables names are type
BckDay 20-11-2006 15:8:5

and I would like to reproduce the number of this week in one
textbox
txtWeekNumber

Thanks
an

:

Whenever you're using functions for control sources, you need
to
prefix
the
function call with an equals sign.

Try:

=Week(Mid("BckDay 20-11-2006 15:8:5",8))

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thanks for reply.

Both solutions, in Control Source text box, return #Name?
My ignorance?

an

:

An

This will get the week number as a string:
week(mid("BckDay 20-11-2006 15:8:5",8))

If you need it as a number you can convert it using CInt()
as
in:
CInt(week(mid("BckDay 20-11-2006 15:8:5",8)))

--
Bill Mosca, MS Access MVP


Hi!

I have many dynamic tables.
The tables names are type:
BckDay 20-11-2006 15:8:5
Is it possible to know the number of the week, based on
this
string?

Thanks in advance.
an
 

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

Similar Threads


Back
Top