How to move to next record that isn't based on key id?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devarts
    New Member
    • Feb 2014
    • 16

    #1

    How to move to next record that isn't based on key id?

    I have a form that operators fill out every time they finish a sample for a particular batch. We do test multiple samples for each batch but the number of samples vary depending on certain criteria.

    In the form, I have placed a sub form of the table that the data in which hold this information so its being directly entered in. The operators are able to put all the samples connected to that batch right into the sub form. Naturally, when you look at the table all the data is there and the batch number connected to all the samples.

    The problem I am running into is every time I want to cycle through the data, on the form, I need to click as many times as there are samples to get to a different batch number.


    Example:

    Batch Number: 206 has 7 samples
    I need to click back 7 times to see data for btach 205. How can I have form move to the next record based on the batch number?

    By the way, I programmed my own buttons so I use the DoCmd.RunCmd acCmdGoToNextRe cord instead of the default buttons.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    I'll admit I'm a bit lost in your Form, Subform, Table, etc. description to know what data is where. But based on your problem, it seems the simplest setup would be to have a main form with your batch info on it and then have your subform have the samples data. If your subform is linked (master/child) to the main form, then every time you change the batch in the main form, then subform data will refresh to the samples for the new batch.

    Comment

    • jimatqsi
      Moderator Top Contributor
      • Oct 2006
      • 1293

      #3
      devarts,
      Be aware that you can use parameter values acLast, acFirst,acNewRe c instead of acCmdGoToNextRe cord. You don't have to step through one at a time.

      But also you can put a button on the main form instead of the sub-form in order to change batches instead of changing samples within a batch.

      Jim

      Comment

      • devarts
        New Member
        • Feb 2014
        • 16

        #4
        I've attached a database that only concerns the issue at hand. I hope this might clear up a few thing. If you hit the previous button you'll see what I am talking about.

        Dylan
        Attached Files

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          As a rule of thumb, we do not download attachments from people we don't know. It's better if you describe the question as clearly as possible and post any code or error messages you may be getting.

          From your first post, it sounds like you don't have a batch table with a listing of distinct batches. That's what you want for the parent form, a listing of distinct batches. If you don't have such a table, you should probably create one for normalization's sake. But if you can't do that, you should at least change the parent form's record source to return just the unique batch ids.

          Comment

          • devarts
            New Member
            • Feb 2014
            • 16

            #6
            I apologize; I didn't know. And I can't have a table of batch numbers because we receive the batch numbers from our supplier, so it could be any number.

            But I'll take a look at the sub form and see what I can do.

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #7
              You receive the batch numbers. That doesn't mean you can't enter the distinct numbers into a table. It also doesn't mean you can't change the record source of the parent table to return the unique batch ids.

              Who sends you the data and how they sent it shouldn't affect your ability to store it differently or interact with it differently than how it was sent to you.

              Comment

              • twinnyfo
                Recognized Expert Moderator Specialist
                • Nov 2011
                • 3665

                #8
                devarts,

                I htink you need abutton on your main form that cycles through batch numbers, then filters the subform based on that batch number, listing samples 1-x.

                I did not download your DB, but this is relatively simple to set up. Your main form would house data for the Batch Number and the subformhas the sample info, also with the Batch number. Establish the Master/Child link field to Batch number and all should be well...

                Hope this hepps.

                Comment

                Working...