Running a Code multiple times

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
 
S

Sean Timmons

Wrap:

For i = 1 to qtyfield

Next i

around your code below.

i is a standard integer variable.
 
K

kolsby

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top