form field question

  • Thread starter Thread starter Cardinal
  • Start date Start date
C

Cardinal

I have a standard form and one of the fields on the form is
"Comments." If someone did not provide a comment, I would like to
display the words "No comment provided." Is there a way to do this
from the field's Property window? Many thanks.
 
First, as a point of information, forms and reports have controls,
tables and queries have fields. This may seem nit-picky, but correct
terminology can be important when asking questions in the newsgroup.

On to your question, you would use some code in the Before Update
event of your *form* (not the Before Update event of the text box
control). Example code below;

Private Sub Form_BeforeUpdate ()

If Nz(Me!Comments, "")="" Then
Me!Comments = "No comment provided"
End If

End Sub
 
I have a standard form and one of the fields on the form is
"Comments." If someone did not provide a comment, I would like to
display the words "No comment provided." Is there a way to do this
from the field's Property window? Many thanks.

Display those words where? In a report?

Use an unbound text control.
Set it's control source to:

=IIf(IsNull([MemoField]),"No comment provided",[MemoField])
 
Back
Top