Week number

D

Douglas J. Steele

Yeah, I forgot that you've got a hard-coded value there.

You'll have to change the ControlSource everytime you choose a new value
from the combobox.

Private Sub cboBckTables_AfterUpdate()

Me.txtWeekNumber.ControlSource = ""
Me.txtWeekNumber.ControlSource = "=Format(Mid(" & Me.cboBckTables &
",8),""ww"")"

End Sub

(Note that you need to double up the double quotes around ww to set it in
code)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


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

:

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
 
A

an

Sorry error '2434'
("...invalid sintax)
an

Douglas J. Steele said:
Yeah, I forgot that you've got a hard-coded value there.

You'll have to change the ControlSource everytime you choose a new value
from the combobox.

Private Sub cboBckTables_AfterUpdate()

Me.txtWeekNumber.ControlSource = ""
Me.txtWeekNumber.ControlSource = "=Format(Mid(" & Me.cboBckTables &
",8),""ww"")"

End Sub

(Note that you need to double up the double quotes around ww to set it in
code)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
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)


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

:

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
 
A

an

Now, return error '2334'
"The expression... contains invalid sintax.
Thanks.
an

Douglas J. Steele said:
Yeah, I forgot that you've got a hard-coded value there.

You'll have to change the ControlSource everytime you choose a new value
from the combobox.

Private Sub cboBckTables_AfterUpdate()

Me.txtWeekNumber.ControlSource = ""
Me.txtWeekNumber.ControlSource = "=Format(Mid(" & Me.cboBckTables &
",8),""ww"")"

End Sub

(Note that you need to double up the double quotes around ww to set it in
code)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
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)


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

:

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
 
D

Douglas J. Steele

My mistake. You need quotes around what's being returned from the combo box:

Me.txtWeekNumber.ControlSource = "=Format(Mid(""" & Me.cboBckTables &
""",8),""ww"")"

On the other hand, there's really no need to use ControlSource: simply set
the text box's value:

Me.txtWeekNumber = Format(Mid(Me.cboMckTables, 8), "ww")

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry error '2434'
("...invalid sintax)
an

Douglas J. Steele said:
Yeah, I forgot that you've got a hard-coded value there.

You'll have to change the ControlSource everytime you choose a new value
from the combobox.

Private Sub cboBckTables_AfterUpdate()

Me.txtWeekNumber.ControlSource = ""
Me.txtWeekNumber.ControlSource = "=Format(Mid(" & Me.cboBckTables &
",8),""ww"")"

End Sub

(Note that you need to double up the double quotes around ww to set it in
code)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Don't change

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

:

Try putting

Me.txtWeekNumber.Requery

in the AfterUpdate event of the combo box.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


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

:

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
 
A

an

Sorry.
Now, with
Me.txtWeekNumber = Format(Mid(Me.cboMckTables, 8), "ww")
in textbox, or unbound textbox, return exactly the complet string with
Date/Hour group.
Not week number...
But already don't return any error (when click in combo).

an

Douglas J. Steele said:
My mistake. You need quotes around what's being returned from the combo box:

Me.txtWeekNumber.ControlSource = "=Format(Mid(""" & Me.cboBckTables &
""",8),""ww"")"

On the other hand, there's really no need to use ControlSource: simply set
the text box's value:

Me.txtWeekNumber = Format(Mid(Me.cboMckTables, 8), "ww")

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


an said:
Sorry error '2434'
("...invalid sintax)
an

Douglas J. Steele said:
Yeah, I forgot that you've got a hard-coded value there.

You'll have to change the ControlSource everytime you choose a new value
from the combobox.

Private Sub cboBckTables_AfterUpdate()

Me.txtWeekNumber.ControlSource = ""
Me.txtWeekNumber.ControlSource = "=Format(Mid(" & Me.cboBckTables &
",8),""ww"")"

End Sub

(Note that you need to double up the double quotes around ww to set it in
code)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Don't change

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

:

Try putting

Me.txtWeekNumber.Requery

in the AfterUpdate event of the combo box.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


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

:

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

Top