Results 1 to 3 of 3
  1. #1
    mfmuc is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Location
    Germany
    Posts
    3

    query to update a counter field

    Hi,
    I need a MS Access query to update a counter. The counter should start with value 1.
    When 2 fields are changing then the counter should start again with 1.
    Example:
    Customer Invoicing_mounth: Counter
    4711 10/2017 1
    4711 10/2017 2
    4711 10/2017 3
    4755 10/2017 1
    4755 10/2017 2
    4755 11/2017 1




    Can someone please help me. Thank you - Martin

  2. #2
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    I use something like this to set the sequence of an Estimate Number.

    Me.sequence = Nz(DMax("[Sequence]", "job", "Year([received Date]) = " & Year(Date)), 0) + 1
    Me.JOBID = "E" & Format(Now(), "yy") & "-" & Format([sequence], "000")

    For your application, your invoice number would be equal to my "year" I believe.

    HTH.

  3. #3
    Join Date
    Apr 2017
    Posts
    1,792
    Why bother with counter - simply calculate the number of transactions for same Client? and month. It will be same for all group, but anyway you never can say that 4711 10/2017 1 was earlier than 4711 10/2017 3 (unless you calculate this counter based on some other info in original tables like transaction date or autonumeric ID), because position of row in table has no real meaning in relational databases (the only exception I'm aware of is FoxPro).

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

Similar Threads

  1. Need counter field on subform
    By GregShah in forum Forms
    Replies: 2
    Last Post: 09-05-2017, 12:57 PM
  2. Replies: 27
    Last Post: 12-02-2015, 06:09 PM
  3. Replies: 12
    Last Post: 11-21-2014, 01:21 PM
  4. Field counter
    By gmaster in forum Programming
    Replies: 2
    Last Post: 10-17-2014, 05:34 AM
  5. Update Query with a counter
    By hockeyman9474 in forum Programming
    Replies: 16
    Last Post: 07-15-2014, 10:48 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