Make fields editable through VB code - InfoPath Dev
in

InfoPath Dev

Make fields editable through VB code

Last post 02-23-2015 07:03 AM by MHemmings. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-13-2015 04:57 AM

    Make fields editable through VB code

    Hello

     I have an InfoPath 2010 Form that has some VB code behind it (written using Visual Studio 2005), that is connecting to a database held on a machine running SQL Server 2008r2.

     I want to be able to force fields in the InfoPath Form to be editable or not, but haven't found the code to be able to do this yet (I have done a fair amount of looking as well).

    I can refresh the data connection very easily:

    Me.DataConnections("Main connection").Execute()

    However this isn't making the fields editable when I need them to be.

     

    Any help with this would be greatly appreciated.

    M 

     

     

    Filed under: ,
  • 02-16-2015 12:37 AM In reply to

    Re: Make fields editable through VB code

     Hello again

    Any chance anyone has had a flash of inspiration with regards this? I have an InfoPath project at work that I am hoping to complete this week...

     Thanks, M 

  • 02-16-2015 07:52 AM In reply to

    Re: Make fields editable through VB code

    Hi - I saw this last week, but wasn't sure how to reply - I'm not sure what you mean by making the fields editable. Are they currently not when you open the form? I mean, we often add a helper field of some kind (like, a true / false named Locked or some such) and then use form logic to set that, then add conditional formatting to the controls to make them read only when Locked = true - but I'm not sure that is what you are describing.

    Hilary Stoupa

  • 02-17-2015 02:32 AM In reply to

    Re: Make fields editable through VB code

     Thank you for getting back to me Hilary.

    My form is essentially the front-end for a table held on SQL Server. When you search for a User ID that doesn't exist (the User ID field is the only Query Field on the form, the rest are Data Fields) all the Data Fields become greyed out and un-selectable.

     I'm just looking for a way to force these fields to be editable.

    M 

  • 02-17-2015 08:21 AM In reply to

    Re: Make fields editable through VB code

    How odd - I tried a little test form and when my query returned no data, I could just click the "insert" widget on the form and it inserted a new blank item for me to fill out - Are the data fields in your main DS in a repeating group?

    Hilary Stoupa

  • 02-23-2015 07:03 AM In reply to

    Re: Make fields editable through VB code

    Hi Hilary, thank you for getting back to me. In the end I've solved the problem through good old trial and error (frankly through a huge amount of guesswork).

    Essentially I have a clear button that's forcing every field to be 'something' with this:

    root.SelectSingleNode("/dfs:myFields/...", Me.NamespaceManager).SetValue("")

     M

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