Auto fill day after date is entered?

  • Thread starter Thread starter Logo
  • Start date Start date
L

Logo

Can this be done? I want to enter a date on a form and have the proper day
appear in the next box after it. Should I create a calendertable?
Suggestions? TIA
 
Can this be done? I want to enter a date on a form and have the proper day
appear in the next box after it. Should I create a calendertable?
Suggestions? TIA

The day, as in Monday or Tuesday? You don't even need a separate textbox
(though you can have one if you wish); if you set the Format property of a
textbox on a form to "Long Date" or to a custom date format which displays the
day name (for instance "mm/dd/yyyy dddd") and type a date, in any format,
you'll see the day name. E.g. typing

3/22

into a textbox with the custom format will accept the date and display

03/22/2010 Monday

If you're trying to STORE the day name in a separate field from the date...
don't!!! It's redundant, unnecessary, and almost surely useless.
 
John W. Vinson said:
The day, as in Monday or Tuesday? You don't even need a separate textbox
(though you can have one if you wish); if you set the Format property of a
textbox on a form to "Long Date" or to a custom date format which displays the
day name (for instance "mm/dd/yyyy dddd") and type a date, in any format,
you'll see the day name. E.g. typing

3/22

into a textbox with the custom format will accept the date and display

03/22/2010 Monday

Awesome! But I do need to have the day pop up in the next textbox. I tried
to use the Format property to extract it after setting the control source to
the textbox before it but was unable to get it to only show the day. How do
I do that?
If you're trying to STORE the day name in a separate field from the date...
don't!!! It's redundant, unnecessary, and almost surely useless.

I agree it's redundant, but hardly useless! It enables my users to see if
they are entering data with the correct date. If the day pops up wrong, they
know their date is off. As it is now, when they enter the date then enter
the day, they may have the day correct but the date wrong. This will enable
them to instantly see if they have the correct date.

Thank you very much! This has been a huge issue with us for a long time!

Logo
 
Awesome! But I do need to have the day pop up in the next textbox. I tried
to use the Format property to extract it after setting the control source to
the textbox before it but was unable to get it to only show the day. How do
I do that?

Why in *THE NEXT TEXTBOX* rather than in *THE VERY SAME TEXTBOX*?

You clearly did not try my suggestion, because *it will work*.

Again: open the form in design view. Select the textbox. Find the Format
property. In the Format property type

"dddd dd/mm/yyyy"

If the user types 3/22 into the textbox on the form and tabs out of it, the
textbox will change its appearance and will now show

Monday 03/22/2010

This does not need any code; it does not need the Format() VBA function; it
does not need a second textbox; and it *does* enable them to instantly see if
they have the correct date.

Perhaps you could explain why you find this solution unacceptable.
 
Again: open the form in design view. Select the textbox. Find the Format
property. In the Format property type

"dddd dd/mm/yyyy"

sorry, should have been

dddd mm/dd/yyyy
 
Why in *THE NEXT TEXTBOX* rather than in *THE VERY SAME TEXTBOX*?

You clearly did not try my suggestion, because *it will work*.

I absolutely tried your suggestion! It worked great!
So what do I do with the day field now? I didn't design this database, but I
am looking for ways to make it better.

I guess just delete the day field?
Again: open the form in design view. Select the textbox. Find the Format
property. In the Format property type

"dddd dd/mm/yyyy"

If the user types 3/22 into the textbox on the form and tabs out of it, the
textbox will change its appearance and will now show

Monday 03/22/2010

This does not need any code; it does not need the Format() VBA function; it
does not need a second textbox; and it *does* enable them to instantly see if
they have the correct date.

Perhaps you could explain why you find this solution unacceptable.

Thank you for your answer, it is well appreciated and very acceptable. But
perhaps a suggestion of what I should do now with my day column might have
been a better response than repeating your last reply. I apologize for my
ignorance, I am still extremely new at this.

Logo
 
I absolutely tried your suggestion! It worked great!
So what do I do with the day field now? I didn't design this database, but I
am looking for ways to make it better.

I guess just delete the day field?

If there is a day field *in your table*, then yes, delete it; it's redundant.
If you have a Date/Time field in the table, that field contains the
information needed to display the name of the day.

If you had both fields in the table, then you could get anomalies such as
#3/22/2010# stored in the date field, and Thursday stored in the
day-of-the-week field: one or the other has to be wrong, and there's no easy
way to tell which!
 
John W. Vinson said:
If there is a day field *in your table*, then yes, delete it; it's redundant.
If you have a Date/Time field in the table, that field contains the
information needed to display the name of the day.

If you had both fields in the table, then you could get anomalies such as
#3/22/2010# stored in the date field, and Thursday stored in the
day-of-the-week field: one or the other has to be wrong, and there's no easy
way to tell which!
--

And that has been my dilemma all along! Thank you so much for solving this!

Now, is there a way to display 3/22/2010 Tuesday instead of Tuesday 3/22/2010?

Thanks again!

Logo
 
And that has been my dilemma all along! Thank you so much for solving this!

Now, is there a way to display 3/22/2010 Tuesday instead of Tuesday 3/22/2010?

Of course:

mm/dd/yyyy dddd

You'll need to dig some, but the Access Help topic for Format has all this.
You can construct a date format out of pieces - "d" is the day of the month
(e.g. 3), "dd" is the two-digit day (03), "ddd" the three-letter day
abbreviation (Tue), "dddd" the full day name (Tuesday), "yy" is the two-digit
year (10), "yyyy" the four digit year (2010), and so on and so on.
 
Back
Top