View Single Post
  #2  
Old March 18th, 2010, 08:50 AM posted to microsoft.public.access
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default .VISIBLE Not Working Perfectly

hi Faraz,

On 18.03.2010 06:47, Faraz Ahmed Qureshi wrote:
I want a few controls/text boxes to be visible only if the text box LOCATION
consists the entry Branch. Following piece of code results into be working
upon only upon the first record. In other words, once the controls become
visible they don't hide upon the next Non-Branch record unless I move the
scroll bars.

What might be the reason???

You're using a continuous form, aren't you?

The controls on a continuous form only exist once and are simply
repainted for all records. Thus the effect you see: You can only change
all controls.

You should reconsider your form layout.

Every time I need to move within the new/current record by moving the scroll
bars to have the boxes be visible/not depending upon the LOCATION.


You can shorten this to (just to show a piece of clean code, doesn't
solve your problem):

Private Sub Form_current()

Dim isVisible As Boolean

isVisible = (Nz(Me.Location, "") = "Branch")
Me.Br_T24_Code.Visible = isVisible
Me.Branch_Name.Visible = isVisible
Me.Address.Visible = isVisible
Me.City.Visible = isVisible
Me.Region.Visible = isVisible
Me.Phone1.Visible = isVisible
Me.Phone2.Visible = isVisible
Me.Phone3.Visible = isVisible
Me.Br_status.Visible = isVisible

End Sub




mfG
-- stefan --