AllowAdditions & AllowDeletions not working

C

ctdak

My application is in Access 2000. I have tried many times but have never
been successful in getting these two form properties to work. When I set
them to No, they do NOT disallow record additions and deletions like they're
supposed to. The New Record and Delete Record buttons are enabled instead of
disabled, and the same with the Edit menu choices. Has anyone else had this
experience, or am I the only one? Any ideas on a solution?
 
K

Ken Snell

They work for me.... there must be some additional characteristics to your
form that you haven't posted. How do you set these properties? How are you
using them?
 
C

ctdak

It's forms plural. All my forms that have a recordset behind them act this
way. I don't have any forms for which these form properties work. I've been
setting their value on the Data tab of the form properties in design view.

However, since you asked how I was doing it, I just now tried setting them
to False in VBA code in the On Open form event and that works! So, my
problem is solved, but why in the world doesn't it work by setting them in
design view?

ctdak
 
K

Ken Snell

Are you running code in the OnOpen or OnLoad event for a form (beyond this
new code to set the properties)?
 
K

Ken Snell

and those lines of code are...? post that code.

and how are you opening the form....? by code? post that code.
 
C

ctdak

I have several forms with recordsets behind them. If AllowAdditions and
AllowDeletions are set to No, additions and deletions can still be done for
any of them. Let me give you the simplest example.

The form is opened as follows:

Private Sub EditAcctsButton_Click()
Me.Visible = False
DoCmd.OpenForm "frm_Accounts", , , , acFormEdit, acWindowNormal
End Sub

There is no OnOpen event code for this form.

ctdak
 
K

Ken Snell

Ah, ok we can fix this for you.

Your OpenForm step is telling ACCESS to open the form in Edit mode. This
overrides the settings that you have put in the form and opens it for full
editing capability, including additions, deletions, etc. That is why the
form is behaving the way you describe.

What you need to do is modify slightly the code step to use the
acFormPropertySettings argument:

DoCmd.OpenForm "frm_Accounts", , , , acFormPropertySettings , acWindowNormal

And, because the acFormPropertySettings is the default value, you can do
this as an alternative step:

DoCmd.OpenForm "frm_Accounts", , , , , acWindowNormal
 
C

ctdak

Ken,

That did it. Thanks for sticking with this thread and solving my problem.
I was unaware of the acFormPropertySettings argument and what it did vs the
alternate arguments. Now it makes sense, and it makes sense that no one else
could duplicate my problem.

Much appreciated.

ctdak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top