H
Hugh self taught
Hi Guys & Gals with knowledge to help,
Below is a portion of code from my emailing form which I'm trying to build
some error prevention bits into.
At the .Subject= & or the .Body= statements I get an error "Run Time Error
94" "Invalid use of Null" & I can't figure out why it's not being trapped at
the If Me![Subject] = "" Then statement. I had it as If Me![Subject] = Null
Then with the same problem. If the fields are not blank then it runs through
fine but if I leave either blank then error.....
Set appOutlookRecip = .Recipients.Add(eMailAddress)
appOutlookRecip.Type = olTo 'Sets message to normal outgoing
e-mail message.
' Fill in the Subject line and main body of message.
If Me![Subject] = "" Then
MsgBox (" Subject cannot be blank ") & vbCrLf & vbCrLf & _
Me!Subject.SetFocus
End If
If Me![MessageBody] = "" Then
MsgBox (" Message is empty ") & vbCrLf & vbCrLf & _
Me!MessageBody.SetFocus
End If
.Subject = Me![Subject] 'Fill in the subject line.
.Body = Me![MessageBody] 'Fill in the message body.
Below is a portion of code from my emailing form which I'm trying to build
some error prevention bits into.
At the .Subject= & or the .Body= statements I get an error "Run Time Error
94" "Invalid use of Null" & I can't figure out why it's not being trapped at
the If Me![Subject] = "" Then statement. I had it as If Me![Subject] = Null
Then with the same problem. If the fields are not blank then it runs through
fine but if I leave either blank then error.....
Set appOutlookRecip = .Recipients.Add(eMailAddress)
appOutlookRecip.Type = olTo 'Sets message to normal outgoing
e-mail message.
' Fill in the Subject line and main body of message.
If Me![Subject] = "" Then
MsgBox (" Subject cannot be blank ") & vbCrLf & vbCrLf & _
Me!Subject.SetFocus
End If
If Me![MessageBody] = "" Then
MsgBox (" Message is empty ") & vbCrLf & vbCrLf & _
Me!MessageBody.SetFocus
End If
.Subject = Me![Subject] 'Fill in the subject line.
.Body = Me![MessageBody] 'Fill in the message body.