Puzzling error with DoCmd.Close

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
 
M

Maurice

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

Dudley

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
 

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

Similar Threads

Inserting data in forms 1
Copying from two forms 10
Vista problem? 5
If Statements 2
Clearing combo box 2
can't find form 4
Coding help 0
Criteria when opening form 1

Top