Display only one overlapping control depending on date

  • Thread starter Thread starter Nick Mirro
  • Start date Start date
N

Nick Mirro

I have a small subform that shows in continous form mode (scrolling). There
are two fields overlapping and I'd like only one to show (be visible)
depending on the date. I tried this:


Private Sub Form_BeforeUpdate(Cancel As Integer)

If DateOfVisit < 8 / 1 / 3 Then

Me![ProviderNoteNEW].Visible = False
Me![ProviderNoteOld].Visible = True

End If

If DateOfVisit > 7 / 31 / 3 Then

Me![ProviderNoteNEW].Visible = True
Me![ProviderNoteOld].Visible = False

End If

End Sub



ProviderNoteNEW keeps showing on top of the other control despite date.
I've tried it several different ways. I later added this hoping to reset
the fields to visible but it doesn't seem to work:


Private Sub Form_AfterUpdate()

Me![ProviderNoteNEW].Visible = True
Me![ProviderNoteOld].Visible = True

End Sub
 
Hi Nick,

There are some things that you just can't do using continuous forms and this
is one of them. The problem is that even though they are repeated for each
row, there is really only one set of controls. Conditional formatting will
help you get around some of these obstacles but visible/Not Visible is not
one of the things you can alter using conditional formatting. Instead, you
can use CF to enable/disable the controls.
 
Or you could modify the code of your query to return only one field as
appropriate, which works if the intent of this display is
informational and not editing.

SELECT ID, ..., IIF([DateOfVisit] <= #7/31/03#, [ProviderNoteOld],
[ProviderNoteNew]) as ProviderNote
from your table


--
HTH

Dale Fye


Hi Nick,

There are some things that you just can't do using continuous forms
and this
is one of them. The problem is that even though they are repeated for
each
row, there is really only one set of controls. Conditional formatting
will
help you get around some of these obstacles but visible/Not Visible is
not
one of the things you can alter using conditional formatting. Instead,
you
can use CF to enable/disable the controls.
 
Good point Dale! I've done this a few times myself and didn't think to
mention it.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Dale said:
Or you could modify the code of your query to return only one field as
appropriate, which works if the intent of this display is
informational and not editing.

SELECT ID, ..., IIF([DateOfVisit] <= #7/31/03#, [ProviderNoteOld],
[ProviderNoteNew]) as ProviderNote
from your table


--
HTH

Dale Fye


Hi Nick,

There are some things that you just can't do using continuous forms
and this
is one of them. The problem is that even though they are repeated for
each
row, there is really only one set of controls. Conditional formatting
will
help you get around some of these obstacles but visible/Not Visible is
not
one of the things you can alter using conditional formatting. Instead,
you
can use CF to enable/disable the controls.


Nick said:
I have a small subform that shows in continous form mode (scrolling).
There are two fields overlapping and I'd like only one to show (be
visible) depending on the date. I tried this:


Private Sub Form_BeforeUpdate(Cancel As Integer)

If DateOfVisit < 8 / 1 / 3 Then

Me![ProviderNoteNEW].Visible = False
Me![ProviderNoteOld].Visible = True

End If

If DateOfVisit > 7 / 31 / 3 Then

Me![ProviderNoteNEW].Visible = True
Me![ProviderNoteOld].Visible = False

End If

End Sub



ProviderNoteNEW keeps showing on top of the other control despite
date. I've tried it several different ways. I later added this
hoping to reset the fields to visible but it doesn't seem to work:


Private Sub Form_AfterUpdate()

Me![ProviderNoteNEW].Visible = True
Me![ProviderNoteOld].Visible = True

End Sub
 
Thanks for the suggestion. Works perfectly

Nick


Dale Fye said:
Or you could modify the code of your query to return only one field as
appropriate, which works if the intent of this display is
informational and not editing.

SELECT ID, ..., IIF([DateOfVisit] <= #7/31/03#, [ProviderNoteOld],
[ProviderNoteNew]) as ProviderNote
from your table


--
HTH

Dale Fye


Hi Nick,

There are some things that you just can't do using continuous forms
and this
is one of them. The problem is that even though they are repeated for
each
row, there is really only one set of controls. Conditional formatting
will
help you get around some of these obstacles but visible/Not Visible is
not
one of the things you can alter using conditional formatting. Instead,
you
can use CF to enable/disable the controls.

--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Nick said:
I have a small subform that shows in continous form mode (scrolling).
There are two fields overlapping and I'd like only one to show (be
visible) depending on the date. I tried this:


Private Sub Form_BeforeUpdate(Cancel As Integer)

If DateOfVisit < 8 / 1 / 3 Then

Me![ProviderNoteNEW].Visible = False
Me![ProviderNoteOld].Visible = True

End If

If DateOfVisit > 7 / 31 / 3 Then

Me![ProviderNoteNEW].Visible = True
Me![ProviderNoteOld].Visible = False

End If

End Sub



ProviderNoteNEW keeps showing on top of the other control despite
date. I've tried it several different ways. I later added this
hoping to reset the fields to visible but it doesn't seem to work:


Private Sub Form_AfterUpdate()

Me![ProviderNoteNEW].Visible = True
Me![ProviderNoteOld].Visible = True

End Sub
 
Back
Top