Results 1 to 2 of 2
  1. #1
    Alex Motilal is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2008
    Location
    Coimbatore, India
    Posts
    192

    Auto Number in Query


    Hello Everybody,
    In my sales Data Base, there is a table for payments received Invoice vice. For a particular Invoice, payments are received in different dates. In the payments form, when a Invoice is selected, the Subform displays the payments table of the Invoice selected. What I want to know is that, is it possible to create a field which displays the Serial Numbers in the Ascending Order of the dates of that particular Invoice?
    Eg. For Invoice Number 001, payments received on 09/01/2009, 09/02/2009 & 09/03/2009, the numbers should be 1,2 & 3.
    I request somebody to help.
    Thanks.

  2. #2
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    You can go down two routes

    1. Create the sequential number at point of input and store the number in a field.

    2. use a running sum function that you need to create your self.

    The second option will slow down your system but aleviates the need for an extra field.

    Create function call rSum. See below. Save it in a standard module

    Code:
     
    Function rSum(AnyPK As Long, AnyTable As String, AnyField As String) As Long
        rSum = DCount("*", AnyTable, AnyField & "< " & AnyPK)
    End Function
    Then in your query

    nIndex: rSum([FieldToCount],"QueryorTable","Field")

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

Similar Threads

  1. Query for distinct member number
    By Lauri in forum Queries
    Replies: 1
    Last Post: 08-23-2013, 03:22 AM
  2. Restart auto number after deleting records
    By P5C768 in forum Database Design
    Replies: 1
    Last Post: 09-11-2009, 02:07 PM
  3. Replies: 1
    Last Post: 01-31-2009, 10:43 AM
  4. Need help with an auto number
    By Wrangler in forum Database Design
    Replies: 1
    Last Post: 02-10-2006, 03:21 PM
  5. query for data type number
    By oracle in forum Queries
    Replies: 1
    Last Post: 12-14-2005, 03:35 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