How do you suspend code from continuing

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have this code:
Private Sub Command35_Click()
Dim mfilter As String
Dim ctl As Control
Dim varItm As Variant, intI As Integer
Dim frm As Form
Dim txtTemp2 As String
Dim stDocName2 As String
stDocName2 = "frmDefQuestions"

Set frm = Forms!frmPickDeficiency
Set ctl = frm!lstDef
For Each varItm In ctl.ItemsSelected
txtTemp2 = txtTemp2 & ctl.Column(1, varItm) & ", "

Me.HiddenTextBoxName = txtTemp2
Me.HiddenTextBoxName = Left(Me.HiddenTextBoxName,
Len(Me.HiddenTextBoxName) - 2)
If Me.lstDef.Column(3) = "yes" Then

mfilter = "DefID = " & ctl.Column(0, varItm)
MsgBox mfilter
'Forms!frmPickDeficiency!DeficientItemNum = Me.lstDef.Column(0)
DoCmd.OpenForm stDocName2, acNormal, , mfilter
'Forms!frmHoistTrolleyInspectData!RecID =
Forms!frmDefQuestions!subDefAnswer!RecID


If CurrentProject.AllForms("frmDefQuestions").IsLoaded = False
Then
'Form is closed
GoTo 100
Else
'form is open
End If

End If
100 Next varItm


I want to be able to suspend this code from going to Next Varitm until the
form "frmDefQuestions" is closed.

This code is obviously not working for me the way I want. I works but it
doesn't look like it's executing the if stmt for Currentproject.AllForms.

I only want to go get the next item in what was selected in the listbox
after I've filled out the form I opened called frmDefQuestions.

Any ideas...I'm sure someone has done this before...I'm stumped.
.



Relevant Pages

  • Re: Multi-Select List Box
    ... Dim frm As Form, ctl As Control ... Dim varItm As Variant ...
    (microsoft.public.access.forms)
  • Re: Multi Select List box
    ... Dim frm As Form ... Dim ctl As Control ... Dim varItm As Variant ...
    (microsoft.public.access.modulesdaovba)
  • Re: Code Help
    ... db nothing, strSql nothing, VarItem Emptly. ... Dim db As DAO.Database ... Dim varItm As Variant ... Set rst = db ...
    (microsoft.public.access.formscoding)
  • Re: Code Help
    ... Doug Steele, Microsoft Access MVP ... Dim db As DAO.Database ... Dim varItm As Variant ... Set rst = db ...
    (microsoft.public.access.formscoding)
  • retrieve
    ... Dim ctl As Control ... Dim frm ... Dim varItm As Variant ... Set frm = Forms!form1 ...
    (microsoft.public.access.formscoding)