InfoPath 2007 - managed code, access database objects

I've recently begun working with InfoPath 2007 so my experience is limited.

I have a form built that uses one data connection to one table in a SQL database.  I've enabled Submit features on this form.  I also have all fields from the table being retreived by the data connection.

The situation is that I only want the user to enter necessary fields and not have to enter values for fields that are required by the database design, but really just store default values.

I'm planning on using VB.Net to code additional data submission logic into my Submit event handler.

I'd like if it's possible to add code that will update the values for these additional fields I don't want to force the user to enter these fields.  I thought about adding these fields to the form, making not visible, and applying default values, but would rather do in code if possible.

Thanks

JMO9966Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Clay FoxDirector of Business IntegrationCommented:
Well you do not have to make them visible to put defaults to them.

Either via code or via rule actions you can set the default of each field.  Some fields from data connections will not allow defaults directly but then you could also put a rule action on load or some other triggered event which set each field to what you want.

This is a common issue where there are housekeeping fields which are not relevant to the UI or the user but are required for a successful record submit.
0
JMO9966Author Commented:
Thanks,

If you have a code sample that does this type of work, that would be great.  I'd like to use code to explore more about the coding potential with InfoPath forms.
0
Clay FoxDirector of Business IntegrationCommented:
I don't do any more code in InfoPath than I have to, but I am sure there are samples to set values at www.infopathdev.com.

You would use Xdocument functions to access fields and values.

MSDN has a whole development document for InfoPath as well.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JMO9966Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
InfoPath

From novice to tech pro — start learning today.