View Single Post
  #3  
Old October 13th 08, 01:23 PM posted to microsoft.public.outlook.program_forms
Gary Newport
external usenet poster
 
Posts: 19
Default Using Object Data in VBScript

I have used the property values set in design wherever possible but I need
things to change as the form is completed/sent.

I have now realised that I am using the textbox name, rather than the bound
name so have changed the one code to...

Function Item_Send()

dim mySubject
dim myStudent

Set mySubject = Subject
Set myStudent = Student
mySubject.Value = mySubject.Value & myStudent.Value

End Function

However, when I run this form I get the error:

Microsoft VBScript runtime error: Object required: '[string: "Round Robin
for "]'

Now the text given is contained within the bound field of Subject and this
appears as the stored property when I undertake a watch. So the object is
being recognised by the editor but not being transferred to the new set
variable mySubject.

Equally, Student is not receiving it's value, even though it has been
entered into the field.

I need this to update the Subject field just before being sent.

"Sue Mosher [MVP-Outlook]" wrote:

Control values are generally the wrong approach. Instead, use the property
values, e.g. Item.Subject. See http://www.outlookcode.com/article.aspx?ID=38
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54




"Gary Newport" wrote:

I have asked this elsewhere but thought it would be better as an identifiable
question...

How can I use the value of a textbox elsewhere (such as the subject textbox)
when sending the message?

Also, can I do the same to enable/disable a control?

Function Item_Send()

dim mySubject
dim myTextbox1

Set mySubject = txtSubject
Set myTextbox1 = txtTextbox1
mySubject.Value = "Round Robin for " & myTextbox1.Value

End Function

Ads