Problem with Insert Update - InfoPath Dev
in

InfoPath Dev

Problem with Insert Update

Last post 02-14-2006 03:13 AM by ahardin. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 01-20-2006 08:39 AM

    Problem with Insert Update

    I have a form linked to access to capture meeting information that has several sections. The form is broken up into smaller forms now, each representing a section and meeting header.

    A table called meeting is the main table with a key of Meeting Date and Meeting Shift. The individual Sections can repeat and are keyed by autonumbers. The tables are linked to Meeting with Meeting Date and Meeting Shift.

    If I enter one section I am fine (Meeting Date, Meeting **** attached to meeting and section info attached to the section tables are entered), but when I open another sections form and try to use the same Meeting Date and Meeting Shift it tells me I am trying to insert duplicate data.

    I was under the assumption that I could create the row in the header table with one form and then update it in another form. It seems it is trying to insert both times -

    Any ideas on what I am doing wrong?

    Thanks


  • 01-23-2006 01:39 AM In reply to

    Re: Problem with Insert Update

    Hi Grizeen,
    This is no doubt a problem with the form. Probably because it's not set up to update the Access DB correctly. Are you the author of the form?


    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 01-26-2006 07:34 PM In reply to

    Re: Problem with Insert Update

    Yes I am the author. I made a couple changes for the better.
    I used one form and multiple views.

    If I understand it correctly, Infopath will create an update if you have queried a row and do an insert if there is no row. So my goal now is when the user enters the Date and Meeting shift the Query fields will be set with that info and the DB will be queried. If there is a row(s)the data will be returned.

    Two questions come out of that though:
    (1) What is the best way to trigger the query (I have it set to trigger when the fields are not blank, but that will not capture an on change event)

    (2) If there is not a row the section I am trying to query gets removed and you have to reenter the key info afer inserting a section.

    Does this sound correct?
    Any help would be great.
    Thanks again
  • 01-27-2006 12:27 AM In reply to

    Re: Problem with Insert Update

    Hi again,
    1) OnAfterChange is good. You can filter in the OnAfterChange event handler for insert or update or delete.
    2) So just filter out remove. There's an example in the SDK and in Chapter 2 of our book.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 01-27-2006 09:16 AM In reply to

    Re: Problem with Insert Update

    Patrick can either of these solutions be handled with rules, or are they only accomplished with programing
  • 01-27-2006 10:29 AM In reply to

    Re: Problem with Insert Update

    Yes, rules work well. Sorry, I should have mentioned that too. :)`


    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 01-27-2006 10:48 AM In reply to

    Re: Problem with Insert Update

    I am not sure I follow how to use an OnChange Event style Rule. Or how to use Filtering in rules - is tehr ean example?
  • 01-27-2006 02:09 PM In reply to

    Re: Problem with Insert Update

    In the InfoPath designer, double click the field that you want to use as the "trigger". Click Rules on the Properties dialog and then click Add. Enter a name for your rule. Leave the Condition as "None" (always applies). Add an Action to Set a Field's Value. Click the field chooser and select the field that you want to change when this one changes. Then add a value. The value can be an xpath based on the first field or a filter using it, etc. Hope this helps!

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 01-27-2006 04:59 PM In reply to

    Re: Problem with Insert Update

    Patrick - one more question before I beat this totally into the ground - You said earlier: "2) So just filter out remove. There's an example in the SDK and in Chapter 2 of our book."

    Do you filter out the "remove" with a rule? I am looking into the SDK and don'r see it yet (FYI your book was 2-4 weeks delivery from Amazon)
  • 01-28-2006 01:02 AM In reply to

    Re: Problem with Insert Update

    Hi Grizeen,
    I'm sorry Amazon is so lame on the delivery. No idea. Anyway, great question. The rules themselves don't filter Remove, Insert and Update. They always fire on all of these. If you need to filter out Remove, you will need to write some code, which means an OnAfterChange handler.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 01-28-2006 06:46 AM In reply to

    Re: Problem with Insert Update

    Thanks Patrick - I have the onchange working and will get the filter remove working - looking for the SDK example now
  • 01-28-2006 04:26 PM In reply to

    Re: Problem with Insert Update

    Patrick - i am having trouble finding the example of the filtering of the remove in the SDK - I am new to jscript and and programming in Infopath, so the example is sorely needed. Can you point out what part of the SDK contains it? Sorry again

    Thanks
  • 02-02-2006 06:43 PM In reply to

    Re: Problem with Insert Update

    Something like the VB.NET code below:

    If (e.Operation = "Remove") Then
    Return
    End If

    "e" is the eventObj.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 02-14-2006 03:13 AM In reply to

    • ahardin
    • Top 200 Contributor
    • Joined on 02-13-2006
    • United Kingdom
    • Posts 55

    Re: Problem with Insert Update

    Infopath uses a username and password to access the SQL database so it needs to have been told both of these to access it.

    Don't know if i understand the question properly but hope this helps
    I'm from WALES
    [email protected]
Page 1 of 1 (14 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.