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

Need help with simple code

Status
Not open for further replies.

JanesC

Technical User
Jan 15, 2002
29
GB
I have a form that displays the Months, Days and Hours that have passed from a certain date.

When the [Months] value is displaying i want to hide [Days] and [Hours]. And the same if [Days] or [Hours] is displaying, i would like to hide the other two.

This works fine as long as i scroll forwards through the records, when i scroll backwards it displays [Days] and [Hours] at the same time. Is there a logical reason why???

This is the code:

Private Sub Form_Current()

If Me![Hours] <= 24 Then
Me![Hours].Visible = True

Else
Me![Hours].Visible = False

End If

If Me![Days] >= 1 Then
If Me![Days] <= 31 Then
Me![Days].Visible = True

Else
Me![Days].Visible = False

End If
End If


If Me![Months] <= 1 Then
Me![Months].Visible = False

Else
Me![Months].Visible = True

End If

End Sub


HELP!!!!!!!
 
I would suggest that everytime you set one control's visible = true to set the other's to false...

If Me![Hours] <= 24 Then
Me![Hours].Visible = True
Me![Days].Visible = False
Me![Months].Visible = False
End If

Just a thought prodevmg@yahoo.com
ProDev, MS Access Applications B-)
May God bless you in the year 2002.
 
Wow! that was a fast response. Thanks, that works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top