Only view label on form if text box is not null

wwiSports

New member
Local time
Yesterday, 23:34
Joined
Jul 15, 2002
Messages
7
I have two forms, one is the "Orders" form and the other is the "Notes" form. I have put a lable called lblSeeNotes on the Orders form and set it's visible property to No. I have also put a text box called "Notes1" that is based on the notes form and set it's visible property to no. I have put in the Form_Load code the following code:

If Me.Notes1 Is Null Then
Me.lblSeeNotes.Visible = False
Else
Me.lblSeeNotes.Visible = True
End If

Now I get a message saying "Object not found" and highlighting the "If Me.Notes1 Is Null Then" section of the code above. I am assuming that this is because it's visible property is set to no.

Both of the above forms are totally unbound, and everything is done by vba. Both forms also refer to the "Athlete" table.

Can someone help me fix my code???

My utltimate goal is to have this label ****SEE NOTES**** appear if the notes field has something in it.
 
Beth,

There's a few ways of doing this, but the quickest way is to remove the Is Null bit and check for the empty string instead

If Me.Notes1 = "" Then
etc ....

I'm pretty sure this should do it.

Rich
 
If isnull(Me!Notes1) Then
Me!lblSeeNotes.Visible = False
Else
Me!lblSeeNotes.Visible = True
End If
 
You need to move the code (the last syntax attempt is correct) to the form's Current event so that it executes every time a new record is accessed.

However, even if you hide the label, you haven't done anyting about the notes field. Do you really want a text box with no label that allows data entry?
 
I am having a problem. I changed the code to "", but this is the new issue:

1. lblSeeNotes is now showing up---but at all times--not just when the Notes1 field has something in it.

2. In order for that code to work, I had to put a text box called "notes1" on the form. When in all actuallity--the When you are in the "Orders" form, you should press F6 to open another form "Notes"--which is what I was wanting the lblSeeNotes to refer to--but since it is not open--I don't know how to refer to that.

I would like to delete the "Notes1" field on the Orders form, and set the lblSeeNotes to be visible if the form "Notes" as something it it's "Notes" field. Make sense?

How can I do this.

I can't believe I am having so much trouble with this little task.
 
I Got it working!!!!!!


I put the code:

If IsNull(Me.Notes1) Then
Me.lblSeeNotes.Visible = False
Else
Me.lblSeeNotes.Visible = True
End If

In the On Current Event as well as my "PopulateFields" code since the form is unbound, and now it operates correctly. Unfortunantly there is still a field on the form called Notes1, but I set it's visible property to No so it can not be seen.

Thanks for everyone's help on this one...now if I can just figure out the answer to my other question Subject: Text Boxes on Form show time, Should be blank.
 

Users who are viewing this thread

Back
Top Bottom