Re: Form not closing properly
- From: Paolo <Paolo@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Apr 2008 02:46:01 -0700
Hi TESA0_4,
did you try to compact and repair the database?
If you wanna close the current form (the one who has the focus) try just with
DoCmd.Close
on your button
HTH Paolo
"TESA0_4" wrote:
Hi Jeanette,.
Thanks for your assistance.
I replaced my code with your code and the form closed but 'left behind' the
same 'white area' on the screen. If another form is opened or dragged across
the white area it refreshes to the normal gray background.
I had the command button on the footer of the main form and moved it to the
detail area of the main form but no change in the outcomes other than to get
another white area where the button was located!!
If you care to go to http://terry.timandliz.id.au/ I have posted a couple of
screenshots to illustrate what is going on.
I suppose there is a chance that I have bumped into a bug in Access.
Regards,
Terry
"Jeanette Cunningham" wrote:
Hi,
Make sure the close button is on the main form.
Try with the code like this
Private Sub cmdSaveClose_Click()
On Error GoTo Err_cmdSaveClose_Click
If (Me.Dirty = True) Then
Me.Dirty = False
End If
DoCmd.Close acForm, Me.Name
Exit_cmdSaveClose_Click:
Exit Sub
Err_cmdSaveClose_Click:
MsgBox Err.Description
Resume Exit_cmdSaveClose_Click
End Sub
Explanation:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
is very old code the wizards provide for backward compatiblilty with older
versions of access.
The most popular way to save changes is to use
If (Me.Dirty = True) Then
Me.Dirty = False
End If
To close the form that the code is running in, you don't need to hard code
the name of the form.
You can just use Me.Name
Closing the main form automatically closes the subform as well.
Jeanette Cunningham
"TESA0_4" <TESA04@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:52FE62A3-581D-44E8-BAB2-02DE93D3E9BB@xxxxxxxxxxxxxxxx
Hi,
I have a Form with a Subform. If I use the cross in the top right hand
corner of the form to close it, all is well. If I use a command button
with
the following code to close the form a 'white oblong' remains on the
screen
in a position that matches where the subform was being displayed.
If I go back to the backup copy of the application from the start of
today,
the command button works fine but not now. I cannot identify what
change(s) I
have made today that has caused the command button to become partially
ineffective.
Any suggestions would be appreciated. (I'm using Access 2003 in Access2000
format).
Private Sub cmdSaveClose_Click()
On Error GoTo Err_cmdSaveClose_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Close acForm, "frmHazActPlan"
Exit_cmdSaveClose_Click:
Exit Sub
Err_cmdSaveClose_Click:
MsgBox Err.Description
Resume Exit_cmdSaveClose_Click
End Sub
- Follow-Ups:
- Re: Form not closing properly
- From: TESA0_4
- Re: Form not closing properly
- References:
- Form not closing properly
- From: TESA0_4
- Re: Form not closing properly
- From: Jeanette Cunningham
- Re: Form not closing properly
- From: TESA0_4
- Form not closing properly
- Prev by Date: Re: Form not closing properly
- Next by Date: Re: Form not closing properly
- Previous by thread: Re: Form not closing properly
- Next by thread: Re: Form not closing properly
- Index(es):
Relevant Pages
|