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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop code when a form opens 1

Status
Not open for further replies.
Mar 27, 2002
168
NL
I have the follow code
For Each varpositie In cboArtikels.ItemsSelected
tempArtikelNaam = cboArtikels.Column(2, varpositie)
tempEenheid = cboArtikels.Column(4, varpositie)
tempArtID = cboArtikels.Column(0, varpositie)
DoCmd.OpenForm "frmPrijsAantal"
strSQL = <....?
docmd.runsql strSQL
Next varpositie

My idea was to run through a few records and make insert Queries based on info in the form frmPrijsAantal. Is there a way to 'stop' the code after open the form and fill 2 fields on the form and run the SQLcommand and that several times?
Now the code is under a click-event, maybe choose another way or something?
hope somebody can help me,

Gerard
 
I'm not szure what you're trying to do, but

Exit Sub

will stop the code --------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
The code only has to stop until the form is filled, then for loop has to go again, so stop with exit sub is no option while that stop the code at all, I'm seeking for a kind of pause.

so
for each blub in blub.com
docmd.openform <blaat>
'fillin fields in form, a kind of pause in code
docmd.runsql strSQL
next blub

now the code runs through al the records and do nothing than open the forms and give a error on the SQL ;)
 
The way I see it the code does not have to stop, it has to start when sudden creterias are meet.
So figure out where this code shold be triggered and I think your problem would be solved.

Herman
 
DoCmd.OpenForm &quot;frmPrijsAantal&quot;,,,,,acDialog opens your new form frmPrijsAantal as a dialog box. This pauses the calling code until your called form frmPrijsAantal is closed or hidden.

Good Luck!
Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need![thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top