Junior1544
Technical User
I need to write an if statment to compare dates...
I will attach the code shortly...
The problem I'm having is that it alwas reports false... I've tried reversing the logic...
I've even done it in the imediate window with the real dates... when I use the real dates it works fine... but when I use the variables it reports false...
I can't hard code dates because they are alwas changing and I'm not going to change the code for every item...
Thanks for taking a look at this.
btw, I'm using access 2k, and using dao recordsets...
Dim rst As dao.Recordset
Set rst = CurrentDb().OpenRecordset("SELECT UserPW.* FROM UserPW WHERE (((UserPW.UsrName)=CurrentUser()));"
If (rst!Date > Date - 80) And (rst!Date < Date - 90) Then
MsgBox "You have " & DateDiff("d", rst!Date, Date) & " days to change your password."
DoCmd.Close
DoCmd.OpenForm "Switchboard"
end if
I forgot to say what i'm tring to do with the if statement...
I want it to check to see if the date reported by the recordset is between 80 and 90 days ago...
if there's a better way to do this let me know, thanks...
--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
I will attach the code shortly...
The problem I'm having is that it alwas reports false... I've tried reversing the logic...
I've even done it in the imediate window with the real dates... when I use the real dates it works fine... but when I use the variables it reports false...
I can't hard code dates because they are alwas changing and I'm not going to change the code for every item...
Thanks for taking a look at this.
btw, I'm using access 2k, and using dao recordsets...
Dim rst As dao.Recordset
Set rst = CurrentDb().OpenRecordset("SELECT UserPW.* FROM UserPW WHERE (((UserPW.UsrName)=CurrentUser()));"
If (rst!Date > Date - 80) And (rst!Date < Date - 90) Then
MsgBox "You have " & DateDiff("d", rst!Date, Date) & " days to change your password."
DoCmd.Close
DoCmd.OpenForm "Switchboard"
end if
I forgot to say what i'm tring to do with the if statement...
I want it to check to see if the date reported by the recordset is between 80 and 90 days ago...
if there's a better way to do this let me know, thanks...
--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.