it doesn't work

Tech

Registered User.
Local time
Today, 16:59
Joined
Oct 31, 2002
Messages
267
hi there, need help.

if we enter the date < the year 2002 it works but if not then it doesn't:

Code:
If Me![Delievered].Value = 0 Then
    Order_Delivery_needed_by.SetFocus
    If Order_Delivery_needed_by.Text = "" Or Order_Delivery_needed_by.Text = " " Then
        MsgBox ("Enter the delivery date the customer needs this order by!")
        Exit Sub
    Else
          
        If Date > Order_Delivery_needed_by.Text Then
            MsgBox ("This delivery date is overdue!")
        End If
    End If
End If

I want it so that if todays date exceeds the order delivery by date then alert the user otherwise don't.

any ideas?
 
If Date > Order_Delivery_needed_by.Text Then
I assume Date is the Date() function (returns a date datatype) and Order_Delivery_needed_by.Text is a string. I would convert the Order_Delivery_needed_by.Text to a date format and then do the compare.
But then again maybe I assume to much. :-)
 
how do I convert it to a date format? but i doubt if it will still work or make any difference....
 
Look up the DateValue() function.
 
but I already set the value to a date in the table input mask...
 
Good! Having the input mask does not make the data type compatable. An internal date is not MM/DD/YYYY as you think. I believe it is a long integer that counts the days since 1970 or some such nonsense as that. So you were comparing (as an example) "03/03/2003" to 1435768 and it would not work. Doing the date conversion takes that string date and converts it to the internal date format number.
 
Worse than that, FoFa. It is a DOUBLE, for which the integer part is days since 1900 and the fractional part is fraction of a day since midnight.

FYI, you can convert text date strings as CDate(text).
 

Users who are viewing this thread

Back
Top Bottom