hide command button

  • Thread starter Thread starter Denise
  • Start date Start date
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
 
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
 
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
 
Back
Top