Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Courses   Tips   Templates   Forums   Help   Order   Contact   Logon  
Access Q&A: Dates, DCount
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   10/7/2007 4:24:24 PM

Here are some Access questions I've answered recently:

hello richard, i have question regarding how to set up a validation for the date field, where the date can be just within the current month. can u pl help? thanks, sapna

Make your ValidationRule property for this field:


Of course, this will only work while the data is being entered.

Hi Richard. I am trying to query some data for a period from today's date back to 30 June. I will always want to query from today's date (whatever it may be). I tried "Between 30/06/2007 And Now()" as a criteria, but it doesn't appear to do the trick. Can you suggest a solution?

I tried it, and it worked fine for me, but make sure you have the "#" symbols around your dates. Access cannot figure out what you mean otherwise - it will try to treat it as a division problem. I'm in the US, so my date format would me the criteria:

Between #6/30/2007# and Date()+1

The reason I use Date()+1 is because I want to INCLUDE today's data. Remember, dates are treated as of midnight, so by making it tomorrow at midnight, I get all of today's values. Sure, you can use Now() if you want it accurate to the second.

Read more of my Access tips at

I have an application with two tables (simplified version)

table person
column id
column name

table shift
column id
column person_id

There is a one-to-many relationship between the shift table and the person table. So many people can work the same shift. However, i need to limit the number of people on a shift to some number, say 5. How can I do this? I assume I'd need to use some code in the "Before Insert" on the form where I'm adding the records, but I have no clue how to do it.
Thanks for taking the time to read this.

I would use the DCOUNT function to see how many people are already in that shift.

NumWorkers = DCOUNT("*","ShiftTableName","ShiftID=" & ShiftID)

In english, this says, "create a variable called NumWorkers. Set it equal to the count of ALL records (*) in the ShiftTableName table, where the ShiftID equals whatever the current ShiftID on my form is."

I would make a form showing the workers in each shift, and put an unbound combo box with a list of your workers in the FOOTER of the form along with a button to add another worker. Have this code run in the button BEFORE the worker is inserted.

I cover this technique in my advanced Access classes starting with Access 301 ( I teach the DLOOKUP function in Access 302 which is almost exactly like DCOUNT.

Read more of my Access tips at

Notifications Link 
Alexander H    
Hi Jacqueline,

Have you seen the Birthday Tip from Rich?

You could combine this with a DateAdd function.
Add a Reply
Notifications Link 
Hi, I am wanting to create an future alert for 9months from a Date of Birth variable. Could you please explain how to do this? I am very new to ACCESS.
Add a Reply
Calculating Dates based on Day of the Month Link 
Bernadette Torres 

I am wanting to calculate dates as follows:

Original Date:  9/5/12
3 Mo
6 Mo

If the original date is a day between the 16th and 31st of the month I want the 3 mo field to populate to the 1st of the month.  If the original date is between the 1st & 15th I want the date to calculate to the 15th of the month. Read More...
Add a Reply

Post a New Comment or Question
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.

You may want to read these articles from the 599CD News:

8/11/2020Access Maximize App Window
8/10/2020Access Beginner Courses
8/10/2020Access Beginner Level 1
8/10/2020Access 102
8/10/2020Access 101
8/10/2020Access Subform in a List Form
8/9/2020Access Odd or Even?
8/9/2020Access AutoNumbers Good or Bad?
8/6/2020Access Sync Up Remote Database
8/6/2020Access Customer Codes

Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Live Chat
General Info
Support Policy
Contact Form
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

YouTube Channel    LinkedIn

Blog RSS Feed   
Keywords: access tips dates dcount dlookup  PermaLink