form events, fields and visible labels

G

Guest

Hello again :)

I created a query, with the field [Name] and [birthdate].
Then i created a continous form based on that query.
On the form the [Name] field and the [birthdate] field are
side by side. Then next to the [birthdate] is a label named "MissingLabel"
with a caption that reads all in red "MISSING".

As you might guess, id like the label to be visible
when the [birthdate] is blank. And Conversely,
id like the label hidden when there is infact a birthdate.

So, On the forms current event i put;

if isNull([birthdate]) then
me.missinglabel.visible = true
else
me.missinglabel.visible = false
end if

but that didnt work, so i tried;

if isEmpty([birthdate]) then
me.missinglabel.visible = true
else
me.missinglabel.visible = false
end if

nor did that work, so i tried;

if ([birthdate]) = "" then
me.missinglabel.visible = true
else
me.missinglabel.visible = false
end if

but that didnt work along with 10 other variations i also tried.
But Perhaps im putting it in the wrong Form Event?
Or am i reffering to the field incorrectly?

It all seemed so simple a while ago, cause
im sure i did something smilar.

Cheers,
Jeff
 
W

Wolfgang Kais

Hello WebDude (Jeff).

WebDude said:
I created a query, with the field [Name] and [birthdate].
Then i created a continous form based on that query.
On the form the [Name] field and the [birthdate] field are
side by side. Then next to the [birthdate] is a label named
"MissingLabel" with a caption that reads all in red "MISSING".

As you might guess, id like the label to be visible
when the [birthdate] is blank. And Conversely,
id like the label hidden when there is infact a birthdate.

So, On the forms current event i put;

The forms current event is fired when any record becomes the current
record, so your procedure will only be run when you switch to
another record.
if isNull([birthdate]) then
me.missinglabel.visible = true
else
me.missinglabel.visible = false
end if

Or short: Me.MissingLabel.Visible = IsNull([birthdate])
[...]
But Perhaps im putting it in the wrong Form Event?
Or am i reffering to the field incorrectly?

When changing a property of a contol in the details section, this
affects all records in the continous form.
Change the label to a textbox (visible) and format the textbox
(disabled, transparent, no border...).
Set the ControlSource property to a calculated expression like:
=Iif(IsNull([birthdate], "MISSING", "")
 

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