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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make textbox not visible depending on other textbox

Status
Not open for further replies.

crisis2007

Technical User
Apr 2, 2007
114
US
I can not find the solution to this problem I am having. I have two text boxes (txt1 and txt2). They are on a main form to display the months of the respective dates that are called up from two subforms in the main form. The control source to
txt1 is: =[SF_TimeTypeD1].[Form]![ESDate]

txt2 is: =[SF_TimeTypeD7].[Form]![ESDate]

I have formated both textboxes to only show their respective months, not the entire date.

This works fine and both show the correct data. However I want txt2 to not be visible if they both show the same month.

I can't seem to find a solution. I have tried this in the OnOpen event (and tried in the OnCurrent event)of the main form but it does not work:

Private Sub Form_Open()
If (Me.Text1.Value = Me.txt2.Value) = True Then
Me.Text2.Visible = False
End If
End Sub


 
Ok. The code does work with the command button (including the Month). I tried it on the OnCurrent event but no luck there. So I will have to keep trying until I find a way to make the code fire.
 
On timer!


Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
Crisis,
I feel your pain as was in your shoe's not to long ago. If I have understood you correctly, you only want txt2 to show visible if your data from txt1 and txt2 do not match. If this is correct then on the properties sheet for txt2, set the Visible Property to false. This gives it the default of being invisible. The set your code on the After Update Event from the Subfrom to reveal it they two values are not equal

If Me.txt1 <> Me.txt2 Then
Me.txt2.Visible = True
End If

This is of course assuming that the data is coming from an active control. If that doesn't work, try making a Function that checks the data coming from the table and use a Boolean to determine the controls visiblity. Assuming of course that both sets of data are coming form the same record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top