Results 1 to 2 of 2
  1. #1
    zero3ree is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Posts
    39

    New to access and need help with query

    I am trying to set up a query to calculate a fee after calculating how many days overdue. I have DateDue and DateReturned and DollarValue . I need to develop a criteria that creates a fine that $1 + days overdue*1% of the Value of the item. On a side not I also would like query to only show overdue dates. Here is my query




    Any help is appreciated

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Let me get it straight you need to calculate the difference between Date due and date returned if date returned is later than date due.

    Then add $1 to the product of 1% of the value of the product and the days over due. If this is what you want then here is the solution:

    in your query add a calculative field type the following code:
    Fee: IIf(DateDiff("d",[DateDue],[DateReturned])<=0,0,1+(DateDiff("d",[DateDue],[DateReturned])*[Value]*1/100))

    I have assumed that if that if it is returned on the return date or before it no fee is to be calculated and thus it remains 0.

    To show the over due days I hope you mean that and not dates make a calculative field with the following code:


    if you dont want to show negative quantity which may occur if returned before due date use the code below.

    IIf(DateDiff("d",[DateDue],[DateReturned])<=0,0,DateDiff("d",[DateDue],[DateReturned]))

    the secode code will show 0 if return date is equal to or earlier that due date.


    if this solves your problem please mark the thread to be solved


    I am attaching a image please refer to it also.

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

Similar Threads

  1. Sql server query to MS access query
    By blazixinfo@yahoo.com in forum Queries
    Replies: 0
    Last Post: 07-07-2009, 08:12 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