467,119 Members | 1,156 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,119 developers. It's quick & easy.

docmd.openform can't create new record

Hi all,

Have a question I can't get around. I've done this before and for some reason can't get it to work this time.

I'm opening a form through docmd.openform, and trying to get it to open an blank form to allow me to add a new record. Problem is, every time I run the method, it opens up the first record in the database, rather than give me a new emtpy record. Please help!!!!

I'm using:
DoCmd.OpenForm "frmComm", acNormal, , , acFormAdd

I always thought that "acFormAdd" would provide me with a new empty record, but it's not working. Could the problem be with the form that is being opened? I inactivated all code for the new form, so there are no methods working there, still doesn't work.

What am I doing wrong?

Robin
Dec 14 '07 #1
  • viewed: 4157
Share:
1 Reply
Sorry, I think I realized the problem. The record source query that I was using was based on a table that didn't have a primary key defined. Once I defined the main table ID field as the primary key, it came together.

Hi all,

Have a question I can't get around. I've done this before and for some reason can't get it to work this time.

I'm opening a form through docmd.openform, and trying to get it to open an blank form to allow me to add a new record. Problem is, every time I run the method, it opens up the first record in the database, rather than give me a new emtpy record. Please help!!!!

I'm using:
DoCmd.OpenForm "frmComm", acNormal, , , acFormAdd

I always thought that "acFormAdd" would provide me with a new empty record, but it's not working. Could the problem be with the form that is being opened? I inactivated all code for the new form, so there are no methods working there, still doesn't work.

What am I doing wrong?

Robin
Dec 14 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by chanchito_cojones | last post: by
15 posts views Thread by Thelma Lubkin | last post: by
2 posts views Thread by rturpyn@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.