View Single Post
 
Old 06-29-2013, 01:13 PM
lms lms is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Jun 2013
Posts: 9
lms is on a distinguished road
Default

In the form of the Contact, the first combobox that I want to get the value from to the Textbox in the Task form where the Task is assigned to the contact, has the Display Name: "ComboBox7" and the Field that was created relative to ComboBox7, is: "Advisory Area"

And the Textbox in the form of the Taskform, is “Textbox20” and not with any field as a part of it.

Here is the code I was given. I put it in a new Module and created the commandbotton to it in the form of the contacts, then I ran it from a contact I opened.

Sub CommandButton1_Click()
Dim Str
Dim myItem
Str =Item.GetInspector.ModifiedFormPages("General").Co ntrols("ComboBox7").Value
Set myItem =Application.CreateItemFromTemplate("C:\Users\Loui s\AppData\Roaming\Microsoft\Templates\TaskFollow-Up Template.oft")
myItem.Display
myItem.GetInspector.ModifiedFormPages("P.2").Contr ols("TextBox20").Value= Str
'MsgBox Str
End Sub

And the debug shows up with the yellow color on the line: “Str =Item.GetInspector.ModifiedFormPages("General" ).Controls("ComboBox7").Value” and error is:

"Run Time Error 424
Object Required"

I read thru the above code I was given and it seems that it basically is that the "myitem" is the Task template and the TextBox20 which is a part of the "P.2" of the Task form, gets its value from the "Str".

So is there a way, to refer to the Value of the ComboBox7 in the "Str" so it goes to the "myitem" TextBox20 area when you run the macro creating a Task asssigned to the contact you opened?
Reply With Quote