Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Repeating Code as many times as end user states in txt box

Status
Not open for further replies.

wz

Programmer
Feb 16, 2001
88
0
0
US
I want to repeat this step (copying current record) as many times as the end user states in a text box on the current form.

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
Me.Quantity.SetFocus ' next field on form

How? do I use loop?
 
Thanks for your suggestion. I ran an SQL statement to append table and it works however I then need to refresh my dataentry form because the record doesn't show up.
 
For n = 20 To 1 Step -1
'execute code here
Next n

to loop you could use For above this would loop 20 times counting down to 1. If you need user input for the amount of loops you could replace the 20 with some like Me.TheNameofYourcontrol to refresh you could use Me.Form.Requery




HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top