in

InfoPath Dev

submit button unable to write into database table

Last post 07-11-2008 07:41 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-10-2008 07:56 PM

    • w2ngme
    • Not Ranked
      Female
    • Joined on 07-11-2008
    • Posts 2

    submit button unable to write into database table

    I'm very new with info path. This the first time I'm using info path 2003 to create a form. I create a form for user to lodge services issue. I linked the form to a data source and bind each field in the form with its represent field on database (Microsoft access, table). When user submit the form, will send a copy of the form via e-mail to user and write/add it into the table. 

    Problem 1: not sure how to add new records into the table

    Problem 2: The copy of the form to user included the buttons form. Anyway after submitting the form the submit button is not included in the attachment? Or even better is there away to send just the contains of the form as e-mail contain rather then as an attachment?

    thanks.

  • 07-10-2008 09:03 PM In reply to

    Re: submit button unable to write into database table

    Hello and welcome!

    For problem 1, in order to submit to Access, you need to have based the form off the database when you initially designed it. If you did that, and the controls on the form are bound to the fields in the datafields group in the main data source, you should be able to submit to your table, which will add new records.

    For problem 2, you can add another field, a Boolean, called isSubmitted. You can add a rule to your submit button to set isSubmitted to true when the button is clicked. You can set conditional formatting on your button to hide if if isSubmitted is true. InfoPath 2007 has the option when you set up email submit to either attach the form or just include the contents, but I don't recall if that was available in 2003.

    Hope this helps, if it isn't clear enough or you need further help, let me know, okay?

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-11-2008 01:09 AM In reply to

    • w2ngme
    • Not Ranked
      Female
    • Joined on 07-11-2008
    • Posts 2

    Re: submit button unable to write into database table

    Thanks for the quick reply.

    Sorry I'm not very good at this. Do mean

    Problem 1: At the button properties i change the action to new record?  I have only one button label as submit. When it's click it will write to the database and also send a copy of the form to the user as comfirmation.

    Problem 2: issubmitted an extra field in my DB OR a field i should declare in the function submit::OnClick(eventObj)?!? where would i fid this hide

    Am not to good at coding. any refrence.

    Thanks.

  • 07-11-2008 07:41 AM In reply to

    Re: submit button unable to write into database table

    Hello:

    No, I don't think anything you are doing will require code. First, let's add that field.

    1. Change your task pane to display the Data Source task pane
    2. Select the main data source
    3. Right click the root folder (probably myFields)
    4. Select Add
    5. Name the field isSubmitted (or another name, if you like)
    6. Change the Data type  to True/false (boolean)
    7. Select OK

    Now you have another field that you can use to know whether the form has been submitted. Next, let's set some rules.

    1. Right click the button you are using for submitting
    2. Change the Action to Submit
    3. Select the Submit Options button
    4. Select Perform custom action using Rules
    5. Select the Rules button
    6. Select the Add button
    7. Give your Rule a meaningful name, like "Submit to database"
    8. Select Add Action ...
    9. Change the action to Submit using a data connection
    10. Make sure the data connection is your main data connection
    11. Select OK
    12. Select OK  again

    This will set up the submission to the database. Next, we'll set a rule to set the value of isSubmitted.

    1. Select the Add button again to add another rule
    2. Give your rule a meaningful name, like "Set isSubmitted"
    3. Select Add Action ...
    4. Change the action to Set a field's value
    5. Select your isSubmitted field in the field area
    6. Type the word true in the value area
    7. Select OK
    8. Select OK again

    Finally, we add the rule for email submission. All of these actions could have been added to a single rule, but sometimes when you are new, it is easier to only have a single action in every rule. That way if something doesn't work the way you anticipate, you can deselect different rules to track down the problem. So, to submit our form to email:

    1. Select the Add button again to add another rule
    2. Give your rule a meaningful name, like "Send email"
    3. Select Add Action ...
    4. Change the action to Submit using a data connection
    5. Make sure the data connection is your email submit connection
    6. Select OK
    7. Select OK  again, and once more to close that window

    For the grand finale, we'll set that conditional formatting on the button.

    1. In the Button Properties, select the Display tab
    2. Select the Conditional Formatting  button
    3. Select the Add button
    4. In the first dropdown, select your isSubmitted field
    5. The second dropdown should say "Is equal to"
    6. In the third dropdown, select Type text
    7. Type in true
    8. Select the Hide this control checkbox

     

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (4 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.