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= "(e-mail address removed)"
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top