How do I get InfoPath to create an autonumber field?

D

Doreen

I am working on an InfoPath form that is connected to an Access database. I
had to create a primary key in the database as an autonumber in order to get
database to work with Infopath form. Now when I complete the form, I get an
error no value in primary key field. How can I get InfoPath to generate a
number in the autonumber field?
 
F

Franck Dauché

Hi,

Don't submit a field trying to write into autonumber field of your Access
DB. When you add a row, the autonumbering will be generated by Access.
What you could do, is get that number back as a result from the Web Service
and display it if you need to.

Regards,

Franck Dauché
 
D

Doreen

If I remove the Autonumber from the form, the data will not be submitted into
the database. I get an error "Index or primary key cannot contain a Null
value." Are you saying that I should have the user retrieve a number from
the database, then complete the form?

Thanks,

Doreen
 
F

Franck Dauché

Hi Doreen,

In this Forum, do a search on: "Automatically populate field on Form", the
top post in the results will tell you more...

Regards,

Franck Dauché
 
B

BigSeph

Perhaps it would be best for you to set another field as the primary key? It
causes issues in SQL when using Infopath ---> SQL as front/backend, perhaps
Access has the same issues. Change the primary key to an item ID or SS# or
some other unique value and let the auto-incrementing identity field just
serve as an identity field, not an identity+primary key.

This will also allow you to "hide" the identity field from end users as it
won't be a part of the form's dataset tree.

My .02
 

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