Results 1 to 6 of 6
  1. #1
    alexandervj is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    145

    How can I make a record number column?

    I want to make a calculated column that adds 1 for every new record that isnt marked as being 'deleted' and will possibly subtract one if a record is marked as deleted. I'm not sure where to start other than calculated column

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Can't do that in table with Calculated field.

    You have a field that marks a record as 'deleted'? Is this a yes/no field? Why would a new record be marked as 'deleted'?

    Why don't you do an aggregate (GROUP BY) Totals query to count records when you need to know this info?
    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
    alexandervj is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    145
    Yeah I have a bool that marks a record as deleted and filters it out of normal query results.

    Sorry I meant a new record would add 1 to the row/record number and a deleted would take 1 away, the way I wrote it it sounds like i wanted to delete a new record which would be silly.

    I dont really care too much about the overall number I just wanted an easier handle to identify to users. Its easier for them to distinguish a part on a datasheet that has a numbered row by it. The autonumber for the ID i dont like using on an end user level because if a record gets "deleted" then there will be gaps

  4. #4
    alexandervj is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    145
    plus i never firgured out that problem i was having with canceling out of the new run creation. It still adds a new run id every time you cancel but no run shows up in the runs table as if it had been canceled. I guess its not a big deal, just bugs me. I'm sure users wont be canceling out of new run creations very often anyway

  5. #5
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Here is a query to produce the results you're looking for and you don't create a calculated table to do it. Base your form or report on this query instead.

    SELECT Field1, sum(iif(Field2=True, 0, 1)) AS TotalNotDeleted
    FROM TableName
    GROUP BY Field1

    Assuming Field2 is your yes/no column. Any other columns will also need to be part of your Select and Group By clauses.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    I don't think you ever provided the db for analysis of the cancel action, which I suggested twice.

    Still don't understand need for this sequence number. Users should just be selecting part by some value that has meaning to them - stock number, part number, part description.
    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. Make ID field a random number
    By harrytgs in forum Access
    Replies: 13
    Last Post: 08-08-2012, 02:18 PM
  2. Make column name flexible
    By dani9 in forum Queries
    Replies: 6
    Last Post: 09-29-2011, 01:13 AM
  3. Make auto number
    By sanos_a in forum Access
    Replies: 9
    Last Post: 10-07-2010, 06:14 AM
  4. How to make a Column in Access a DropDown
    By JohnGrove in forum Access
    Replies: 4
    Last Post: 03-10-2009, 07:56 AM
  5. Adding new column to make-table query
    By dtn118 in forum Access
    Replies: 2
    Last Post: 08-03-2008, 06:51 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