Results 1 to 11 of 11
  1. #1
    JavaBeans's Avatar
    JavaBeans is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    11

    Total Noobie here... question about auto numbering

    Good Morning all

    I have an access database that's published to sharePoint services. The database contains one table. We used Microsoft's 'Assets Database' Template to initially set it up. I've changed quite a bit around in the template to make it fit our needs, and things seem to be coming along just fine for the most part. But like my post states.... TOTAL NOOBIE to Access.

    My question is:
    We used auto numbering for each record, the auto number is the first field in the database ( I believe this is my primary key as well). when a user deletes a record - say record 4 for example - the database does not renumber the records it just shows the records in order as 1, 2, 3, .. , 5, 6, etc... skipping number 4. So this puts my users in a position where they have no idea how many actual records are in the database. Is there a way to have access re-number the records? I assumed when I setup auto numbering for column 1 that it would do this.

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Renumbering primary key not a good idea if there are related child records. Why do users need to know how many records? Why do users delete records? Record deletion should be rare and have strong justification. Can use Count(*) function as textbox ControlSource to return record count.
    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
    JavaBeans's Avatar
    JavaBeans is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    11
    They've deleted records that are duplicates as they come across them - since this database is new there have been several dups that users have came across. In the future deleting records shouldn't be an issue, but as of now, like i said, they are mainly deleting duplicates.

    They need to know how many records are in each state.. we have two tabs. One is records that are currently being worked the other tab is records that have been completed. I will soon be adding another tab for records that are in a different status. So, the users need to report to their manager how many records that need to be worked and how many records have been completed. And when I add the other tab they will need to report how many records are in that status.

    As of now, I have it where a user ticks a check box in a column labeled 'done'. When that box is checked it moves it to the completed tab. So when this happens it also messes up the numbering scheme.

    I'll look into the Count function for this. Can you steer me in the right was as to how to go about using the count function.

    Also, is it a good idea to have one table for what I explained above - the three tabs for the different record status'. or would best practice be to have a table for each status.... like when they click the checkbox in the done column it moves it to a different table rather than using a function to display the different data for each tab.

    I appreciate your help!

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    You could have a table for Status.

    Id autonumber
    StatusName text

    Then in your other Table where the records are, you could add a field, "recStatus" that would contain the Id of the appropriate status from the Status table.

    To determine How Many records were in each Status you'd run a query

    Select refStatus, Count(*) from myTable
    Group By RefStatus

    or
    Select StatusName, Count(*)
    From Status, MyTable
    Where Statusid = MyTable.refstatus
    group by StatusName

    see http://www.techonthenet.com/sql/group_by.php


    As for the autonumber, if the number involved has meaning for you, you have probably misused the autonumber.
    Autonumbers are considered for system use. They are meant to be unique, not necessarily sequential. They are used primarily to uniquely identify each record in a table.

  5. #5
    JavaBeans's Avatar
    JavaBeans is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    11
    I added the new table 'Status' and created three records for the three status' I need... working, completed, and rescinded.
    When I to to create the record recStatus in my data table, I'm not sure what type of column I need to create.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    recStatus would be number datatype integer

    You will join the Status table and the data table on

    recStatus = Status.Id

    something like

    Select StatusName, Count(MyTable.*)
    From Status INNER JOIN MyTable
    ON Statusid = MyTable.refstatus
    group by StatusName

  7. #7
    JavaBeans's Avatar
    JavaBeans is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    11
    What your saying makes sense, but I'm not sure how to apply this to my DB. This DB was initially setup.... well partially setup... by my IT director using the Microsoft 'Assets Web Database' Template.

    The way information is pulled from the data table to the form MAIN, flows like this:

    Main (form) Recon Tab -> AssetsCurrent (form) -> AssetsDS (form) -> AssetsOpen (Query)

    Main (form) Recorded Tab -> AssetsRetired (form) -> AssetsRetiredDS (form) -> AssetsRetired (Query)



    When I am in layout view on the form I right click on a tab and choose Properties and can see under the Data tab in the pop-up that the 'Navigation Target' points to each of these forms.


    I'm wondering if I should take the tabs on the form MAIN and point them directly to the queries. There are three queries, AssetsExtended, AssetsOpen, and AssetsRetired.
    The Reconveyance tab on my form MAIN shows the data from the AssetsOpen Query and the Recorded tab from the form MAIN shows data from the AssetsRetired Query. But the flow of how this data gets from the query to the actual tabs is shown above.

    The query AssetsOpen simply shows data that does not have the 'Done' Checkbox ticked. And the AssetsRetired query shows data that does have the 'Done' checkbox ticked.

    Sorry, if i'm being confusing, this is all VERY new to me.

    I attached the database if you want to have a quick look to see what I'm working with.

    Thanks, I appreciate you help!
    Attached Files Attached Files

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  9. #9
    JavaBeans's Avatar
    JavaBeans is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    11
    Damn look at that!

    Click image for larger version. 

Name:	damn.JPG 
Views:	10 
Size:	32.4 KB 
ID:	7355

  10. #10
    JavaBeans's Avatar
    JavaBeans is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    11
    Thanks for your help. I think I am starting to get a pretty good grasp on this. I very much appreciate your help and letting me bounce idea's off of ya. The code for getting a count of the number of records and the idea about creating a new table has helped tremendously.

    I'm redesigning the db now, if you don't mind I may bounce an idea or two off of you or ask a few questions while I'm doing this.

    Thanks!

    -Brad

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. Trouble recovering database : Auto numbering
    By ArseniusCamillus in forum Access
    Replies: 4
    Last Post: 02-14-2012, 04:56 AM
  2. how to get auto numbering on continuous form records
    By shubhamgandhi in forum Programming
    Replies: 1
    Last Post: 08-04-2011, 02:26 PM
  3. Auto numbering of forms
    By bgeorge12 in forum Forms
    Replies: 5
    Last Post: 06-30-2011, 05:05 PM
  4. Auto updating a total
    By Dreamcatcher in forum Forms
    Replies: 0
    Last Post: 06-19-2009, 02:18 AM
  5. Auto Numbering
    By rkruczk in forum Forms
    Replies: 0
    Last Post: 10-09-2006, 04:25 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