hide command button

D

Denise

Hello,

I have a subform [frmClient].[subfrmAssess] that contains
a button [cmdOpenPop] that I only want to show when there
is data in a date field [txtDate]. I have the following
code in the 'after update' command of txtDate:

if me.txtdate is not null then
me.subfrmAssess.cmdOpenPop.visible = true
else
me.subfrmAssess.cmdOpenPop.visible = false
end if

This is not working....can someone help me please? I
also want the button to hide again if someone removes
data from txtDate.

Thanks!

Denise
 
R

Rick B

Well, if you wish it to look at the records as you scroll through them, then
"after update" will only work if the date is changed each time you move to a
new record.

A better solution would be to put your code into the "on current" event of
your form. this code fires as you move from one record to another.

Now, that is how it works on a form. I am not sure if the same will be true
on your subform. I am pretty sure that you will NOT be able to do this on a
continuous form, if that is what you have.

Rick B


Hello,

I have a subform [frmClient].[subfrmAssess] that contains
a button [cmdOpenPop] that I only want to show when there
is data in a date field [txtDate]. I have the following
code in the 'after update' command of txtDate:

if me.txtdate is not null then
me.subfrmAssess.cmdOpenPop.visible = true
else
me.subfrmAssess.cmdOpenPop.visible = false
end if

This is not working....can someone help me please? I
also want the button to hide again if someone removes
data from txtDate.

Thanks!

Denise
 
R

Reggie

If you want to keep it the way you have it then you need to change your
comparison operation. Comparing anything to null will always be false. Try
this:

If Not IsNull(me.txtdate) Then
me.subfrmAssess.cmdOpenPop.visible = true
else
me.subfrmAssess.cmdOpenPop.visible = false
end if
 

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

Similar Threads


Top