Verifying fields

L

lisa

I am trying to write code, so that when the person clicks on "save and
close" (on the form), it will check whether specific fields are filled
in. If they are filled in, I want the form to be sent to an email
account. Can someone offer some advice? This is what I have so
far....(right now I have the validation under a command button that I
created...I want to remove this button).


Sub Save_Click()
If IsOkToSend()Then
Set objForward= Item.Forward
objForward.To= "[email protected]"
objForward.Subject= Item.Subject
ObjForward.Body= Item.Body
ObjForward.Send
End If
End Sub

Function IsOkToSend()
If Item.UserProperties("name")="" Then
Msgbox "Please Enter Name"
IsOkToSend= False
Exit Function
End If

If Item.UserProperties("Date")= "" Then
Msgbox "Please Enter RFP Due Date"
IsOkToSend= False
Exit Function
End If

IsOkToSend= True
End Function

Thank you very much!


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Top