If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
.VISIBLE Not Working Perfectly
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??? 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. Private Sub Form_current() If Me.Location "Branch" Then Me.Br_T24_Code.Visible = False Me.Branch_Name.Visible = False Me.Address.Visible = False Me.City.Visible = False Me.Region.Visible = False Me.Phone1.Visible = False Me.Phone2.Visible = False Me.Phone3.Visible = False Me.Br_status.Visible = False Me.Br_T24_Code.Enabled = False Me.Branch_Name.Enabled = False Me.Address.Enabled = False Me.City.Enabled = False Me.Region.Enabled = False Me.Phone1.Enabled = False Me.Phone2.Enabled = False Me.Phone3.Enabled = False Me.Br_status.Enabled = False Else Me.Br_T24_Code.Visible = True Me.Branch_Name.Visible = True Me.Address.Visible = True Me.City.Visible = True Me.Region.Visible = True Me.Phone1.Visible = True Me.Phone2.Visible = True Me.Phone3.Visible = True Me.Br_status.Visible = True Me.Br_T24_Code.Enabled = True Me.Branch_Name.Enabled = True Me.Address.Enabled = True Me.City.Enabled = True Me.Region.Enabled = True Me.Phone1.Enabled = True Me.Phone2.Enabled = True Me.Phone3.Enabled = True Me.Br_status.Enabled = True End If Me.Recalc End Sub -- Thanx & Best Regards, Faraz! |
#2
|
|||
|
|||
.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 -- |
#3
|
|||
|
|||
.VISIBLE Not Working Perfectly
Thanx lot 4 replying Stefan!
It is actually a split form! -- Thanx & Best Regards, Faraz! "Stefan Hoffmann" wrote: 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 -- . |
Thread Tools | |
Display Modes | |
|
|