Solved

DateAdd Function

Posted on 2014-02-22
3
407 Views
Last Modified: 2014-02-22
Experts,
I am using the Date Add function to add hours to calculate an end time based on the start time entered on a form. I have hard coded a number (default is currently 2) as the increment so the function works, but what I really want to do is give the user an option to select a default increment that would be displayed in a control on a form. Is there any way to do this?
Thanks
This is the code that I am currently using
Private Sub cboMondayStart_AfterUpdate()
Me.cboMondayEnd = DateAdd("h", 2, Me.cboMondayStart)
End Sub

Open in new window

0
Comment
Question by:Harry Batt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39879508
add a textbox "txtIncrement" to your form



Private Sub cboMondayStart_AfterUpdate()

if me.txtIncrement & ""<>"" then

Me.cboMondayEnd = DateAdd("h", me.txtIncrement, Me.cboMondayStart)

else
      msgbox "Enter increment!"
      me.txtIncrement.setFocus
      exit sub

end if


End Sub

or add a listbox/combobox with list of increment that the user can choose from


.
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 39879619
You might want to take a look at my article on command bars ( part 2).  In the attached database.  There is an example of using a shortcut menu to store values.

Sent from iphone
0
 

Author Closing Comment

by:Harry Batt
ID: 39879675
Thank you for your solution. I created a combo box with 1-12 values and it works perfectly. I also like that you set the focus to the cboIncrement control.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question