Database Form & New Record Action

P

Phil Ny

I’ve been working with MS SQL Server-based forms and am able to query,
insert, update & delete records just fine. However, I would like to query for
an existing record, modify a few fields and then save it as a new record.
This isn’t a problem if I allowed users to add their own primary key values.
In my situation, though, all keys are IDENTITY columns to make key management
easy. When a record is returned the key value is loaded into the DOM and if I
edit fields & submit it simply updates the current record. If I change the
key field in the data section and submit then InfoPath returns an error to
the effect that the key has been changed illegally. The only way I’ve been
able to add new records is to click New Record which does increment the
IDENTITY key but also clears all the fields. An action that leaves the
current data fields alone but increments the key would be a perfect solution.
I’ve searched the web extensively and found some help, e.g.
at the InfoPathDev site, but no solution. The books by P.Janus &
Roberts/Green don’t mention this problem. The closest I’ve come is trying to
make a copy of the current record, then trying to issue a New Record action
(which seems to be the only way to reset/autoincrement the IDENTITY key),
then paste the DOM copy into the new DOM tree (if my terms are correct). No
success so far. It’s odd that there are simple calls for query & submit but
not for “New Record†or any of its component actions (or, are there?). I’d
think this would be a very common thing for people to do. So far I’m stumped.
Regards, Phil Nyman
 

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