By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,838 Members | 2,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,838 IT Pros & Developers. It's quick & easy.

Auto Calculate Calendar

P: 1
I'm creating an Access Database 2003 for our Human Resource Dept. In the form, I will be adding a calendar wherein there will be date of hire, start date, etc. I need to be able to view the calendar to pick the date and I also need to auto calculate days. For example: if I start on 10/1/07, I need it to auto calculate on my next field +30, my next field will be +45 and my next field would be +90. What language do I use to do this and how do I get the calendar to appear so that I can choose a date for each field?
Oct 26 '07 #1
Share this Question
Share on Google+
2 Replies


beacon
100+
P: 579
I'm creating an Access Database 2003 for our Human Resource Dept. In the form, I will be adding a calendar wherein there will be date of hire, start date, etc. I need to be able to view the calendar to pick the date and I also need to auto calculate days. For example: if I start on 10/1/07, I need it to auto calculate on my next field +30, my next field will be +45 and my next field would be +90. What language do I use to do this and how do I get the calendar to appear so that I can choose a date for each field?
You need to use some VBA code. Are you familiar with this?
Oct 26 '07 #2

missinglinq
Expert 2.5K+
P: 3,532
Place a calendar on your form and set its Visible Property to No. Then use this code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   Me.YourCalendarName = Date
  3. End Sub
  4.  
  5. Private Sub YourCalendarName_Click()
  6.    Me.OriginalDateTextBox = YourCalendarName
  7.    Me.Date2 = DateAdd("d", 30, YourCalendarName)
  8.    Me.Date3 = DateAdd("d", 45, YourCalendarName)
  9.    Me.Date4 = DateAdd("d", 90, YourCalendarName)
  10.    OriginalDateTextBox.SetFocus
  11.    YourCalendarName.Visible = False
  12. End Sub
  13.  
  14. Private Sub OriginalDateTextBox_DblClick(Cancel As Integer)
  15.   YourCalendarName.Visible = True
  16. End Sub
  17.  
When the user Double Clicks on the text box that will hold the original date, the calendar pops up. Once a date is chosen, the calendar disappears and all fields are filled in.

Welcome to TheScripts!

Linq ;0)>
Oct 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.