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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default value depending on another field

Status
Not open for further replies.

lunarmono

Technical User
Jan 15, 2003
15
0
0
PE
Hi there,
I am interested in making one field of a table depend on another field. Specifically, I have a date in one field, and would like another field to automatically contain this date's day of week. So if you type in the date, for example, "8/1/2003", the day of week field would automatically contain "Friday". Is this possible? Thank you kindly...
-Andy
 
MyDate = Date taken from a field called Date_From and displays the Day

try the code below but change the field names to siut your fields

MyDate = Me!Date_From
Me!MyDay = Format(MyDate, "dddd, ")

Hope this helps
Hymn
 
I apologize but I am very green at this. Where exactly would I type this code in so that it would affect this change?
Thanks,
Andy
 
in the On Enter event of the field that you want the DayofTheWeek in

Hope this helps
Hymn
 
I know how to find the on enter for boxes in form design but in datasheet design I cannot locate any on enter
I tried the code, and just the "Format()" part in the Default Value box for my day of week but that didn't work. Thanks for the help
Andy

ps I also realized that if I put it in long date format, then access automatically calculates the day of the week and includes that with the date. This might work for my purposes
 
Go to design view of your datasheet form go to the field that you want the day to be in rightclick on that field go into properties click the tab for Event go down about six events and there is one called On Enter on the little button with 3 dots click on that high code builder click OK and then place the code in there
Remember you have to enter the field before any thing will happen

Hope this helps
Hymn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top