Results 1 to 6 of 6
  1. #1
    glasgowlad1999 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    14

    Question Cleanest way to do this criteria

    Hi All,

    I would like your thoughts on how you would write a formual or VBA to handle this date needed.

    I have 3 fields ("tblMedSubmit" Title: T21 or T19, Requested Type: Urgent, Standard, Inpatient or Retro, and Med3Date: a date field )

    I need to show a date based on a criteria:

    For Title T21

    Urgent I need to show + 72 hours
    Standard I need to show + 15 days
    Inpatient I need to show + 24 hours


    Retro I need to show + 30 days

    For Title T19

    Urgent I need to show + 72 hours
    Standard I need to show + 14 days

    With each of these I need to make sure I don't count weekends and holidays (tblHoliday), so if it is due on a Monday we get it to display the Friday date.

    Thanks for your views and hopefully help on this.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    if you want to exclude holidays, you have to use a call to a function. none of the date functions in access exclude weekends and holidays. so the call would be included on one side of the criteria, most likely on the right side of the BETWEEN statement.

    these functions are pretty long too. I've written one myself, and so have others. are you sure there isn't another way you can do it?

  3. #3
    glasgowlad1999 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    14
    Adam,

    Ok lets forgot the weekends and holidays. How do I do the first section?

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by glasgowlad1999 View Post
    Adam,

    Ok lets forgot the weekends and holidays. How do I do the first section?
    define "first section". this does make sense:
    Urgent I need to show + 72 hours
    Standard I need to show + 15 days
    Inpatient I need to show + 24 hours
    Retro I need to show + 30 days
    what does all of that mean? e.g. - return records with criteria of "standard" in one field that have datefields of more than 15 days from now? I have no idea.

  5. #5
    glasgowlad1999 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    14
    Ok I have a drop down that you can pick T19 or T21, and other drop down that have Urgent,Standard, Inpatient and Retro. I have a date field.

    If they select T19, Urgent I need to take the date field and + 72 hours and put it in its own field

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    OK, then all you have to do is issue a couple of nested SELECT CASE statements in code behind an event. either that, or a select case and a small IF inside of each one. inside the conditionals, you will use the built-in date functions. Most of them will be dateadd() I would assume, right? You can find the syntax and criterias for using times and days and other period lengths in the vba help menu under that function.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. using checkbox as iif criteria
    By TheShabz in forum Queries
    Replies: 3
    Last Post: 01-18-2011, 05:10 PM
  2. How to assign criteria for Yes/No?
    By AccessThis in forum Queries
    Replies: 1
    Last Post: 07-20-2010, 03:51 PM
  3. Date Criteria
    By tcollins02 in forum Queries
    Replies: 1
    Last Post: 09-09-2008, 08:27 AM
  4. Query Criteria
    By jena in forum Queries
    Replies: 1
    Last Post: 04-29-2008, 11:00 AM
  5. Criteria Definition
    By claing in forum Access
    Replies: 1
    Last Post: 12-19-2005, 07:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums