Results 1 to 6 of 6
  1. #1
    67159 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    SC
    Posts
    8

    Last Business Invoice Date


    I have a query that runs a customer's two accounts invoices. I need to set up the invoice date to automatically pull data only from the last business date. The Date()-1 in the Invoice Date criteria cell works fine except for Monday's. Then it pull the Sunday data which there is none. Any ideas? I don't want to manually have to type in the last business date and I really don't want to run the query on Saturday morning if you know what I mean. Here's a cut away view of my query. Thank you and have a great rest of the day.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    So if Monday then -3, else -1.

    Use Weekday() function and an IIf() expression.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    67159 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    SC
    Posts
    8
    Wow! I just learned to stay online and connected.

    I first ran the query and retrieved the data to make sure I had hits. Then I wrote it as IIF("()vbMonday",-3,-1), but returned no data. What did I do wrong?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    IIf(WeekDay([fieldname])=2, -3, -1)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    67159 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jan 2015
    Location
    SC
    Posts
    8
    Thanks for the layout, June7. I tried it verbatim and a few other ways, but nothing returned the data. It's got to be a field format issue. And I have no control of that. So I copied the query and set the Invoice Date criteria as Date()-1 and named it Monday Override Report. It's cumbersome, but it works. Thank you for the effort. Have a great rest of the day.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Sorry, suppose need to use Date() instead of fieldname:

    Date() - IIf(WeekDay(Date())=2, 3, 1)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-05-2014, 03:44 PM
  2. Replies: 3
    Last Post: 11-19-2012, 05:05 PM
  3. Replies: 1
    Last Post: 10-10-2012, 01:05 PM
  4. Replies: 2
    Last Post: 06-20-2012, 02:21 AM
  5. Vendor ID, Last Update Date, Invoice Details - Query
    By AppsDeveloper in forum Queries
    Replies: 1
    Last Post: 03-14-2012, 04:43 PM

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