PDA

View Full Version : Solved: Outlook forms and validation



Rico
09-12-2005, 11:47 AM
Hi all



I am working on a small outlook form, and I would like Outlook to validate if a specific textbox are empty or not when the user presses on the Send button.



I tried to use the validation under properties for the textbox, but it doesn?t set focus on the textbox that is empty, it just says that something is missing.



I like code to do something like this when the ?Item_Send? is used



if textbox1.value="" then
msgbox bla.
textbox1.setfocus
end if



I am totally new in creating customs form with VBS, so any help is fine

Regards Rico

Norie
09-12-2005, 11:55 AM
Rico

Have you tried that code?

It's basically correct and should go in the send button's click event.

If you double click the send button then you should get the click event.

By the way what validation for the textbox do you mean?

Rico
09-13-2005, 01:18 PM
Hi Norie

I found a solution which look like this


Function Item_Write()

Set objPage = Item.GetInspector.ModifiedFormPages("Message")
Set objControl = objPage.Controls("MyTextBoxs")

If objPage.Controls("MyTextBoxs") = "" Then
Item_Write = False
MsgBox "Please insert text in MyTextbox."
ObjControl.SetFocus
End If

End Function


Sorry If my english is a bit rusty :-)
With validation I meant, when you rigth click on a textboxs and choose Properties (Edit mode for the form) here you can set some validation properties.

Regards Rico