Allow additions

J

Junior

In a form i have entered several records and then set the 'allow additions
to no in order to exclude others from adding records - i only want to allow
them to edit the existing records in the underlying table.
This works when i open the form form the database window -but when the form
is opened from an event using the below code - the form allows eadding
additional records- how can i limit the records when opening from an
event???

DoCmd.OpenForm "flkpNurSpec", acNormal, "", "", acEdit, acNormal
 
G

Gary Miller

Junior,

Here are two methods. In the OnOpen event of the form put
in...

Me.AllowAdditions = False

or add the following line right below your existing OpenForm
line.

Forms!flkpNurSpec.AllowAdditions = False

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
C

Cheryl Fischer

According to VBA Help on the OpenForm method, if you leave the DataMode
(acEdit) argument blank, the form will open in accordance with its property
settings. I haven't had a chance to test this, but give it a try.
 
P

PC Datasheet

You don't need that line of code! Just open the form in design view and open
properties. Go to the Data tab and set Allow Additions to No but leave Allow
Edit set to Yes.
 
J

Junior

PC- those are my setting now- and it doesn't work when opened with VBA
Gary miller was right on with the solution
Cheryl - i didn't try yours since Gary had the solution
thanks all for your help
 

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