Can't open form using acFormAdd

J

John Baker

I am trying to open a form using the code : DoCmd.OpenForm stDocName, ,
, , acFormAdd
I keep getting the message "Open form action was cancelled" (which is error
number 2501)

If I remove the acFormAdd argument then the form opens fine.
The query behind the form is updateable. The "allow Additions" property is
set to yes.
I have tried removing all code from the form.

I am stumped to why I can't open the form at a new record. Any ideas?


Any help greatly appreciated.

John Baker
(e-mail address removed)
 
T

TC

My first reaction is to say that form_open is setting cancel=true; but you
say you have removed all the code.

If you omit acFormAdd, I assume it opens to an existing record. Can you then
click Insert Record (or similar) to add a new record? What if you omit
acFormAdd, but temporarily delete all records from the relevant tables? Some
tests like those, should lead to the answer.

HTH,
TC
 
J

John Baker

Thanks for your reply TC.
On further investigation I found the code had set the "allow Additions"
property to No and had left the form in that state.
So my solution was to open the form, change the "allow Additions" property
to yes and then add a new record using code.

Thanks for your suggestions which lead me to my solution.

Regards
John Baker

(e-mail address removed)
 

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