Help! AllowEdits and SaveRecord error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have one form and set the "Allowedits=no, Allowdeletions=no,
Allowadditions=yes" because I want the user can only add a new record and can
not update and delete records.

The problem is on the form, there is one button "Save", which is generated
by the wizard via "Record Operations" -> "Save Record" from Access 2000. I
want the user can add a new record and save it by press "Save" button to make
sure the new record is saved, but I get a messages when press the "Save"
button,

"The command or action 'SaveRecord' isn't available now."

Even though the new record can be saved if the form is closed or by go to
another record. But it looks not professional. And I am sure the the problem
appears after I set "Allowedits=no". Is there any way to fix it? Or any good
method to achieve the goal? I would appreciate your help!
 
jessica said:
Hello,

I have one form and set the "Allowedits=no, Allowdeletions=no,
Allowadditions=yes" because I want the user can only add a new record
and can not update and delete records.

The problem is on the form, there is one button "Save", which is
generated by the wizard via "Record Operations" -> "Save Record" from
Access 2000. I want the user can add a new record and save it by
press "Save" button to make sure the new record is saved, but I get a
messages when press the "Save" button,

"The command or action 'SaveRecord' isn't available now."

Even though the new record can be saved if the form is closed or by
go to another record. But it looks not professional. And I am sure
the the problem appears after I set "Allowedits=no". Is there any way
to fix it? Or any good method to achieve the goal? I would appreciate
your help!

Use...

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

BTW I completely disagree that your form would look "unprofessional" without
a [Save] button. You have a notion in your head that all forms should have
such a button and that notion is not widely held nor correct. Thin client
and web pages "need" a save button. A bound Access form does not.
 
Could you please give me more details, where I should put the code? And what
exactly that code did? Thanks again for your patience.

Rick Brandt said:
jessica said:
Hello,

I have one form and set the "Allowedits=no, Allowdeletions=no,
Allowadditions=yes" because I want the user can only add a new record
and can not update and delete records.

The problem is on the form, there is one button "Save", which is
generated by the wizard via "Record Operations" -> "Save Record" from
Access 2000. I want the user can add a new record and save it by
press "Save" button to make sure the new record is saved, but I get a
messages when press the "Save" button,

"The command or action 'SaveRecord' isn't available now."

Even though the new record can be saved if the form is closed or by
go to another record. But it looks not professional. And I am sure
the the problem appears after I set "Allowedits=no". Is there any way
to fix it? Or any good method to achieve the goal? I would appreciate
your help!

Use...

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

BTW I completely disagree that your form would look "unprofessional" without
a [Save] button. You have a notion in your head that all forms should have
such a button and that notion is not widely held nor correct. Thin client
and web pages "need" a save button. A bound Access form does not.
 
Hi,
That code will replace the wizard code, which is in the Save button's Click event.
When data on a form hasn't been saved yet, it is refered to as 'Dirty'
So the code says if the data is dirty, then save it so it isn't dirty anymore.

--
HTH
Dan Artuso, Access MVP


jessica said:
Could you please give me more details, where I should put the code? And what
exactly that code did? Thanks again for your patience.

Rick Brandt said:
jessica said:
Hello,

I have one form and set the "Allowedits=no, Allowdeletions=no,
Allowadditions=yes" because I want the user can only add a new record
and can not update and delete records.

The problem is on the form, there is one button "Save", which is
generated by the wizard via "Record Operations" -> "Save Record" from
Access 2000. I want the user can add a new record and save it by
press "Save" button to make sure the new record is saved, but I get a
messages when press the "Save" button,

"The command or action 'SaveRecord' isn't available now."

Even though the new record can be saved if the form is closed or by
go to another record. But it looks not professional. And I am sure
the the problem appears after I set "Allowedits=no". Is there any way
to fix it? Or any good method to achieve the goal? I would appreciate
your help!

Use...

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

BTW I completely disagree that your form would look "unprofessional" without
a [Save] button. You have a notion in your head that all forms should have
such a button and that notion is not widely held nor correct. Thin client
and web pages "need" a save button. A bound Access form does not.
 
Thank you all! It works...

Dan Artuso said:
Hi,
That code will replace the wizard code, which is in the Save button's Click event.
When data on a form hasn't been saved yet, it is refered to as 'Dirty'
So the code says if the data is dirty, then save it so it isn't dirty anymore.

--
HTH
Dan Artuso, Access MVP


jessica said:
Could you please give me more details, where I should put the code? And what
exactly that code did? Thanks again for your patience.

Rick Brandt said:
jessica wrote:
Hello,

I have one form and set the "Allowedits=no, Allowdeletions=no,
Allowadditions=yes" because I want the user can only add a new record
and can not update and delete records.

The problem is on the form, there is one button "Save", which is
generated by the wizard via "Record Operations" -> "Save Record" from
Access 2000. I want the user can add a new record and save it by
press "Save" button to make sure the new record is saved, but I get a
messages when press the "Save" button,

"The command or action 'SaveRecord' isn't available now."

Even though the new record can be saved if the form is closed or by
go to another record. But it looks not professional. And I am sure
the the problem appears after I set "Allowedits=no". Is there any way
to fix it? Or any good method to achieve the goal? I would appreciate
your help!

Use...

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

BTW I completely disagree that your form would look "unprofessional" without
a [Save] button. You have a notion in your head that all forms should have
such a button and that notion is not widely held nor correct. Thin client
and web pages "need" a save button. A bound Access form does not.
 
Back
Top