automatically updating textbox and adding it to tables

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

Guest

Simple question for Access 2000,
I have a textbox on a form that display's the current date and the control
source is set to the date on the table. I then have another textbox on the
same form set to display the day of that date entered and it's control source
set to the day on the table. I would like the day to automatically change to
the
date entered but then be sent to the table. I tried adding a third text box
to change the day that is entered, which works but will not get added to the
table since it's control source is set to textbox 2. So i tried adding a
fourth textbox and it's control source set to the day in the table but it
doesn't change and doesn't get added to the table. I also tried adding
textbox3 to the default value, but that didn't work either. By the way, I was
going to hide all the other's and just display the one that gets changed and
sent to the
table.

Examples....

(textbox 1) Date: 01-09-2006 <-- this control source is set to date in table.
(textbox 2) Day: Monday <-- this control souce is set to day in table.
(textbox 3) Day: Monday <-- this control source is set to textbox 2.
(textbox 4) Day: Monday <-- the control source is set to day in table, and
default value is textbox 3.

But this is what happens if i change the date in textbox 1.
(textbox 1) Date: 01-10-2006
(textbox 2) Day: Monday <-- this one doesn't get changed.
(textbox 3) Day: Tuesday
(textbox 4) Day: Monday <-- this one doesn't get changed or added to table.

Is there another way to do this or am i on the right track but just missing
something?

Thanks,

Steve K.
 
Hi Steve,

You should not be trying to store the day, because this can be calculated
from the date. In general, you never want to store values that can be derived
from other data that is stored in the database. Try setting the control
source for Textbox 2 to this:

=WeekdayName(Weekday([OrderDate]))

This assumes that Sunday is the first day of the week. You can add an
optional parameter to the Weekday function to adjust if this is not the case.
For example,

=WeekdayName(Weekday([OrderDate],2))

if Monday is the first day of the week.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

:

Simple question for Access 2000,
I have a textbox on a form that display's the current date and the control
source is set to the date on the table. I then have another textbox on the
same form set to display the day of that date entered and it's control source
set to the day on the table. I would like the day to automatically change to
the
date entered but then be sent to the table. I tried adding a third text box
to change the day that is entered, which works but will not get added to the
table since it's control source is set to textbox 2. So i tried adding a
fourth textbox and it's control source set to the day in the table but it
doesn't change and doesn't get added to the table. I also tried adding
textbox3 to the default value, but that didn't work either. By the way, I was
going to hide all the other's and just display the one that gets changed and
sent to the
table.

Examples....

(textbox 1) Date: 01-09-2006 <-- this control source is set to date in table.
(textbox 2) Day: Monday <-- this control souce is set to day in table.
(textbox 3) Day: Monday <-- this control source is set to textbox 2.
(textbox 4) Day: Monday <-- the control source is set to day in table, and
default value is textbox 3.

But this is what happens if i change the date in textbox 1.
(textbox 1) Date: 01-10-2006
(textbox 2) Day: Monday <-- this one doesn't get changed.
(textbox 3) Day: Tuesday
(textbox 4) Day: Monday <-- this one doesn't get changed or added to table.

Is there another way to do this or am i on the right track but just missing
something?

Thanks,

Steve K.
 

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

Back
Top