Label visable based on criteria of text box

weilerdo

Registered User.
Local time
Today, 08:14
Joined
Apr 21, 2005
Messages
109
Hi All, I have a form that I have a textbox that is a calculated field. I also have a label that is set to not visable. What I am trying to do is if the textbox ( Text92 ) has a value of <=-1 the make label visable ( Label27 ) I have tried the following and none of them seem to work it doesn't seem to fire my code.

Code:
 Form_Current
     If Me.Text92 <= -1 Then Label27.Visable = True

Nothing happens, I also tried
Code:
 Form_Current
      If Me.Text92 <= -1 Then Label27.Visable = True
         Else  Label27.Visable = False
   End If
I get an error on the Else clause on this one.

Basically what I need is a way that if the value in Text92 is anything less then 0 to display Label27. If they make changes and the value in Text92 changes to 0 or above hide Label27. I have tried it with label and with a text box and I can't get it to loop through and display my message. I hope I have explained it correctly and ant to say Thank you in advance for looking at this.

Thank You
Don
 
should be

me.Label27.Visible =

and I would use the else option, but the format is

If Me.Text92 <= -1 Then
me.Label27.Visible = True
Else me.Label27.Visible = False
End If

Brian
 
You are mixing single line and multi-line If...Else...End If structures and you didn't spell visible the way Access does. :D Try:
Code:
If Me.Text92 < 0 Then
   Me.Label27.Visible = True
Else
   Me.Label27.Visible = False
End If
 
Hey Brian , I tried that And it is not giving me the error anymore but it still is not running the code for some reason or at least the Label is not dispalying, any idea's

Thanks
Don
 
Hey Rural, Same thing it doesn't seem like it is running the code I have it in the On Current of the form so that it should be looping through correct?
 
Hi

It looks to me as if you are comparing a text field with a number. Try converting Me.text92 to a number.
 
What do you mean by looping through? It will run the test as you move between records, if you recalculate the field it will not run the test if that is what you expect.
Brian
 
Yeah Brian that is exactly what I need it to do. Basically the form is a vacation request form and it shows there current available vaction and if they try and over schedule and the total goes into a - value we need it to display a message to inform them that they have over scheduled their vacation and need to cancel days. Once they cancel days it will update Text92 and if it is 0 over greater the display will not show.
 
Make it a separate function or sub and call it from both the Current event of the form as well as the AfterUpdate event of the controls involved.
 
Hey Rural, I did that and most of them are working now. The only ones that don't seem to be working are the calculated fields and the Form_Current, so I added a button they need to click on and I added it to the last text box on the page and it runs the code on both of them so I think it should be ok.

As always Thanks....
 
i think ive seen that before

the calculated field isnt set immediately on the current event - you nned to find another way to test the setting
 

Users who are viewing this thread

Back
Top Bottom