autofill day of week field when entering date in date field

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

Guest

When the user enters a date in a date field, I need to have the day of the
week autofill in a separate text box.

I'm stumped, please help...
 
Try using the lost focus function to populate the other filed when the user
leaves the date filed with the same data that is in the filed the user enters
the date in but change the format of the new field to dddd for day of the
week.

-Tony
 
Chuck said:
When the user enters a date in a date field, I need to have the day of the
week autofill in a separate text box.


Just use an expression:
=Format(datetextbox, "dddd")
 
You'll use something like this in the fields control source...

=Format(DatePart("w", Now), "dddd")
 
Thanks you guys so much for your help, but I'm still having a problem.

I added a text box on my form, left the control source to unbound, set the
format to "dddd" and it works great. When a date is input to the "date" field
the unbound text box is filled with the day of the week.

The problem is when I set the control source of my unbound text box to my
"Day" field, the "short date" format is shown not the day of the week.

Any ideas?

Thanks again..
 
The problem is when I set the control source of my unbound text box to
my "Day" field, the "short date" format is shown not the day of the
week.

The one and only use for the field Format property is to be a default for
controls bound to it... I'm a bit surprised that it would overwrite a
value already there, but nothing surprised me a lot in Access these days.

a) What happens when you set the format of the control back to "dddd";
what happens if you set the format property of the field to "dddd" and
repeat the binding of the control to it;

b) are you really really sure that the date field is definitely a
DateTime data type (sorry... but if it's already a text field, then a
format property is not going to change it to anything)

c) is there a difference between the behaviour when the control has the
focus and when it's just sitting there unmolested.

d) is there any code in the OnCurrent or OnGotFocus events etc that could
be interfering with its behaviour?

All the best

Tim F
 
Back
Top