For example, I want to view a report called "MyReport" ONLY if "MyField" is
NOT Null:
Sub MyButton_OnClick()
If NOT IsNull([MyField]) Then
DoCmd.OpenReport "MyReport", acViewPreview
End If
End Sub
In the above example, if MyField is Null nothing will happen. Without an
Else clause, the code will simply continue to the next line, in this case,
End Sub
If I want it to open "MyReport if the field IS Null:
Sub MyButton_OnClick()
If IsNull([MyField]) Then
DoCmd.OpenReport "MyReport", acViewPreview
End If
End Sub
Perhaps that is clearer...
Jeff Boyce said:
Pardon my intrusion...
SusanV provided an example of how you could do that.
If you only wish to do something when YourField is not null, put that
thing
you want to do after the "Else" statement.
--
Regards
Jeff Boyce
<Office/Access MVP>
Secret Squirrel said:
Hi Susan,
I understand that part but if I only want to do something if there is
data
how do I write that? If it's null then I don't want it to do anything. Only
if it's not null.
SusanV said:
If IsNull([YourField] Then
'do something
else
'do something else
end if
--
hth,
SusanV
message I'm trying to write an "If" statement using the "IsNull" function but I'm
stuck on how to write this. What I'm trying to do is write this code to
say
if a field is blank do nothing and if a field has data then do the
"SendObject" function. This is being put in the "AfterUpdate" event
on a
certain field.