IF this field is visible make this one invis

Randomblink

The Irreverent Reverend
Local time
Yesterday, 18:16
Joined
Jul 23, 2001
Messages
279
Ok...
If you can help me out you are my hero...
I have a form...
On this form I have some controls that should only be visible if others are invis...

Is there any code I can run that will sit in the background and ONLY run when the visibility changes for the selected controls...?

To give you a better layout...
I have two buttons that can alter the PROJECT_ACCOUNT_CODE field and the PROJECT_NUMBER field...
Well, the PROJECT_ACCOUNT_CODE and the PROJECT_NUMBER field are only visible whenever a Project has been selected from a Drop Down...

So can I, can I...?

(cause I dont know how)
 
The question really is what triggers these fields becoming visible or invisible? In other words, if you want Text2 to be visible when Text1 is not and vice versa, then when is Text1 changed? Put the change for Text2 right there along side it.
 
I think I understand your problem. Maybe...

What I did on the similar issue I had with variably-visible fields was to write a little procedure and put it in the general section of the form in question. In my case, it was a "state-variable" issue. If the form was in state 1, this set of controls was shown. If in state 2, this non-identical set was shown. If state 3, a totally different set, etc.

So the procedure was something like this:

Private Sub Reconfigure(loSV as long)

Select Case loSv
Case 1
[Field1].visible = False
[Field2].visible = True
...
Case 2
[Field1].visible = True
[Field2].visible = False
...
Case Else
[Field1].visible = False
[Field2].visible = False
...
End Select
End Sub

Then I built second function with a series of If tests to set the state variable and call the Reconfigure subroutine.

Then, from every event procedure that could make a difference, I called the testing subroutine, which determined the state variable and diddled the controls. But I did it in two stages because when I was doing a "New Record" I didn't have to call the testing routine. I just called the Reconfigure routine directly with the appropriate state variable as a constant.

Hope that leads you in a good direction.
 

Users who are viewing this thread

Back
Top Bottom