Results 1 to 6 of 6
  1. #1
    PricePS is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    3

    Passing values from one form & sequential numbering

    Having not worked in Access for years and, having casual skills at the best, I’ve managed to build several business useful dBs over the years. Presently I am working on a project that has presented me with a problem that has me baffled. I have two forms: fJobHeader based on a query joining tables JobHeader (key JobNo an AutoNumber) and Customers (key an AutoNumber field – CustNo) (the later table is included simply to populate names associated with the Customer No). The second form fJobLines is based on a table JobLines (key is JobNo & LineNo) and is presented in continuous forms format.


    My problem is that I want to start each job line set with line number 1 and add sequential lines thereafter. My intention is to open fJobLines from fJobHeader - if there are no lines associated the first JobLine should be line 1. If there are already JobLines associated a new record would have the JobNo automatically inserted and, the LineNo would be sequential from the last record.
    I can make this all work if there are existing JobLine records but run into issues on making it work on new record sets. Additionally, my solution is not very elegant, using 4 unbound text boxes and programmatically assigning values in a sequence of events. While I can make it work, I don’t have faith that it is the best way to get where I am going and will prove unstable for practical use.

    Any suggestions?...Anyone??

    Thanks,
    Paul

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Generally speaking, this type of thing can be done by adapting the DMax at the bottom here:

    http://www.baldyweb.com/CustomAutonumber.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What is purpose of this LineNo field? A sequential number for each job's line item records could be generated in a report. Textbox on report has a RunningSum property that can accomplish this.

    If you must save the value, sequential number is a common topic in forum. Start with review of: https://www.accessforums.net/access/...ers-15787.html
    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
    PricePS is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    3
    The user needs a way to refer to/ communicate regarding multiple line items associated with a single job when looking at the form. I could use an autonumber field on the table level but a new job having a starting line number of...1024 wouldn't read right. I am not particularly concerned with some of the issues regarding sequencing, even "uniqueness" of the autonumber...just the appearance of a job starting with a line item other than 1. Does this make sense?


    The topics I've seen in the forum don't seem to address the sequential numbering in quite the same set of circumstances I am looking at...then again, being new to the forum I may be missing it.


    Thanks for the response!

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Both links referenced offer code that should be adaptable to your requirements if you want to save the generated line number in table. Otherwise, review http://www.lebans.com/rownumber.htm
    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
    PricePS is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    3
    Thanks! I went through the referenced links and found I more or less am approaching my specific set of issues with similar methodology. So I went through the forms in question and found my real issue was another bit of dazzling manic "wanna be" programer code triggered on On Current - moving it to Before Insert seems to have stabilised the issue. My solution would not work in a multiple user environment but not an issue in this particular case.

    Again thanks for taking the time to help!

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

Similar Threads

  1. Sequential Numbering in a Form
    By Falafa in forum Forms
    Replies: 6
    Last Post: 10-05-2012, 08:20 AM
  2. Replies: 1
    Last Post: 03-24-2010, 08:42 AM
  3. Help with Sequential Numbering
    By orion in forum Programming
    Replies: 3
    Last Post: 07-06-2009, 01:41 PM
  4. Passing data to sequential form fields
    By jeepfamilyva in forum Forms
    Replies: 0
    Last Post: 06-28-2009, 11:04 AM
  5. Replies: 3
    Last Post: 06-02-2009, 09:51 AM

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