Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Date data type

Status
Not open for further replies.

asif79

Programmer
Oct 18, 2002
12
US
Hi all
I have a text field in my form which is linked to a text field in my table. The user has to enter Day in this field. What I want to do is that when a user enters a day, it should be saved as a day of a week and not simply as a string.

I tried using the Date/time data type in the table but it does not allow me to enter only the day. Is there any way I can do this at the table level. If not, how do I format it in VBA

Any help will be highly appreciated.

asif
 
I would store this info as a Byte data type. Then create a combo-box look-up based on a value list with two columns. Set the width of the first column to 0cm, so it's not visible. Then set the source of the value list as follows: 1;Sunday;2;Monday;3;Tuesday;4;Wednesday;5;Thursday;6;Friday;7;Saturday

This way, the user will see a nice drop-down list of days whilst your data will be stored as a single digit. This method has the added benefit of allowing comparison between days using mathematical operators.
[pc2]
 
hi
Thanks for the help.
I really appreciate it.

Asif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top