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

Set a Listbox Property to True or False based on criteria 1

Status
Not open for further replies.

tamer64

IS-IT--Management
Aug 27, 2007
120
US
I have a table called "Employee_Data_tbl" which has the following fields: [EmpID], [Employee], [StartDate], and [DueDate]. I have a form called "Employee_Form" which has a couple listbox and which have their visible property set to false.

What i am trying to do here is have the below code search the "Employee_Data_tbl" and If today's date is "equal" to or "greater" than [StartDate] and today's Date is "Less" than [DueDate] then set the visible property to "true" for Listbox190. Basically, if today's date falls between "StartDate and "DueDate" then show List190, otherwise if it is outside these two date the listbox190 is false. Then If, todays date is equal to or greater than the [DueDate] set the visible property of List201 to True.


This is what I have but it's not working. This code set on the "On Current" event of the form.

[blue]'If Date >= "Me!StartDate" < "Me!DueDate" Then
Me!List190.Visible = True
Else
Me!List190.Visible = False

ElseIf "Me!DueDate" > Date() Then
Me!List201.Visible = True
Else
' Me!List201.Visible = False
End If
End Sub[/blue]

As always, any help very much appreciated..
 
Me!List190.Visible = (Me!StartDate <= Date And Me!DueDate > Date)
Me!List201.Visible = (Me!DueDate > Date)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank You PHV...worked out great.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top