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

Auto populate date field

Status
Not open for further replies.

Livebait

Technical User
Jul 8, 2005
4
US
When my operators turn in their paper work in on Monday mornings, I need for the date field to be automatically filled with all missing dates up to the current date. Example; When the secretary opens the form Monday morning it needs to fill in Friday, June 16, 2006 through Monday, June 19, 2006. I've looked at several different threads but I'm still new to understanding code and haven't found anything I could make work.

Date
Friday, June 16, 2006
Saturday, June 17, 2006
Sunday, June 18, 2006
Monday, June 19, 2006

 
This sounds like you want to have 4 new records added to a form when it is opened on Monday morning. Is that right? What do you want to happen on Tuesday morning? Why do you want Friday's date filled in. Are you closed on Friday? Do you always want all dates filled in that are not already in the table?

Plus, a little more info about the application would be a big help too.

Thanks
 
What data feeds the form (Record Source)? Is the data in a table? Or is the form an input form to be filled in by secretary, and you want auto-entry of dates for each separate day?
Jeff
 
How are ya livebait . . .

Have a look at the [blue]DateAdd[/blue] function . . .

Calvin.gif
See Ya! . . . . . .
 
VicRauch
Yes when these will be new records. If it is a Tuesday morning then only Tuesday needs to be added unless the secretary was not able to enter the data due to being off sick, vacation, etc.. Friday’s paperwork is not completed until after midnight. I've been unable to convenece my secretary to hang around that long lol. Yes I need all missing dates filled in that are missing. There is never a day we do not have data to enter.

jjlogan
This is a data entry form for a table. The date field is the primary key. The table is set to no duplicates for this field.
 
Have you considered a Listbox with recent dates? When the form is initialized or opened, there could be Sub procedure that loads the listbox with today's data and last 5 or 10 day's dates. Then secretary could just select the date for each record. Listbox might be two columns showing date and day-of-week. Second Sub procedure attached to the form would load the date from the listbox selection to the date field on the form.
Jeff
 
Do you complete one day's entries before starting the next day's entries? If so, your form could always just open with the oldest, not completed date showing. Then, when that date is finished, a button could be pressed to "start" the next day's entries.

If you can work on any day's entries at a time, then I would suggest a routine in the OnOpen event that would add a record to your table for every day without an entry in the table. Then set a filter to only show those dates. If you need to be able to get at other dates than the missing ones, be sure to provide a button to remove the filter from the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top