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?
VB ScriptMicrosoft Access

Avatar of undefined
Last Comment
mbizup

8/22/2022 - Mon
Gustav Brock

Try with:

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

/gustav
mbizup

Try acCmdSaveRecord

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

Open in new window

ASKER
HKFuey

Sorry for not being clear, it errors on line 1

 If Me.Dirty = True Then
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
SOLUTION
IrogSinta

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
mbizup

Where is your code located?

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

Forms!YourFormName.Dirty
ASKER
HKFuey

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
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
mbizup

Just for kicks, try the same thing on a new (or different) form.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.