Hi,
I have a combo box on my form called cboTermID, the 4th column of which is the date/time field from my table.
I have the following code on the forms current property.
If DateValue(me.cboTermID.Column(3))<=DateValue(now() ) Then
Me.cboStatus.Enabled=True
Else
Me.cboStatus.Enabled=False
End If
This doesn't return the result I am looking for, meaning that whether the value of cboTermID.Column(3) is less than today's date or greater, the cboStatus remains enabled.
However, I have tried creating two unbound fields called txtTest and txtNow and set their control source to =DateValue([cboTermID].[Column](3)) and =DateValue(Now()) respectively. Then I have changed the code to compare the unbound fields as follows
If Me.txtTest <= Me.txtNow then
Me.cboStatus.Enabled=True
Else
Me.cboStatus.Enabled=False
End if
This returns the result I want, meaning that cboStatus is enabled if txtTest is less than txtNow and disabled otherwise.
I don't understand why the first method doesn't work. I don't see a difference, an would appreciate if someone can shed some light on it.
Thanks in advance.