Results 1 to 10 of 10
  1. #1
    Hursan is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    23

    How do I retain the value that is entered into a text box from record to record?


    I have a form that will have about 48 records entered at a time all needing the same batch number. All the other data will need to change, but I would like to be able to retain that batch number from record to record until it reaches record 48. I'm assuming I'll need some code. Any help would be greatly appreciated. Thanks in advance!!

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    A lot depends on how your tables are set up and what your actual process is. Will it always be 48 records or can it be more or less? Are batch numbers consecutive?
    We'll probably need more info.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I would suggest a form\subform set up where you enter the batch number in the form and use the master\child linking to auto-populate it in the subform; you could have code in the current event of the subform to check if the record is new and count the already existing ones using a dCount()....
    If you supply more info as suggested you should get more pertinent answers

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,557
    Hi

    I agree with Vlad

    Main form to enter a batch number
    Subform to enter related information
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  5. #5
    Hursan is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    23
    Let me start again with a different scenario. I have a form that is used to collect the items requested. Every time the Collected button is pressed a query updates the table with the values found on on the text boxes CollectionBin and CollectionBinLocation, right now the CollectionBinLocation has to be manually changed to 1, 2, 3, 4, 5 etc up to 112 ... every time the Collected button is pressed. When the number on the CollectionBin text box is changed we start updating the numbers on the CollectionBinLocaion all over again 1, 2, 3, 4 etc every time we press the Collected Button. i want the CollectionBinLocation to be updated automatically every time the Collected button is pressed, but when the value on the CollectionBin is updated I want access to restart the counter 1,2, 3, 4, 5, etc...Click image for larger version. 

Name:	CollectionForm.png 
Views:	20 
Size:	17.1 KB 
ID:	48507Click image for larger version. 

Name:	CollectionQuery.png 
Views:	20 
Size:	14.7 KB 
ID:	48508

  6. #6
    Hursan is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    23
    Let me start again with a different scenario. I have a form that is used to collect the items requested. Every time the Collected button is pressed a query updates the table with the values found on on the text boxes CollectionBin and CollectionBinLocation, right now the CollectionBinLocation has to be manually changed to 1, 2, 3, 4, 5 etc up to 112 ... every time the Collected button is pressed. When the number on the CollectionBin text box is changed we start updating the numbers on the CollectionBinLocaion all over again 1, 2, 3, 4 etc every time we press the Collected Button. i want the CollectionBinLocation to be updated automatically every time the Collected button is pressed, but when the value on the CollectionBin is updated I want access to restart the counter 1,2, 3, 4, 5, etc...

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    What do you mean by 'updates the table' - new record is created?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    This form will do what you ask, but how you would integrate it with your DB is perhaps problematic. If you upload a copy of your DB it would be possible to give a more useful response.

    Hursan-davegri-v01.zip

    Click image for larger version. 

Name:	bin.png 
Views:	20 
Size:	8.7 KB 
ID:	48510

  9. #9
    Hursan is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    23
    Quote Originally Posted by davegri View Post
    This form will do what you ask, but how you would integrate it with your DB is perhaps problematic. If you upload a copy of your DB it would be possible to give a more useful response.

    Hursan-davegri-v01.zip

    Click image for larger version. 

Name:	bin.png 
Views:	20 
Size:	8.7 KB 
ID:	48510

    Thank you, the code on your forms works like I wanted it. thank you all for your help!

  10. #10
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Glad I could help and thanks for the Star!

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

Similar Threads

  1. Retain Selected Inputs on New Record
    By Torinjr in forum Forms
    Replies: 10
    Last Post: 05-17-2018, 06:37 PM
  2. Replies: 1
    Last Post: 08-06-2016, 10:39 AM
  3. Replies: 9
    Last Post: 03-15-2015, 10:37 PM
  4. Replies: 2
    Last Post: 03-06-2015, 01:13 PM
  5. Replies: 2
    Last Post: 09-24-2014, 05:19 PM

Tags for this Thread

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