RE: How do you suspend code from continuing

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



Open the form as dialog
docmd.OpenForm "FormName",,,,,acDialog

that will suspend the code from continuing

"McDal" wrote:

> 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.
.


Quantcast