Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook form: IsNewMessage acting weird

Status
Not open for further replies.

pho01

Programmer
Mar 17, 2003
218
US
I created a subroutine for an outlook form to check if it's a new message. The subroutine is as follows:

Function IsNewMessage()
On Error Resume Next
If Len(Trim(Item.EntryID)) > 0 Then
IsNewMessage = False
Else
IsNewMessage = True
End If
End Function

Then if it's a new message, there's a subroutine to send the notification to certain people, as follows:

Sub MailRequest()
If IsNewMessage = true then
Set myOLMailItem = Application.CreateItem(olMailItem)
With myOLMailItem
.To = "pho01@tek-tips.com"
.Subject = "Approval Request"
.Body = Item.UserProperties("rfReqNum").value & ";Owner;" &
Item.UserProperties("rfOwner").value
End With
myOLMailItem.Send
End If
End Sub

On the command button "send" on the form, I have

Sub Send_Click()
MailRequest
Item.Send
End Sub

When I click on the 'Send' button on the form, it always pops up a message: 'A field in this form requires a value'.
but when I take this line off the MailRequest Sub,
'If IsNewMessage = true then'
it sends mail okie.

Or with, or without the above line, if I click on the 'Send' Outlook button to send the form off, it appears to work ok. Anyone has keen eyes to see what happened with the above codes?

Weird thing is with 'If IsNewMessage = true then' in codes, even all fields are filled out, it stills pops up a message said "A field in this form requires a value", when I tried to hit the customized 'send' button on the form.

Thanks all!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top