473,383 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Create MSAccess text box with due dates and times

8
I am in way over my head. Here’s the scenario: hours of operation are between 7:00 AM and 4:00 PM.
One type of document is to be scanned within 4 hours, another type by 10:00 AM, the 3rd type within 3 business days.
I need to create the SLA (Service Level Agreement due date and time) for each entry, depending on the type.
One problem I am having is the 4 hour docs can run over to the next day. That’s why =IIf(([Hours]=4),DateAdd("h",4,[MAIL_LOG_TIME])) does not work. Service stops at 4:00 PM. Simply adding 4 hours to may take it beyond 4:00 PM. But the remaining time starts the next day at 7:00 AM.
If documents are logged at, for example 2:30 PM. We have 1 ˝ hrs until 4:00 PM, and 2 ˝ remaining hrs starting at 7:00 AM the next day. If today’s [MAIL_LOG_DATE] and [MAIL_LOG_TIME] is 4/25/2019, 2:30 PM, I know the expected SLA is 4/26/2019, 9:30 AM, but how to calculate that, skipping weekends and holidays, And put in all in a Microsoft Access report text box, I have no clue
Also, there are 3 fields in the table [RECORDS_DATA] for each type: [Hours], always 4, [Specific Time], Always same day 10:00 AM, and [Business Days], always 3 business days from [MAIL_LOG_DATE] & [MAIL_LOG_TIME]. Only one of the three fields is applicable to each type.
So, I guess, a huge nested formula is necessary? Something like…
=IIf(([Hours]=4),DateAdd("h",4,[MAIL_LOG_TIME])),IIf(([Specific Time]="10:00:00 AM","10:00:00 AM",))IIf(([Business Days]=3),DateAdd("d",3,([MAIL_LOG_DATE] & " " & [MAIL_LOG_TIME])))
…but how to deal with weekends and holidays, still no clue. Can anybody help?
Apr 25 '19 #1
2 1736
Luuk
1,047 Expert 1GB
You could (of should?) create a function in VBA (see: docs)

Where you now have a long expression ('=IIf(...')
you than can have something like =NeedsScanAt(documentType)

The function can read all those parameters like 'within 4 hours', 'at 10:00 AM' or 'within 3 business days'.

The function should also know about holidays.

A simple example to get you started might look like this:
Expand|Select|Wrap|Line Numbers
  1. Public Function NeedsScanAt(documentType) As Date
  2.     Value = Now
  3.     Select Case documentType
  4.         Case 1
  5.             NeedsScanAt = DateAdd("h", 4, Value)
  6.         Case 2
  7.             If Hour(Value) > 10 Then
  8.                 ' code to update NeedScanAt to tomorrow at 10:00 AM
  9.             Else
  10.                 ' code to update NeedScanAt to today at 10:00 AM
  11.             End If
  12.         Case 3
  13.             NeedsScanAt = DateAdd("d", 3, Value)
  14.         Case Else
  15.             NeedsScanAt = 0
  16.     End Select
  17.  
  18. End Function
The code to update the time is left out as an exercise (or, in other words, I am nog wel enough educated in MSAccess to do that properly 😒)

Based on the input parameter the datetime is returned.

If Now=27/04/2019 09:30
NeedsScanAt(1) should return : 27-4-2019 13:30:00
NeedsScanAt(2) should return : 27-4-2019 10:00:00
NeedsScanAt(3) should return : 30-4-2019 09:30:00

I hope you do see the power which you can have, when creating a VBA-function for this kind of things.
Apr 27 '19 #2
R1RAY
8
Thanks, Luuk. This helps but I still have a ways to go to figure this one out.

Thanks again,
-ray
Apr 29 '19 #3

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

Similar topics

0
by: PaulR | last post by:
Hi, Is anybody able to create a Text Index with Control Centre V8.2 and NSE V8.2 (SLES 8.0)? I get the following error SQL22212N A DB2 Administration Server communication error has been...
0
by: CSharpguy | last post by:
I have a web form that has 22 text boxes on it were the user can enter in data, then click a button that needs to create a text file. I can create the text file fine, but how can I create a text...
1
by: Don G | last post by:
Each entry in a data file includes date and time in text format - e.g. "0601271325" = 2006, January 27th, 1:25 pm. Is there a simple way to calculate the hours (including decimal parts) between...
1
by: alto | last post by:
hi..guys.how to create a text using string in notepad in c# in the loop
11
by: dhirajpriya | last post by:
hi everyone when i create single text box on page and press enter the page refresh how can i stop to refresh the page.... dhiraj
1
by: jaay | last post by:
Hi, I would like to create a Web Services that will create a text file. I'm using ASP.NET Anyone please guide me how to write a (asmx file) in order to let it creates a text file and writes...
0
by: UvT | last post by:
Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); Now this creates...
2
by: shireen Eason | last post by:
How to create a text output file from access database?
4
by: mricketson | last post by:
Create a Text Box/List Box combination like the one in Windows Help. As you type in the Text portion of the Text Box, the List Box will scroll to whatever has been typed so far.
3
by: kttr | last post by:
My eventual goal is to create a text editor ina website, like google docs, or this text editor right here: http://writer.bighugelabs.com/# My question, then, is this: what are the general steps...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.