Adding and subtracting Dates

K

Kevin Kleinholter

I am looking to have a message box pop up a few days before somthing is
due. If on my form I have a date box that has the due date in it, how
would i subrtract two days from that or add two days to todays date?
Example: if Date() + 2 = txtDueDate then
msgbox "Message"
end if
or
if txtDuedate - 2 = Date() then
msgbox "Message"
end if

If todays date plus 2 days equals the date in txtDueDate then show a
message box.
If txtDueDate minus 2 days equals todays date then show a message box

If anyones knows how I would write this code, please help me out.

Thanks,

Kevin
 
W

Wayne Morgan

If Date = DateAdd("d", -2, Me.txtDueDate) Then
MsgBox "Message"
End If

In case someone wasn't there 2 days before, you may want to pop-up the message one day
before also.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top