Infopath submitting multiple records without closing the form deletes previous record - InfoPath Dev
in

InfoPath Dev

Infopath submitting multiple records without closing the form deletes previous record

Last post 07-28-2010 12:26 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-27-2010 08:37 AM

    Infopath submitting multiple records without closing the form deletes previous record

    We have an Infopath 2007 form using managed code and that is hooked up to a SQL 2005 database. The database consists of 1 main table(unique ID field, identity), and 5 sub-tables linked to the main table on the same unique ID contained in  the main table. We have a Main Menu view, with multiple views underneath.

    Let's say the user enters their data in to the form, and submits via managed code. All data is submitted correctly and can be retrieved correctly.

    Now, let's say an hour later, the user needs to enter in a new record. The user never closed the instance of Infopath, they just simply returned to the Main Menu view and then to the view that allows data entry. When they go to submit this time, a new record is properly created in the main table and the 5 sub-tables, BUT, the previous record they submitted an hour earlier in the main table is deleted, leaving orphans in the 5 sub-tables.

    I tried to use the code found at this link to clear or reset fields, and while it seems to clear data in the form, the record is still deleted in the main table.
    http://www.bizsupportonline.net/blog/2009/08/clear-reset-fields-infopath-3-lines-code/

    Is there some code setting that we are missing to indicate to Infopath that we are trying to enter a new record?  Or is there a way to reset the form or restore the InfoPath form to its original state as when it was opened for the first time?

    For a quick work around we ended up setting a rule on a button to [close the form] and then [Open a new form to fill out].  This gives us what we want, but it's not a clean way to do it. Thanks!

  • 07-28-2010 12:26 AM In reply to

    Re: Infopath submitting multiple records without closing the form deletes previous record

    Hi JoeManc,

    Sorry to hear you're having problems. InfoPath's built-in support for databases is bad because it assumes a direct connection and that causes problems when schemas change. In addition, a direct connetion limits you to SQL data types. Best practice here is to use a Web Service.

    So, given you've slaved away at this problem for awhile and there's practically no probability in hell that you are going to Web Services ... well, I think the workaround is a good alternative for now.

    Sorry, I don't have a silver bullet. SQL data connector is not worth the trouble. Better to use a Web Service.

    Best,

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.