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