Close Pop Up Form

  • Thread starter Thread starter Pamela
  • Start date Start date
P

Pamela

I have a data entry form, frmClaimAssignment, with cboLossType. On the
AfterUpdate event of this combo box, I have code to open frmInterestedParty
as a pop up. On the last field of that form, I have an If function on the
AfterUpdate event to open another form, frmIntParty2, should certain criteria
be met. I would like for the frmInterestedParty to close when the new pop
up, frmIntParty2, opens. When I add a DoCmd.Close function to my current
code to open the form, I get an error "this action can't be carried out while
processing a form event." I've also tried it on the OnLoad event of popup2
but it doesn't seem to work...Any suggestions would be great!!! Thanks!
 
Try making the popup form invisible, then open the new form, then close the
original form:

Me.Visible = False
DoCmd.OpenForm 'rest of arguments here
DoCmd.Close acForm, Me.Name, acSaveNo
 
Perhaps I missed something because I got another error, this time on the
OnLoad event of the new popup form which I had coded:
Private Sub Form_Load()
Me.ClaimID = Me.OpenArgs
End Sub
I'll also provide the code for opening this form:
Private Sub Claim_Party_Exit(Cancel As Integer)
If [Claim Party] = "Claimant" Then
Me.Visible = False
DoCmd.OpenForm "frmInterestedParty2", acNormal, , , acFormAdd, acDialog,
Me![ClaimID]
DoCmd.Close acForm, Me.frmInterestedParty, acSaveNo
End If
End Sub
The exact error (which hadn't popped up before) is "...there may have been
an error evaluating the function, event or macro. " Any ideas how to work
around this? Or perhaps I didn't set it up as you intended... I'd really
appreciate any other suggestions you have for me...Thanks!!!
Pamela
 
Close -- I've changed the content of the DoCmd.Close line:

Private Sub Claim_Party_Exit(Cancel As Integer)
If [Claim Party] = "Claimant" Then
Me.Visible = False
DoCmd.OpenForm "frmInterestedParty2", acNormal, , , acFormAdd, acDialog,
Me![ClaimID]
DoCmd.Close acForm, Me.Name, acSaveNo
End If
End Sub
--

Ken Snell
<MS ACCESS MVP>




Pamela said:
Perhaps I missed something because I got another error, this time on the
OnLoad event of the new popup form which I had coded:
Private Sub Form_Load()
Me.ClaimID = Me.OpenArgs
End Sub
I'll also provide the code for opening this form:
Private Sub Claim_Party_Exit(Cancel As Integer)
If [Claim Party] = "Claimant" Then
Me.Visible = False
DoCmd.OpenForm "frmInterestedParty2", acNormal, , , acFormAdd, acDialog,
Me![ClaimID]
DoCmd.Close acForm, Me.frmInterestedParty, acSaveNo
End If
End Sub
The exact error (which hadn't popped up before) is "...there may have been
an error evaluating the function, event or macro. " Any ideas how to work
around this? Or perhaps I didn't set it up as you intended... I'd really
appreciate any other suggestions you have for me...Thanks!!!
Pamela


Ken Snell (MVP) said:
Try making the popup form invisible, then open the new form, then close
the
original form:

Me.Visible = False
DoCmd.OpenForm 'rest of arguments here
DoCmd.Close acForm, Me.Name, acSaveNo
 
Thanks so much -- it works perfectly now!

Pamela

Ken Snell (MVP) said:
Close -- I've changed the content of the DoCmd.Close line:

Private Sub Claim_Party_Exit(Cancel As Integer)
If [Claim Party] = "Claimant" Then
Me.Visible = False
DoCmd.OpenForm "frmInterestedParty2", acNormal, , , acFormAdd, acDialog,
Me![ClaimID]
DoCmd.Close acForm, Me.Name, acSaveNo
End If
End Sub
--

Ken Snell
<MS ACCESS MVP>




Pamela said:
Perhaps I missed something because I got another error, this time on the
OnLoad event of the new popup form which I had coded:
Private Sub Form_Load()
Me.ClaimID = Me.OpenArgs
End Sub
I'll also provide the code for opening this form:
Private Sub Claim_Party_Exit(Cancel As Integer)
If [Claim Party] = "Claimant" Then
Me.Visible = False
DoCmd.OpenForm "frmInterestedParty2", acNormal, , , acFormAdd, acDialog,
Me![ClaimID]
DoCmd.Close acForm, Me.frmInterestedParty, acSaveNo
End If
End Sub
The exact error (which hadn't popped up before) is "...there may have been
an error evaluating the function, event or macro. " Any ideas how to work
around this? Or perhaps I didn't set it up as you intended... I'd really
appreciate any other suggestions you have for me...Thanks!!!
Pamela


Ken Snell (MVP) said:
Try making the popup form invisible, then open the new form, then close
the
original form:

Me.Visible = False
DoCmd.OpenForm 'rest of arguments here
DoCmd.Close acForm, Me.Name, acSaveNo

--

Ken Snell
<MS ACCESS MVP>


I have a data entry form, frmClaimAssignment, with cboLossType. On the
AfterUpdate event of this combo box, I have code to open
frmInterestedParty
as a pop up. On the last field of that form, I have an If function on
the
AfterUpdate event to open another form, frmIntParty2, should certain
criteria
be met. I would like for the frmInterestedParty to close when the new
pop
up, frmIntParty2, opens. When I add a DoCmd.Close function to my
current
code to open the form, I get an error "this action can't be carried out
while
processing a form event." I've also tried it on the OnLoad event of
popup2
but it doesn't seem to work...Any suggestions would be great!!!
Thanks!
 
Back
Top