Date Validation pop up

N

NoviceNana

Hi Everyone,

I was just asked to create a date validation pop up on a form that I'm
designing. The validation is a pop up box that asks the user if the
end date of the period is correct by taking the last date of the
previous period and adding the number of days in the current period.

So one field on the form asks for the end date of the last report
period and another field asks for the number of days in the current
period. For example the last day of the previous review period could
be April 30, 2007 and the number of days in the current period is 7
days. So they would like a pop up that says, "The last day of this
review period is May 6, 2007. Is that correct?" And the you click
"yes" or "No"

Now I personally that there are better ways to do this that would make
more sense to me but I have to do what I'm told with this one... :)

Any assistance? I'm slightly/moderately proficient at code. My main
issue is how to make the message in the pop up box display the correct
date.

Any suggestions would be GREATLY GREATLY appreciated.
Nana
 
D

Dave Miller

Nana,

Try below:

Regards,

David Miller

Private Sub Button1_Click()
Dim dtm as Date
Dim Answer as Long

dtm = me.txtDate

Answer = msgbox("The last day of this review period is " & _
format(dtm + 7, "MMM D, YYYY") & _
". Is that correct?", _
vbYesNo + vbQuestion, _
"Period Validation")
Select Case Answer
Case vbYes
'Run Code
Case vbNo
Exit Sub
End Select
End Sub
 

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