Link to home
Start Free TrialLog in
Avatar of HKFuey
HKFueyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access save bound form record

I have this: -

 If Me.Dirty = True Then
  DoCmd.RunCommand acCmdSave
 End If

Open in new window


It gives error 2455 "You entered an expression that has an invalid reference"

I am trying to get a bound form to save after a box is ticked. Can anyone help?
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Try with:

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

/gustav
Try acCmdSaveRecord

If Me.Dirty = True Then
  DoCmd.RunCommand acCmdSaveRecord
 End If

Open in new window

Avatar of HKFuey

ASKER

Sorry for not being clear, it errors on line 1

 If Me.Dirty = True Then
SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Where is your code located?

If it is not on the form, you'll need the full reference:

Forms!YourFormName.Dirty
Avatar of HKFuey

ASKER

Hi mbizup,

Tried the form name, I still get the error, if I take out the if statement and just leave: -

DoCmd.RunCommand acCmdSaveRecord

It seems to work OK
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just for kicks, try the same thing on a new (or different) form.