SQL Database Question - InfoPath Dev
in

InfoPath Dev

SQL Database Question

Last post 01-23-2008 05:12 PM by Patrick Halstead. 18 replies.
Page 1 of 2 (19 items) 1 2 Next >
Sort Posts: Previous Next
  • 01-22-2008 07:14 AM

    SQL Database Question

    I was splitting my Access table into three smaller table when I got your note. I now have a main table with most of the data and two other tables that contain Labor and Non-Labor comments. But when I add comments to the form it does not save it to the database. Also, when I try to add a new record I get the following error..

    The following error occurred:

    InfoPath cannot submit the form.

    An error occurred while the form was being submitted.

    The structure of the dataFields group has been changed, and it no longer matches the structure of the data source.

    Is there a trick to using 3 tables as the Main data source? I searched Google and the Info Dev forum for the error above and found no information. The form is complete and this is the only step I have left. I have already converted the queries to SQL Views.

  • 01-22-2008 07:59 AM In reply to

    The child tables would have to have to have primary keys and also key relationship to the main table.

    You would also need to go through the data connection wizard and modify your main data source to alert it to the data change.  This will probably break some bindings on your form so you will have to do some clean up of the data if the data was previously in the main table.

    I think this is what you are missing.  Make sure in Data Connections that it lists your Main as both receive and submit.

  • 01-22-2008 08:34 AM In reply to

    My child tables do have a primary key and I have created a relationship between the parent and child tables(autonumber).  I used the data connection wizard to setup the new tables.  I also fixed some broken bindings. I can receive and submit to the parent table but unable to save to a child table even though I have it linked to the parent.  

  • 01-22-2008 08:40 AM In reply to

    In the data connection wizard have you added the additional tables?

    On the right side once you select the main table you need to add the additional tables.  You should see all three tables and the field selection in the tree view.

    Then you will have al three tables in your data source.  When you insert it will insert one of each.

    Also then you should be able to query existing data as well as submit.

  • 01-22-2008 08:51 AM In reply to

    I have done that, my Data Connection looks like this...

    -  LaborSummay.dbo

        - LaborSummayCommentsLabor.dbo

        - LaborSummayCommentsNonLabor.dbo

     

    Autonumber is the primary key for all the tables and I have setup a relationship between the first table listed and the two below it.  

     

     

     

     

  • 01-22-2008 08:59 AM In reply to

    Alright.

    First I would try adding a new view and drag your whole data node onto it as a sectio with controls so you can see everything.

    Preview and see if you can query and submit all three tables.  One thing do you have any data in your tables? Often I have an issue with the data connection if the table has no records (1 blank).  You might try putting some test data in the first row and then go through the data connection wizard if this has been the case.

    Lastly, create a new form from scratch real quick and do the default drag of the query fields and data fields and preview that and see if you get full functionality on all of your tables.

  • 01-22-2008 09:26 AM In reply to

    I am using an autonum to create a key on a new record for me on all tables. I have a autonum field records 1 to 3283 on all three tables.  My main table have all fields with data in them.  My two child tables have the same autonum field filled in 1 to 3283 and also a Control Account Number field.

     It looks like I did everything right.  Do the child tables need to have the same key(1-3283) as on the parent table.  When they did not,  they were not editable on the form.

     I will try creating a new form to see if I can get it to work.

  • 01-22-2008 09:33 AM In reply to

    Typically you would configure each table with a primary key so that each record has a unique ID. Child tables would have an extra column/field which pointed to the parent record in the parent table.

    So main

    ID  Name  Decription    etc

    1    Test     Testing        x

    2    Test2    Test Again  x

    Then child

    ID  MainID   Name        Comment

    1      2         TestNote   Testing is fun

     You may already have this, I just wanted to be clear that your relationships are right.  Also it should ask you for this relationship in the wizard.  Are you supplying the ID numbers in the form?

     

  • 01-22-2008 10:09 AM In reply to

    This may be my problem...I am using the ID and MainID as the same key on the child table...for the table and for the link to the parent table.

    ID  Name  Decription    etc

    1    Test     Testing        x

    2    Test2    Test Again  x

    Then child

    MainID   Name        Comment

       2       TestNote   Testing is fun

  • 01-22-2008 10:15 AM In reply to

    That may be the issue.

    InfoPath typically wants a one to many relationship, multiple children per parent or at least the capability to handle this.  I would try adding a Primary key which is unique to each child and see if that works.

  • 01-22-2008 10:25 AM In reply to

    So the child tables do not have to have a record associated with a record on the parent table to start?  I want a one to may relationship where there are no comments to start and users can add as many comments as they want to per Control Account.

  • 01-22-2008 10:33 AM In reply to

    I have a another quick question...I am summing a field set as Decimal with 4 places such a 0.0000.  Some records have 0.0000 and others have numbers such as 812.1677.  I get 1#QNAN sometimes even though there are no blanks in the field.  Do you know why?

    Filed under:
  • 01-22-2008 10:33 AM In reply to

    When a new record is added on the main table, InfoPath will default a new record for each child.  The user can complete these, ignore these, or add more than one.  That is why the records need an ID as well as a pointer to the parent, to enable multiple children. A new record would need the pointer set to submit properly but it would be blank initially. Child tables cannot be created on their own without an associated parent.

    When a record is queried the related children will be returned as well.

    Update your table as I laid out and then create a new form and I think you will see as you experiment with it.

  • 01-22-2008 10:36 AM In reply to

    I went through this in another thread recently.

    First you need some data in Access before running the data connection wizard.  It also should be formatted in Access so it is not rounding but displaying the decimal places.  Then it should be a float field in InfoPath and you can set control format to the correct number of decimal places.

  • 01-23-2008 08:09 AM In reply to

    My field in Access is setup as a type "double" with 4 decimal places.  When I perform a "sum" function on that column I get the 1QNAN error anytime I have a number after the decimal point such as 0.0025.  The sum works fine if all the columns something like  0.0000 or 1.2500.   The total column is setup a decimal.  Does anyone know why?

    Filed under:
Page 1 of 2 (19 items) 1 2 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.