UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Vba For Date Of The Last 10 Days Of The Month, Access 2016    
 
   
dimitrispp
post May 27 2020, 04:36 PM
Post#1



Posts: 25
Joined: 3-December 14



Hi!

I would like your help on the following topic:

In a date field, I would like to have a message before the update, when the date I enter is in the last 10 days of the current month.
How do I write the code?

Thank you in advance
Go to the top of the page
 
June7
post May 27 2020, 04:40 PM
Post#2



Posts: 1,523
Joined: 25-January 16
From: The Great Land


So you want to validate that date is between today and today - 10?

Can use ValidationRule:

BETWEEN Date() AND Date()-10 OR IS NULL

--------------------
Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Go to the top of the page
 
dimitrispp
post May 27 2020, 04:56 PM
Post#3



Posts: 25
Joined: 3-December 14



No. When the entered date in the field belongs to the last 10 days of the month,
then I have a message ...
Go to the top of the page
 
theDBguy
post May 27 2020, 05:20 PM
Post#4


UA Moderator
Posts: 78,470
Joined: 19-June 07
From: SunnySandyEggo


Last 10 days of the "current" month or "any" month?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
RJD
post May 27 2020, 05:24 PM
Post#5


UtterAccess VIP
Posts: 10,569
Joined: 25-October 10
From: Gulf South USA


Hi:
QUOTE
...when the date I enter is in the last 10 days of the current month

Here's one way to do that. See if it works for you...

If Me!MyDate >= (DateSerial(Year(Date), Month(Date) + 1, 0) - 9) And Me!MyDate <= (DateSerial(Year(Date), Month(Date) + 1, 0)) Then
MsgBox "This date is in the last 10 days of the current month", , "Notice"
End If

HTH
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 
dimitrispp
post May 27 2020, 05:30 PM
Post#6



Posts: 25
Joined: 3-December 14



Oh yes. That is what I wanted...
Thank you very much for your help.
Go to the top of the page
 
RJD
post May 27 2020, 05:36 PM
Post#7


UtterAccess VIP
Posts: 10,569
Joined: 25-October 10
From: Gulf South USA


You are very welcome. We are all happy to assist.

Continued success ...

Regards,
Joe

--------------------
"Each problem that I solved became a rule, which served afterwards to solve other problems."
"You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing."

Rene Descartes 1596-1650 (Mathematician and Philosopher)
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    8th July 2020 - 02:36 AM