Database Access through infopath..... please help! - InfoPath Dev
in

InfoPath Dev

Database Access through infopath..... please help!

Last post 08-25-2005 04:23 PM by Shanthi Reddy. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 11-23-2004 09:23 PM

    • dominic
    • Not Ranked
    • Joined on 11-24-2004
    • Australia
    • Posts 8

    Database Access through infopath..... please help!

    To anyone who may be able to help.

    I have just started using infopath as part of an adhoc request system.

    The process is as follows: the user registers a request by filling in a form I have created in infopath and the subsequent details are written to an access database using the submit button functionality. However, the primary key, or the unique Identifier of that particular record or adhoc request (as the user sees it) is not updated in the database until he/she clicks "submit".

    In the mean time another two users may have aquired the same unique Identifier (this is a problem because the next unique indentifier will be created by simply incrementing the max record number in the primary key of the database by 1, which is fine with one user at a time) because the first user has not submitted, and therefore not updated the database, subsequent users keep getting the same unique ID (number) for their request (the same highest number plus one..). then they hit submit at different times and will all have the same unique key, because the key is not updated in the database as soon as the user opens the form.

    Essentially I cannot allow concurrent access at the moment without ending up with duplicate keys.

    What I was wanting to know (and have been trying to figure out for a good while now) is how I can write a script perhaps that will allow the primary key to be updated, in the database, when the user opens the form as opposed to when they hit the submit button, and then after when they do hit the submit button the same record is updated with the information they have filled in.

    How do I update a SINGLE field in my access database (with infopath), without submitting the whole form? how do I reference the field in the database(not the xml schema xpath, which I think refers to the form fields? or is xpath the database reference????) so that as soon as the user opens the form, the unique value of their form is automatically written to the database, and therefore stopping another user from getting the same value when they open up another form, at the same time (before the other user has submitted).

    Essentially I need a way, or an object that allows me update/write access to the individual fields in my database on the "openevent" of my form.

    If anyone has any advice with regard to this it would be much appreciated.
  • 03-28-2005 10:35 AM In reply to

    Re: Database Access through infopath..... please help!

    One way of solving this problem is to use GUID's instead of incrementing the max record number in the primary key of the database by 1. A GUID is always unique.

    Shanthi
    InfoPathDev India
    Shanthi Reddy
  • 06-08-2005 09:23 AM In reply to

    • Sue
    • Not Ranked
    • Joined on 06-08-2005
    • United Kingdom
    • Posts 2

    Re: Database Access through infopath..... please help!

    quote:
    Originally posted by Shanthi

    One way of solving this problem is to use GUID's instead of incrementing the max record number in the primary key of the database by 1. A GUID is always unique.

    Shanthi
    InfoPathDev India



    still learning
  • 06-08-2005 09:31 AM In reply to

    • Sue
    • Not Ranked
    • Joined on 06-08-2005
    • United Kingdom
    • Posts 2

    Re: Database Access through infopath..... please help!

    Not sure what happned there!

    I used to have the same problem a long time ago and managed by making the id the very last item before submission.

    Might be too simple an idea because I don't know how your users actually obtain the id. Could also make the field an autonumber field in the access table - then the users don't have to input anything?

    Guids work best but can also be a pain.

    still learning
  • 06-12-2005 04:24 AM In reply to

    Re: Database Access through infopath..... please help!

    I don't know much about Access but something similar to Identity column in SQL will also work. This way the primary key is autogenerated.

    I personally like Guids because they are useful to have in various contexts like for file names if we want to autogenerate file names while saving files. Also in C# it is easy to generate and use it.

    Shanthi
    InfoPathDev India
    Shanthi Reddy
  • 08-24-2005 08:20 PM In reply to

    • dominic
    • Not Ranked
    • Joined on 11-24-2004
    • Australia
    • Posts 8

    Re: Database Access through infopath..... please help!

    I figured this out some time ago, and yes I was simply making the submission/ ID aquisition occur last thing (ID is auto-generated in the jscript code in infopath). There is still a danger period, e.g. the actual time it takes to submit the record to the database, in this period you could have people submitting who picked up the same ID, but it doesn't happen often (people would have to submit within a couple seconds of each other)and I have error handling code to stop duplicates occuring if it does. Thanks for your responses guys.
  • 08-25-2005 04:23 PM In reply to

    Re: Database Access through infopath..... please help!

    I was looking at Access recently and it has a same option as SQL identity column which is called Auto Number here. This can also be used.

    Shanthi
    InfoPath Dev India
    Shanthi Reddy
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.