changing visibility of controlls in a form while in the form

Ankarn

Registered User.
Local time
Yesterday, 18:00
Joined
Jul 4, 2008
Messages
81
I have a form with a textbox that has visibility = false.

When i click a button i want the visibility to change. I have tried allmost everything possible. The visibility doesnt change before i close the form and reopen it. I have the visibility = false if the value in the texbox is Null, and visibility = True if the textbox is not Null.

The value in the textbox changes, but the visibility doesnt. I've tried refresh and requery in all possible combinations, but i dont get this working.


Can someone help me here?

I'm starting to suspect this isn't supposed to be possible.
 
Interesting.

My case is a bit different. In that case you just set it to visible, in my case it has to check if the controll is Null or not, and then set the visibility according to that. What i've tried is to write this test in current event and then requery the form after the click.

Here is my code.
Code:
Private Sub Form_Current()
If IsNull(Me.Sendt) Then
    Me.Sendt.Visible = False
    Me.Send.Visible = True
Else
    Me.Sendt.Visible = True
    Me.Send.Visible = False
End If
End Sub

And when i run the changes i also run Me.Requery and a bunch of other stuff like requery every controll and such.

The visibility DOES change, since i just have to close and reopen, but it dont do it right away.
 
What is the name of this field "Sendt" or "Send" ???
 
Add "Me.Repaint" to your code to "refresh" the screen/form.
 
Send and sendt is two different controls.

This is what i do after i click the button.
Me.Send = Null
Me.NyStatus = Null
Forms!MainSearch!Results.Requery
Me.Sendt.Requery
Me.Status.Requery
Me.Requery
Me.Refresh
Me.Repaint
Forms!MainSearch!Results.Form.Requery

Me.Repaint didnt work either.
I really thought it would.
 
I'm still not clear as to exactly what you're doing here, but your code in the Form_Current event will only be executed when you move to a record. Your code behind your button does nothing to make the textbox's visibility. The Current code won't do anything to the record you're currently on. The code works after closing then opening the form because when you then go the record in question the Current event is firing.
 
try next:
If IsNull(Me.Sendt) Or Me.Sendt = "" Then
........
.....
 
Should not the current event fire when i requery the form?

There is no problem with the test, so isNull should be ok. Its just a problem with firing the visibility while in the form.
 
Try adding a msgbox to your code to see when it is triggered. If it is not even triggered then this entire thing is mute...
 
Thats smart.

It doesnt trigger until i open it manually. I make tha change, close, and open, and thats when the msgbox displays. Should not requery do this for me?
 

Users who are viewing this thread

Back
Top Bottom