Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Mar 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Outer Loop Not Working (Access 2000)

    (Long code fragment moved to attachment by HansV; corrected inconsistent indenting.)

    Hello. I'm a newbie to this lounge and really, really need help in my Access VBA code.

    I'm creating a function that will take a start date and increment the associated labor hours through valid shift hours. Right now my code is working in that I can decrement the first record of 35 labor hours down to 0, but I can't make my code move to the next production number. I'm guessing that my outer loop of varI is incorrect and I need to tell it to do the calculation of beginning labor hours to 0 for each production number. Any suggestions?
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Outer Loop Not Working (Access 2000)

    There is no <font face="Georgia">rs.MoveNext</font face=georgia> before the final Loop, so rs will never move to another record.

    (BTW, I don't understand<pre>For varI = 0 To varI - 1</pre>

    You don't assign <font face="Georgia">varI</font face=georgia> a value before this loop.)

  3. #3
    New Lounger
    Join Date
    Mar 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outer Loop Not Working (Access 2000)

    Please don't include such long code fragments in the body of the post. Place them in an attachment instead. As an added bonus, indentation will be preserved - HansV

    Hi Hans,
    WOW! That was a fast reply. Yes, I agree. The varI didn't make sense, so I've modified the code as follows. Hi Hans,
    I've modified the code as follows:

    I've created a function that calculates the labor hours per production record (for example Prod_no 2000 has 35 labor hours. The start date is 3/3/04. I want to take the 35 labor hours and add them to the start date to find out what date the next production item can be put on the production line.

    I've successfully isolated the next production start date and sent it to a production table. But I can't figure out how to make the new production date look at the next record and go through the loop again and so on. It only calculates the first record.

    Any suggestions are greatly appreciated.
    Attached Files Attached Files

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Outer Loop Not Working (Access 2000)

    Sorry, I'm not able to fathom what the code does, and why.

  5. #5
    New Lounger
    Join Date
    Mar 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Outer Loop Not Working (Access 2000)

    I appreciate your help, Hans. I'm experimenting with the inner loop. I know that's where the problem lies.

    Kind regards,
    Dawn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •