form field question

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.
 
B

Beetle

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
 
F

fredg

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])
 

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