Microsoft
Software
Hardware
Network
Question : Validate month and year fields based on current date
I have an Access table that has a year field and a month field. The year field is just a text box and I have a validation rule set <=Year(Date()) so that the user cannot enter anything in the future. The month field is a drop-down box on the form with January through December as options. I want to add a validation rule on the form that won't let the user select any month in the future based on the year field value. For example, the year field has 2010 as its value, so the user should not be able to select anything other than January through July in the month field because today's date is 7/22/2010.
Answer : Validate month and year fields based on current date
private sub txtMonth_beforeupdate(canc
el as integer)
if me.txtYear=year(date()) then
if me.txtMonth> Month(date()) then
msgbox "you can not use future dates"
me.txtMonth.setfocus
cancel=true
exit sub
end if
end if
end sub
Random Solutions
Small Business mathematics
How do I get this PHP IMAP script to fetch the body of emails? I can't get it to work.
Roaming Profiles in Windows 7 Pro and SBS 2008
Intel Sata RAID controller on RHEL 4 problem
Windows Small Business Server 2008: Critical Event Notification
Grub menu in not loading on ESXi 4
C# 4.0 convert from 12h format to 24h format.
Diffrence between debug & release versions
imac osx 10.5 - Does not boot; cannot find harddrive. Getting a folder icon wid a question mark flashin at startup
Lightweight network management for mobile workforce