Results 1 to 15 of 15
  1. #1
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88

    Limit Amout of Records in DB


    I'm making a collection DB. I would like to send it out to friends for testing and feedback but would like to give them a limit of 10 records (as a test) instead of the entire DB. How do I go about doing that? Thnx.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Code it that way and only send out an accde.

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Or copy your DB and delete all but 10 records to send out. If you have multiple tables with data then it gets complicated. Or copy DB and delete data and add 10 records.

  4. #4
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    but can i make it that will only accept 10 records so they can test it? how do I limit the DB?

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Do not allow New Record if RecordCount >9

  6. #6
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    thanks...where do I put that?

  7. #7
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Odd; usually the more data you allow, the more likely it is that someone will generate an error during a process, plus it gives a more complete picture of how it's going to look - maybe even perform. Is it likely that any tester would devote the effort to produce hundreds of records when they know it's only for testing and the data is likely to be insignificant beyond that? Seems more trouble than it's worth. You could only limit the records if you performed a count of some sort on the table/query that the form is based on (DCount would suffice if the chosen field cannot be Null) before moving to a new record. One could still add records to a table if they're accessible, and work around the limitation. As a user, I'd also be annoyed if you allowed me to start entering a record and when at the end of the process, disallowed it because of some arbitrary count. Thus this should be done on form load also, and don't allow access to the controls when the limit is reached.
    Last edited by Micron; 07-31-2017 at 06:28 PM. Reason: correction & grammar
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    Quote Originally Posted by ortizimo View Post
    thanks...where do I put that?
    the point of a 10 or 20 rec max is so they can see it and test as a preview.

  9. #9
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Would it not be as simple as instructing to just add about x number of records? Usually, it's harder to get people involved as opposed to getting them to agree to do minimal work. It will probably take you longer to code for this limitation than it will take them to input 10 records because you can't impose a limit via table design AFAIK.

  10. #10
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    Quote Originally Posted by Micron View Post
    Would it not be as simple as instructing to just add about x number of records? Usually, it's harder to get people involved as opposed to getting them to agree to do minimal work. It will probably take you longer to code for this limitation than it will take them to input 10 records because you can't impose a limit via table design AFAIK.
    negative...it needs to have a limit on a preview version...then I can release the full one after their input...

  11. #11
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Lest I sort of hijacked this with my questions, have you gleaned how to do this from everything else that was posted on it? If not, I'm saying you can't impose it on a table, so you must know the number of records behind the form and determine this at one or more points. From the point of starting a new record, the best is probably in the form BeforeInsert event, which fires as soon as the user types into a control.
    Code:
    If DCount("SomeField", "SomeTable")>9 Then
      msgBox "You have reached the 10 record limit."
      Cancel = True
    End If
    You could do this in another event such as a button click, but if form controls are bound to the table and you allow the record creation to start, you will also have to delete it because it has already been created.
    The field used to count the records cannot allow Nulls, or you will have to find another way, such as getting the .RecordCount of a table def or the form itself, presuming it hasn't been filtered by a query.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  12. #12
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    Using the code above I devised the correct syntax to get mine to work...thanks.

    Private Sub cmdNew_Click()
    If DCount("Games", "tblGames") > 14 Then
    MsgBox "You have reached the 15 record limit."
    Cancel = True
    Else
    DoCmd.GoToRecord , , acNewRec
    End If
    End Sub

  13. #13
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    And this cancels the record creation for sure? I would have thought this way of coding would neither cancel record creation since you're attempting to do so from a click event (which cannot be canceled) plus it looks like the wrong syntax. If it works then it's a surprise to me.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  14. #14
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,165
    What about simply setting a validation on the ID field of the table in question? EG Validation Rule: Between 1 and 10

    It kind of sounds like your doing this so you can send the DB out to potential customers for evaluation? Like before purchasing?

  15. #15
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Good thought, but if it's possible to delete records, this calculated limit would be reached before the record limit.

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

Similar Threads

  1. Replies: 4
    Last Post: 02-12-2015, 04:17 PM
  2. Limit Detail Records
    By RLTillie in forum Reports
    Replies: 1
    Last Post: 06-20-2013, 02:41 PM
  3. Limit Combo box records
    By BFlat in forum Forms
    Replies: 9
    Last Post: 01-26-2013, 05:48 PM
  4. Counting No of records above the limit.
    By cap.zadi in forum Reports
    Replies: 5
    Last Post: 11-29-2011, 12:51 PM
  5. Limit Records
    By EHittner in forum Forms
    Replies: 1
    Last Post: 05-03-2010, 10:37 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