VBA equivalent to RECORDS -> SAVE RECORD

  • Thread starter Thread starter paxdak
  • Start date Start date
P

paxdak

What's the VBA equivalent to selecting RECORDS -> SAVE RECORD (shift-enter) when on a form?
 
Me.Dirty = False

Keep in mind, this will cause an error if the form is not dirty to begin
with, so

If Me.Dirty = True Then
Me.Dirty = False
End If

is typical.

There are other ways to do DoCmd.RunCommand .... but the constants change
between Access versions and I find the code to be cryptic, so I always stick
with the Form's Dirty property.

You could also replace "Me" with a valid reference to a different open form:

Forms(0).Dirty = False
Forms("frmDataEntry").Dirty = False
Forms!frmDataEntry.Dirty = False

HTH,

Kevin
 
Kevin K. Sullivan said:
Me.Dirty = False

Keep in mind, this will cause an error if the form is not dirty to
begin with, so

If Me.Dirty = True Then
Me.Dirty = False
End If

is typical.

Actually, Me.Dirty = False will not cause an error if the form isn't
dirty. It's just that it's marginally more efficient to only do that
when the form is actually dirty.
 
Thanks for the update!
Kevin
Dirk Goldgar said:
Actually, Me.Dirty = False will not cause an error if the form isn't
dirty. It's just that it's marginally more efficient to only do that
when the form is actually dirty.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top