Results 1 to 6 of 6
  1. #1
    lamore48 is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jan 2018
    Posts
    40

    Limit record entries based on number in field

    Hi All,
    I have a simple database with tool data inputs and outputs for sharpening, I have the initial forms working accepting the data. One of the fields in the database shows how many of each box there are in a set for example: Box number 46001-1, 46001-2, 46001-3, 46001-4. So in the series there are 4 sets of boxes for 46001. I have a [box in] table and I have a [box out] table, also in the table is a field which shows how many boxes are in each series, so in this case the total box field there is the number 4. My question is can I limit data entry based on total box field. In other words I can't have more than 4 boxes of 46001 in the [box in] table at one time? And how would I code to take out entries of the [box in] table as they were entered into the [box out] table?




    Thanks in advance,
    Lenny

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Put the boxes in their own table - box master table holding 46001 and box detail table holding 1 2 3, etc. Then for form entry the box number will be a combobox based on this table. For the box transactions, have it on one table - date in and date out, rather than separating the two bits of information.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Do you need to retain historical sharpening records? If not and you only care about where the box is now, just have an In_Out field in the BoxDetails table.
    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.

  4. #4
    lamore48 is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jan 2018
    Posts
    40
    Historical records

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Then follow aytee's suggestion.

    This sounds like checking a book out of library. Might look at the Microsoft Lending Library database template.
    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.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    My question is can I limit data entry based on total box field. In other words I can't have more than 4 boxes of 46001 in the [box in] table at one time?
    You have this number before the data entry starts? Then in the BeforeUpdate for the form, check the DCount of this field and cancel the update if the expression return value matches the count value:
    DCount("BoxFieldName", "TheTable", "BoxFieldName = " & YourControlNameOnForm)
    Downside is that user would have to move off the record to trigger the event. You could perform the validation no matter which control the user enters if you either put the same code on each control BeforeUpdate, or just a line to call a function that you put the expression in. The downside of that would likely mean that you could not edit existing data, so it would require a work around.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-26-2017, 11:19 PM
  2. Replies: 13
    Last Post: 11-30-2016, 09:59 AM
  3. limit number of hours entries per day
    By shod90 in forum Forms
    Replies: 5
    Last Post: 03-24-2016, 10:54 AM
  4. Limit number of entries into nested subform?
    By shadowbh2 in forum Programming
    Replies: 7
    Last Post: 11-28-2014, 11:03 PM
  5. Replies: 4
    Last Post: 01-23-2014, 04:34 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