PDA

View Full Version : Refresh text box code



lms
07-04-2013, 06:44 PM
I have a code which I will show below that is put in the View Code/Script Editor of the form of the Contact. It creates a Task and puts in the TextBoxes of the Task form, the Values from the ComboBoxes or TextBoxes from the Contact that the Task is created from. So in the form of the Contact, there is the new CommandButton4 that when I click on in the Contact, it creates the Task and the brings the Values from the ComboBoxes or TextBoxes from the Contact that the Task is created from to the TextBoxes in the Task created.

In addition, it automatically links the contact from where I am clicking on the CommandButton4 to the Task as an Assigned Task.


So what I need please is how to add to the code or create another code (and where to put it) that after a Task is created per this process, and I later change a value in a ComboBox or TextBox of the Contact that gets assigned to the Task, how can it upgrade the TextBox(s) of the Task with the current Value?


Here is the Code that is working, how it is drafted, and it is put in the View Code/Script Editor of the form of the Contact, and the Contact form is published in the normal way.

Thanks very much.

Sub CommandButton4_Click
Dim Str,Str1,
Dim myItem

Str = Item.GetInspector.ModifiedFormPages("General").Con trols("ComboBox7").Value
Str1 = Item.GetInspector.ModifiedFormPages("General").Con trols("ComboBox8").Value
Set myItem = Application.CreateItemFromTemplate ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\Task Follow-Up.oft")
myItem.Display
myItem.GetInspector.ModifiedFormPages("P.2").Controls("TextBox20").Value = Str
myItem.GetInspector.ModifiedFormPages("P.2").Controls("TextBox7").Value = Str1


myItem.Links.Add Item

End Sub

This code is working by drafting it this way:

In the contact form, there is the new CommandButton4.

In the Str lines, each line refers to a ComboBox in the form of the Contact, and the ( ) area after "Controls" is the Display Name of the the Combobox.

The Set myItem line, refers to the the form of the Task form that I added the Textboxes to, and saved to my template area.

In the myItem line, the ("P.2") refers to the Page 2 of the Task form, and the the area ( ) after Controls is the Display Name of the TextBox that is to get the Value from the particular ComboBox of a Str line.

And when I created the Task P.2 area, that's where I put in the TextBox(s) and I created a new field for each one so it is stored.

bradely
07-07-2013, 09:29 PM
Thanks for the great information that you provided to us and it is very useful for me because I also not know how to to refresh the code but after reading this post I can easily refresh the code and manage our work. :)

lms
07-07-2013, 09:40 PM
Thanks. So you will create a code that refreshes the textbox from the combobox?? And describe where to put it? And if so, how soon as I have alot to refresh. Thanks much. I appreciate it very much.

lms
07-18-2013, 04:31 PM
Any update on the code update please?

lms
07-19-2013, 07:15 PM
I have another thought that might make this easy. Since the code I use is in script of the Contact and shows which fields of the text boxes in the Task get words from the other fields in the contact that the task is created from, how can we just adjust that code and put it in the Task script and have the code/macro recognize the fields of the contact that is assigned to the Task and just update the Task fields using another CommandButton in the Task script. The code in the script of the Contact is:
Sub CommandButton4_Click
Dim Str,Str1,
Dim myItem

Str = Item.GetInspector.ModifiedFormPages("General").Con trols("ComboBox7").Value
Str1 = Item.GetInspector.ModifiedFormPages("General").Con trols("ComboBox8").Value
Set myItem = Application.CreateItemFromTemplate ("C:\Users\Stoler Law\AppData\Roaming\Microsoft\Templates\Task Follow-Up.oft")
myItem.Display
myItem.GetInspector.ModifiedFormPages("P.2").Contr ols("TextBox20").Value = Str
myItem.GetInspector.ModifiedFormPages("P.2").Contr ols("TextBox7").Value = Str1
myItem.Links.Add Item

End Sub