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

creating a workday calculator on access form

P: 107
I have 3 fields dateout, datein, TurnAroundNumber(number).
I used this code in module:
Expand|Select|Wrap|Line Numbers
  1. Function GetDateOut(dDate As Date, Span As Integer) As Date
  2. Dim j As Integer, i As Integer, dtStart
  3. dtStart = dDate
  4. For j = 1 To Span
  5.     dtStart = dtStart + 1
  6.     Do While Weekday(dtStart) = 1 Or Weekday(dtStart) = 7 
  7.         dtStart = dtStart + 1
  8.         i = i + 1
  9.     Loop
  10. Next
  11. GetDateOut = DateAdd("d", i + Span, dDate)
  12. End Function
in a calculate command button I made the call:
me.[dateout]=getDateOut(me.dateIn, me.TurnAroundNumber)

I notice if the turnaroundnumber textbox is empty I get a null error.
Can I stop that from happening?
and can I place this in a subform and not adversely effect other objects and subforms.
Thank you
Aug 20 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 2.5K+
P: 3,532
Something like this

Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(me.TurnAroundNumber) Then
  2.   me.[dateout]=getDateOut(me.dateIn, me.TurnAroundNumber)
  3. Else
  4.   Msgbox "This Computation Cannot Be Run When Turn Around Number Is Blank!"
  5. End If
Linq ;0)>
Aug 20 '08 #2

P: 107
thank you linc that works great
Aug 20 '08 #3

Expert Mod 15k+
P: 31,661
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

Aug 20 '08 #4

Post your reply

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