Results 1 to 2 of 2
  1. #1
    zippy483 is offline Novice
    Windows 7 Access 2003
    Join Date
    Feb 2010
    Posts
    26

    Ensure the form I'm on is last record

    Hi All



    Bit of newb to all this programming, and I'm working with a dB someone else has designed that has landed on my lap.

    Part of the database has a stock control section that at the moment is fairly rudimentary

    I'd like to allow stock to be automatically incremented and decremented when numbers are written either into a parts used form or a parts ordered form. To do this I need to know that the form I'm on is the last record in the dataset and only allow the code I've written to run if the form is the last record. all the forms have an autonumber field.

    How do I determine that the form I'm on is the last form in the dataset from the autonumber field?

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Aahhh, the dreaded inventory problem.

    I've used two ways and not been happy with either. However, I'll suggest that when you enter a new receipt or a new removal, the "afterupdate" event runs a query that determines the new balance and stores it somewhere. I've tried running the sum over all transactions and assuming the beginning inventory is zero, but that leaves me feeling like I've cheated or been cheated.
    For a professional answer, I believe the Northwind database example has an inventory example.
    In other words, looking for the "last" record is an Excel mindset. However, assuming your delivery and withdrawal records have a date, you could run a query and find the last date on those records, pick the last inventory off the "last" record, update it and store the new inventory in the new record.
    Last edited by hertfordkc; 11-23-2011 at 05:14 AM. Reason: incomplete

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

Similar Threads

  1. Replies: 9
    Last Post: 09-16-2011, 03:52 PM
  2. If record does not exist, open add new record form
    By RobertIngles in forum Programming
    Replies: 2
    Last Post: 02-01-2011, 08:47 AM
  3. Duplicate last record to next record in form
    By jdhaldane in forum Forms
    Replies: 4
    Last Post: 12-17-2010, 04:22 PM
  4. Replies: 0
    Last Post: 05-04-2010, 06:39 AM
  5. Replies: 3
    Last Post: 06-27-2009, 03:53 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