Close Pop Up Form

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!
 
K

Ken Snell \(MVP\)

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
 
P

Pamela

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
 
K

Ken Snell \(MVP\)

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
 
P

Pamela

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top