Docmd.Save

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

I'm using the following code to save my record before printing it

If Me.Dirty Then Docmd.Save

I'm getting an error saying I have not specified the object
Do I have to specify 'table' and the table name each time I use this
statement, I thought it defaulted to the current object?
 
mscertified said:
I'm using the following code to save my record before printing it

If Me.Dirty Then Docmd.Save

I'm getting an error saying I have not specified the object
Do I have to specify 'table' and the table name each time I use this
statement, I thought it defaulted to the current object?


That command doesn't save the record; it saves design changes to an object;
for example, a form or report whose design you've changed. You should use
one of the following instead:

RunCommand acCmdSaveRecord

or

If Me.Dirty Then Me.Dirty = False
 
mscertified said:
I'm using the following code to save my record before printing it

If Me.Dirty Then Docmd.Save

I'm getting an error saying I have not specified the object
Do I have to specify 'table' and the table name each time I use this
statement, I thought it defaulted to the current object?

Just use:

If Me.Dirty Then Me.Dirty = False

(Yes, the Dirty property is read/write)
 
Back
Top