Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / January 2007

Tip: Looking for answers? Try searching our database.

Newbie:Accessing form controll from vbscript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter - 18 Dec 2006 12:24 GMT
Hi,

I have look high and low on this one, but no luck so far :-(

I have a form with a repeating table connected to a SQL Server
database. On this repeating table, I have  a textbox called 'Name'.
>From VBScript, I want to retrieve the value (or text) typed into this
textbox and put it in a variable called vName. How is this done?

I've tried many combinations now, but nothing has worked.

TIA
Ben Walters - 19 Dec 2006 01:44 GMT
Hey Peter,
InfoPath is a data driven development environment not an object oriented
development. So rather than looking for a control to get your information
out of e.g. TextBox1.Text you would retrieve the xml node that holds the
data e.g.
if you had a form with the following structure

<root>
<name></name>
</root>

You would attempt to return the name node and get it's contents.
how you do this differes slightly from IP2003 to IP2007

In InfoPath 2003 you use the MSXML based object model to access you data so
retrieving your name node would look something like this

this.XDocument.DOM.SelectSingleNode("/name").text

In InfoPath 2007 the object model has been moved to a .net based xml
structure so retrieving your name node would look like this

XPathNavigator myNavigator = this.CreateNavigator();

myNavigator.SelectSingleNode("/name",NamespaceManager).Value

Hope this helps
Cheers
Ben

> Hi,
>
[quoted text clipped - 8 lines]
>
> TIA
MOT - 19 Dec 2006 08:31 GMT
Hi. Thanks for your help :-)

If I do this:

Dim vName
vName = this.XDocument.DOM.SelectSingleNode("NAME").text

I get this: Object required 'this'

If I remove 'this' I get: Object required
'XDocument.DOM.SelectSingleNode(...)'

I also tried adding the 'set' keyword in front, but it gave me the same
error. If I double click the textbox, the Field name says "NAME", so I
should be using the correct name for the textbox. Any suggestions?

I'm using InfoPath 2003 SP2

TIA
/Peter

Ben Walters skrev:
> Hey Peter,
> InfoPath is a data driven development environment not an object oriented
[quoted text clipped - 38 lines]
> >
> > TIA
Peter - 19 Dec 2006 08:42 GMT
Hi. Thanks for your help :-)

If I do this:

Dim vName
vName = this.XDocument.DOM.SelectSingleNode("/NAME").text

I get this: Object required 'this'

If I remove 'this' I get: Object required
'XDocument.DOM.SelectSingleNode(...)'

I also tried adding the 'set' keyword in front, but it gave me the same
error. And I tried with "NAME" (without the slash in front). Same
error. If I double click the textbox, the Field name says "NAME", so I
should be using the correct name for the textbox.

In "Data source" I have:

myFields
   dataFields
       d:Cust
           :NAME

Any suggestions?

I'm using InfoPath 2003 SP2

TIA
/Peter

Ben Walters skrev:
> Hey Peter,
> InfoPath is a data driven development environment not an object oriented
[quoted text clipped - 38 lines]
> >
> > TIA
Ben Walters - 19 Dec 2006 21:51 GMT
Sorry Peter the code I provided was for C# not VB,

for vb you want to replace this with Me

Cheers

> Hi. Thanks for your help :-)
>
[quoted text clipped - 71 lines]
>> >
>> > TIA
Ben Walters - 19 Dec 2006 21:53 GMT
Hey Peter,
My last post may not have come through so sorry if this is repeated
the code I provided was for C# not Visual Basic, so you'll have to replace
"this" with "Me"

let me know how you go

Cheers
Ben

> Hi. Thanks for your help :-)
>
[quoted text clipped - 71 lines]
>> >
>> > TIA
Peter - 20 Dec 2006 08:11 GMT
Hello Ben, Thanks again for your reply :-)

With Me instead of this, I get:

Object doesn't support this property or method: 'Me.XDocument'

Any suggestions?

TIA
/Peter

Ben Walters skrev:
> Hey Peter,
> My last post may not have come through so sorry if this is repeated
[quoted text clipped - 81 lines]
> >> >
> >> > TIA
Ben Walters - 20 Dec 2006 22:53 GMT
Hey Peter
I don't have InfoPath 2003 installed on my machine at the moment, but I do
have an environment at home to check out.

In the interim you could try accessing the XDocument object via e.Xdocument
the e variable is passed on the event of your control

Hope this helps

Cheers
Ben

> Hello Ben, Thanks again for your reply :-)
>
[quoted text clipped - 99 lines]
>> >> >
>> >> > TIA
radhika.kashetti@gmail.com - 04 Jan 2007 14:15 GMT
> Hey Peter
> I don't have InfoPath 2003 installed on my machine at the moment, but I do
[quoted text clipped - 111 lines]
> >> >> >
> >> >> > TIA
radhika.kashetti@gmail.com - 04 Jan 2007 14:19 GMT
Hi Peter,

No need to mention me or this in front of XDocument.... u just remove
those and try....
if u want to retrieve the data from a text box of repeating table u
just do as follow
in vbscript
dim vName
vName = XDocument.DOM.selectSingleNode("the XPath of that
textbox").text
by this u will get the data of textbox into vName...
Try this....

> Hey Peter
> I don't have InfoPath 2003 installed on my machine at the moment, but I do
[quoted text clipped - 111 lines]
> >> >> >
> >> >> > TIA
radhika.kashetti@gmail.com - 04 Jan 2007 14:21 GMT
> Hey Peter
> I don't have InfoPath 2003 installed on my machine at the moment, but I do
[quoted text clipped - 111 lines]
> >> >> >
> >> >> > TIA
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.