Change field name in subform

B

Boon

Hello,

I have a form and a subform. In the main form, I have a combo box for
choosing a week number. Then after choosing a week number, a subform will
populate a value by day. The data comes from one table.
e.g.

Mon Tue Wed Thu Fri
4 5 6 7 2
3 1 6 4 6


Now, instead of having a field's name as "Mon", I would like to have it as
"Mon 12/1". 12/1 is Monday's day in the choosen week number. So it can be
"Mon 12/8",....

I appreaciate your helps.

Thanks
 
D

Dale Fye

What is the week number in relation to (Calendar year, Fiscal Year)?

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
D

Dale Fye

Boon,

Where do the numeric values come from? It would be really helpful to know
the table structure which stores the data that generates your subform. I
would think they would have to come from a table somewhere that contains a
date field. If this is the case, then you could use the format command to
format the headers, something like:

Format([DateField], "ddd mm/dd") to get Thu 12/4

Then you use the Datepart( ) function to limit the records under consideration

WHERE Datepart("ww", [DateField]) = intWeek


The following will give you the date of Sunday of the week (intWeek) in the
current calenday year. You could use that and add additional days for the
Mon-Friday dates.

dateadd("d", (intWeek - 1)* 7 + 1, Dateserial(Year(Date()), 1, 1))

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.
 
B

Boon

Is that your mehtod changing the value not the field's name?

Dale Fye said:
Boon,

Where do the numeric values come from? It would be really helpful to know
the table structure which stores the data that generates your subform. I
would think they would have to come from a table somewhere that contains a
date field. If this is the case, then you could use the format command to
format the headers, something like:

Format([DateField], "ddd mm/dd") to get Thu 12/4

Then you use the Datepart( ) function to limit the records under
consideration

WHERE Datepart("ww", [DateField]) = intWeek


The following will give you the date of Sunday of the week (intWeek) in
the
current calenday year. You could use that and add additional days for the
Mon-Friday dates.

dateadd("d", (intWeek - 1)* 7 + 1, Dateserial(Year(Date()), 1, 1))

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Boon said:
Hello,

I have a form and a subform. In the main form, I have a combo box for
choosing a week number. Then after choosing a week number, a subform will
populate a value by day. The data comes from one table.
e.g.

Mon Tue Wed Thu Fri
4 5 6 7 2
3 1 6 4 6


Now, instead of having a field's name as "Mon", I would like to have it
as
"Mon 12/1". 12/1 is Monday's day in the choosen week number. So it can be
"Mon 12/8",....

I appreaciate your helps.

Thanks
 
D

Dale Fye

Well,

I would not recommend changing a field name. That is why I asked where the
data comes from for the subform. If it is a query (as I suspect), then we
could manipulate it some.

Now that you mention it. If the headers of those columns in the subform are
just captions, then you could do something during the after update event of
the combo where they select the week that just changes the captions in the
labels for each of those columns. That might look something like:

me.subFormControlName.form.labelMonday.Caption = Format(dateadd("d",
(intWeek - 1)* 7 + 2, Dateserial(Year(Date()), 1, 1)), "ddd mm/dd")

You would need a line similar to this for each of the column labels.

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Boon said:
Is that your mehtod changing the value not the field's name?

Dale Fye said:
Boon,

Where do the numeric values come from? It would be really helpful to know
the table structure which stores the data that generates your subform. I
would think they would have to come from a table somewhere that contains a
date field. If this is the case, then you could use the format command to
format the headers, something like:

Format([DateField], "ddd mm/dd") to get Thu 12/4

Then you use the Datepart( ) function to limit the records under
consideration

WHERE Datepart("ww", [DateField]) = intWeek


The following will give you the date of Sunday of the week (intWeek) in
the
current calenday year. You could use that and add additional days for the
Mon-Friday dates.

dateadd("d", (intWeek - 1)* 7 + 1, Dateserial(Year(Date()), 1, 1))

--
HTH
Dale

email address is invalid
Please reply to newsgroup only.



Boon said:
Hello,

I have a form and a subform. In the main form, I have a combo box for
choosing a week number. Then after choosing a week number, a subform will
populate a value by day. The data comes from one table.
e.g.

Mon Tue Wed Thu Fri
4 5 6 7 2
3 1 6 4 6


Now, instead of having a field's name as "Mon", I would like to have it
as
"Mon 12/1". 12/1 is Monday's day in the choosen week number. So it can be
"Mon 12/8",....

I appreaciate your helps.

Thanks
 

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