Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

label and control only visible when 2 fields equal 1

Status
Not open for further replies.

wz

Programmer
Feb 16, 2001
88
US
I am trying to have a label and a field (for input) only appear on the screen when two fields do not equal - any help?

example:

regular hours 40
on duty hours 40

(no label)

but if

regular hours 40
on duty hours 38

I would like a label to appear "please write up explation" as well as the field then appear for end user to type into.

(I do not want to use a message box)

(I have both text box & field on my form but I am having trouble with this)

wz
 
How are ya wz . . .

[ol][li]In the code module of the form, copy/paste the following routine:
Code:
[blue]Public Sub ShowCtls()
   Dim flg As Boolean
   
   If Me![Regular Hours] <> Me![On Duty Hours] Then flg = True
   Me![[purple][B][I]LabelName[/I][/B][/purple]].Visible = flg
   Me![[purple][B][I]TextboxName[/I][/B][/purple]].Visible = flg

End Sub[/blue]
[/li]
[li]Finally, in the [blue]AfterUpdate[/blue] events of [blue]Regular Hours[/blue] and [blue]On Duty Hours[/blue] and the forms [blue]On Current[/blue] event, copy/paste the following line:
Code:
[blue]   Call ShowCtls[/blue]
[/li][/ol]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
YES!!! THANK YOU SO MUCH!!!! wz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top