Puzzling error with DoCmd.Close

  • Thread starter Thread starter Dudley
  • Start date Start date
D

Dudley

I have five forms in Access 2000 which each have four command buttons to open
the other four with code e,g,

Private Sub Command7_Click()
Dim stdocname As String
Dim stlinkcriteria As String

stdocname = "Director"

stlinkcriteria = "[EnvelopeNumber]=" & Me![EnvelopeNumber]
DoCmd.OpenForm stdocname, , , stlinkcriteria
DoCmd.Close acForm, "Subscriber", acSaveYes

End Sub

These all work fine except for one on one form which only works if the last
line to close the old form is left out. I have tried deleting and copying
from another button's code, and deleting and writing from scratch, but I
always get the same problem, and only on trying to open the RegisteredOffice
form from the Subscriber form. The RegisteredOffice form has the parent table
only and the other four have sub-forms. Can anyone suggest a possible reason
and solution?

Thanks
Dudley
 
Why do you want to use the argument acSaveYes, this argument is meant for
saving changes made to the form (design changes and not record changes). If
that's the case the record is still probably dirty which you can tackle with
me.dirty=false otherwise omit the acSaveYes argument and see if that helps.
 
Thanks very much. Deleting acSaveYes solved the problem.
Dudley

Maurice said:
Why do you want to use the argument acSaveYes, this argument is meant for
saving changes made to the form (design changes and not record changes). If
that's the case the record is still probably dirty which you can tackle with
me.dirty=false otherwise omit the acSaveYes argument and see if that helps.
--
Maurice Ausum


Dudley said:
I have five forms in Access 2000 which each have four command buttons to open
the other four with code e,g,

Private Sub Command7_Click()
Dim stdocname As String
Dim stlinkcriteria As String

stdocname = "Director"

stlinkcriteria = "[EnvelopeNumber]=" & Me![EnvelopeNumber]
DoCmd.OpenForm stdocname, , , stlinkcriteria
DoCmd.Close acForm, "Subscriber", acSaveYes

End Sub

These all work fine except for one on one form which only works if the last
line to close the old form is left out. I have tried deleting and copying
from another button's code, and deleting and writing from scratch, but I
always get the same problem, and only on trying to open the RegisteredOffice
form from the Subscriber form. The RegisteredOffice form has the parent table
only and the other four have sub-forms. Can anyone suggest a possible reason
and solution?

Thanks
Dudley
 
Back
Top