Alow certain Date Range

M

mikester104

Here is a hard one i have been stuckon for a while. I have a user form that
does a now statemnet to automatically fill a text box. However a user can
input a another date in the date issued textbox. What i want it to do is if
that date that the user enters in is to old then it iwll pop a msgbox up.

For example this being October can you have the date limit allow input for
August, September and October and flag any with dates before August as too
old to accept? Now this will have to be an xpression that will update from
the now statement. So if its now month is November then it will allow info
for November, October and September but flag any past dates. I know this is a
wierd one but i thought i was getting good at programming till this happend.
Thanks for anyone hlp on this.
 
B

Bob Phillips

If CDate(txtDateIssued.Text) >= DateSerial(Year(Date),Month(Date)-2,1)
And
CDate(txtDateIssued.Text) <= DateSerial(Year(Date),Month(Date)+1,0)
Then
Msgbox "Valid"
Else
Msgbox "Invalid"
End If

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
D

Dave Peterson

See your other post.
Here is a hard one i have been stuckon for a while. I have a user form that
does a now statemnet to automatically fill a text box. However a user can
input a another date in the date issued textbox. What i want it to do is if
that date that the user enters in is to old then it iwll pop a msgbox up.

For example this being October can you have the date limit allow input for
August, September and October and flag any with dates before August as too
old to accept? Now this will have to be an xpression that will update from
the now statement. So if its now month is November then it will allow info
for November, October and September but flag any past dates. I know this is a
wierd one but i thought i was getting good at programming till this happend.
Thanks for anyone hlp on this.
 

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