Append Query - InfoPath Dev
in

InfoPath Dev

Append Query

Last post 04-14-2011 04:27 AM by Skarn. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-17-2011 09:03 AM

    Append Query

    Can I execute an append query within InfoPath to an Access database?

  • 03-17-2011 01:04 PM In reply to

    Hi. You can do a submit of new rows, but new rows have to be in the data fields, not in the query fields.

    If you want to submit the content in the query fields, you would have to use code or get into the .xsf file to insert a new row to the datafields, copy data from the query fields to the last entry of the data fields, and submit.

    Hope this helps!

    Qwerty
  • 03-31-2011 07:27 AM In reply to

    Could you attach an example or point me in the direction?  I have the northwinds database on my computer.

     Thanks,

    Arthur

  • 04-14-2011 04:27 AM In reply to

    • Skarn
    • Top 50 Contributor
      Male
    • Joined on 04-20-2008
    • Australia
    • Posts 198

    The way suggested above is correct, you can design the form initially based on the Access database and this would allow you to submit new/update records records. Otherwise you could try leveraging ADO objects in JScript or VBScript.

    Attacking it from the Microsoft Access side it might be of interest to you, the ImportXML VBA command in Microsoft Access will read in an Infopath Form, treating Groups as Tables and Fields as...well, fields in those tables, matching the structure of the Form data-source.

    If the tables exist, the forms contents are appended ;-) You can make the tables 'exist' before Import by using the Microsoft Access Import data wizard , point it to an Infopath form.xml and select 'structure' as the Import option for the XML.

    You can also add fields to the Access tables that are not in the form, and the form will still Import fine afterwards.
    This becomes important when you realise that XML can imply relationships between groups via XML hierachy, but Access needs Primary and Foreign key relationships. 

    Couple of methods if you do this:

    1. Add the key fields to all tables and then after a form import populate the null ones which a relating uniqueId, or

    2. Have a field in the form which holds the uniqueId at the root level, then in every group, REFERENCE the uniqueId field in Infopath - this gives you a field with the 'same name' in every group. The use a default value on all of them equal to the value of the Root one and have them update whenever it's changed = instant uniqueId field and value in every group in the Infopath XML structure = relating keys/field in Access after import.

     Sorry - may have gotten a bit carried away, but there's a few methods in there which might inspire you.

     

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.