Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Access Q&A: Dates, DCount
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   17 years ago

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:

Month([MyDateField])=Month(Date())

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 www.599cd.com/tips





Hello!
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 (www.599cd.com?goac301). I teach the DLOOKUP function in Access 302 which is almost exactly like DCOUNT.

Read more of my Access tips at www.599cd.com/tips

Comments for Access Q&A: Dates, DCount
 
Age Subject From
11 yearsNotificationsAlexander H
11 yearsNotificationsJacqueline
12 yearsCalculating Dates based on Day of the MonthBernadette Torres

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Access Q&A: Dates, DCount
Get notifications when this page is updated
 
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/23/2024 12:51:45 AM. PLT: 0s
Keywords: access tips dates dcount dlookup  PermaLink  Access Q&A: Dates, DCount