Running a Code multiple times

  • Thread starter Thread starter kolsby
  • Start date Start date
K

kolsby

I have a subform that contains an autonumber that will track MAC
addresses for a Base Part Number.
Right now my code looks like this:

With Me.[mac subform].Form.RecordsetClone
.AddNew
!Part = [Forms]![QryMACMain]![PartNo]
!SerialNo = [Forms]![QryMACMain]![SerialNo]
.Update
End With

This adds a new autonumber each time i click on a button. However
there are some part numbers that need 3 and some that need 4 new
autonumbers. In my Part Number table i have a qty field that
represents how many MAC addresses (autonumbers) will be needed when
the button is pushed. How do i add code to the above that will run
this code multiple times based on the qty field?

Any advice?

thanks,
KO
 
Wrap:

For i = 1 to qtyfield

Next i

around your code below.

i is a standard integer variable.
 
Wrap:

For i = 1 to qtyfield

Next i

around your code below.

i is a standard integer variable.



I have a subform that contains an autonumber that will track MAC
addresses for a Base Part Number.
Right now my code looks like this:
With Me.[mac subform].Form.RecordsetClone
        .AddNew
            !Part = [Forms]![QryMACMain]![PartNo]
            !SerialNo = [Forms]![QryMACMain]![SerialNo]
        .Update
    End With
This adds a new autonumber each time i click on a button.  However
there are some part numbers that need 3 and some that need 4 new
autonumbers.  In my Part Number table i have a qty field that
represents how many MAC addresses (autonumbers) will be needed when
the button is pushed.  How do i add code to the above that will run
this code multiple times based on the qty field?
Any advice?
thanks,
KO- Hide quoted text -

- Show quoted text -

What if the Qty field is part of a combo box?
Is it still possible?
 
Back
Top