Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 37
  1. #16
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32

    How would I place this into a query? I apologize, I am fairly new at this. I tried creating a query with two columns. 1. TICKET_NO (from tblDaysRemainingCalculation) 2. the dlookup you provided - SLA_DUE_DATE: DLookUp("[WORK_DATE]","[tblBusinessDayTracker]","[WORK_DATE]=#" & "Date"+DLookUp("[DAYS_REMAINING]","[tblDaysRemainingCalculation]","[TICKET_NO] ='" & [TICKET_NO] & "'") & "#")

  2. #17
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    SELECT [TICKET_NO],[DAYS_REMAINING], dlookup("[WORK_DATE]","[tblBusnessDaysTracker]","[WORK_DATE]=#" & Date +dlookup("[DAYS_REMAINING]","[tblDaysRemainingCalculation]","[TICKET_NO] ='" & [TICHET_NO] &"'") & "#") AS DUE_DATE FROM tblDaysRemainingCalculation;

  3. #18
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    for some reason its not calculating for all the records. It's only calculating when days remaining is a whole number and does not include a decimal. i.e. 5.000 vs 4.531

  4. #19
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    use FiX function to get the days part:

    https://support.office.com/en-us/art...8-7e3153984ff8

    Vlad

  5. #20
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    Now they are all throwing an error.

    SELECT [TICKET_NO],[DAYS_REMAINING], dlookup("[WORK_DATE]","[tblBusnessDaysTracker]","[WORK_DATE]=#" & Date +dlookup("[WHOLE_DAYS_REMAINING]","[tblDaysRemainingCalculation]","[TICKET_NO] ='" & [TICkET_NO] &"'") & "#") AS DUE_DATE FROM tblDaysRemainingCalculation;

    column Whole_days_remaining is built into the query and contains the FIX for Days_remaining

  6. #21
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    here is the sql I am using

    SELECT tblDaysRemainingCalculation.TICKET_NO, Fix([DAYS_REMAINING]) AS WHOLE_DAYS_REMAINING, DLookUp("[WORK_DATE]","[tblBusinessDayTracker]","[WORK_DATE]=#" & Date()+DLookUp("[WHOLE_DAYS_REMAINING]","[tblDaysRemainingCalculation]","[TICKET_NO] ='" & [TICKET_NO] & "'") & "#") AS DUE_DATE
    FROM tblDaysRemainingCalculation;

  7. #22
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Have you tried:

    SELECT tblDaysRemainingCalculation.TICKET_NO, DLookUp("[WORK_DATE]","[tblBusinessDayTracker]","[WORK_DATE]=#" & Date()+FIX(DLookUp("[DAYS_REMAINING]","[tblDaysRemainingCalculation]","[TICKET_NO] ='" & [TICKET_NO] & "'")) & "#") AS DUE_DATE
    FROM tblDaysRemainingCalculation;

    Vlad

  8. #23
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    Okay I think its almost there. The only problem is that if the day falls on the weekend it just comes in blank, whereas I need it to show the next business day

  9. #24
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    I see. I think you need to build a top one query first to get the first business date (basically get the first date >= than the value returned by the dlookup). Can you upload a small Access file with your two tables (just leave a couple sample records in the main one) and I might be able to help you if you get stuck.

    Cheers,
    Vlad

  10. #25
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32

    Database sample

    pw: StmtCorrect
    Attached Files Attached Files
    Last edited by newbiecoder; 05-10-2018 at 07:35 AM.

  11. #26
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Check the updated query and see if it looks OK.

    Cheers,
    Vlad
    Attached Files Attached Files

  12. #27
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    This is amazing! Thank you so much! Question though, if I wanted to incorporate time I would just add the decimal value to the date right? Also, lets say that its Friday around 8PM..if I add .5 to the correct date it would end up changing to Saturday as the due date

  13. #28
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Adding time will add a whole new level of complexity; are you looking to incorporate "regular business hours"? Also, I assume you run a make table or update query to update the days_remaining field, why not use the calculated field in my query so it would give you correct results every time.

  14. #29
    newbiecoder is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    May 2018
    Posts
    32
    Quote Originally Posted by Gicu View Post
    Adding time will add a whole new level of complexity; are you looking to incorporate "regular business hours"? Also, I assume you run a make table or update query to update the days_remaining field, why not use the calculated field in my query so it would give you correct results every time.
    I’m not looking to only stick within working hours, because the teams processing hours vary. I can attach what I am using to calculate the days remaining; that may help.

  15. #30
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Sure, do that and I'll have a look.

    Cheers,
    Vlad

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 06-10-2015, 10:41 AM
  2. Replies: 5
    Last Post: 07-01-2014, 02:28 PM
  3. Replies: 1
    Last Post: 06-10-2014, 02:32 PM
  4. Replies: 8
    Last Post: 10-20-2012, 11:25 AM
  5. Adding 5 days to date function but exclude weekends
    By mulefeathers in forum Queries
    Replies: 1
    Last Post: 04-27-2012, 10:28 AM

Tags for this Thread

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