Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Search Form 2.0    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Between Date Query
Chuck Corvec 
    
3 months ago
I apologize if this is here twice but I did not get a notice that the post was pending approval like in others

So here goes
I have been watching you Search Form 2.0 Video
I am having an issue with searching between dates

The Date field in the table is TimeStamp
The criteria for the TimeStamp field in the query is ...
Is Null Or (Between [forms]![Log_frm]![StartDateSearch] And [forms]![Log_frm]![EndDateSearch])
I have checked all of the spelling and even went so far as to copy and paste what is needed

Some Facts ..,
The text boxes on the for m are named StartDateSearch and EndDateSearch
The records in my table have dates ranging from 2026-03-02 and 2026-05-03
I have eliminated all other search criteria, defaults and requeries  to test just the date

When I enter 2026-03-01 in the StartSearchDate box and 2026-03-30 in the EndDateSearch it should return 2 Records
It does not. It shows all with the cursor being in the first record.
Any Insight will be greatly appreciated.
Chuck Corvec OP  @Reply  
    
3 months ago
Oh I forgot to mention that the field and the txt boxes are set to Short Date
Chuck Corvec OP  @Reply  
    
3 months ago
Update

If I run the underlying query and enter the dates when prompted it works

So that means it (the Query) is not getting the values from the form

Hmmm......

Time to quadruple check the spelling though I did let access find all the objects for me.
Chuck Corvec OP  @Reply  
    
3 months ago
Update

With just the date part in place the form will not load all of the records on load
I am so confused
Chuck Corvec OP  @Reply  
    
3 months ago
Ok Gonna Start this again from the beginning
Chuck Corvec OP  @Reply  
    
3 months ago
SO I did start over. SOrt of.

I only Did the Date Field
The criteria in the TimeStamp field in the query is ....
Is Null Or Between [Forms]![Log_frm]![StartDateSearch] And [Forms]![Log_frm]![EndDateSearch]
When I open the Log_frm form I see no records
I have a button called Clear Search which has on onclick event of me.query
Clicking that does nothing



First problem
When I open the form I see No records.
Bryan Coleman  @Reply  
     
3 months ago
Chuck
TimeStamp is a reserve word (https://599cd.com/glossary/access/reserved/)
try renaming the field and see if that gives you better results

for your clear button, try
StartDateSearch = ""
EndDateSearch = ""
Chuck Corvec OP  @Reply  
    
3 months ago
Bryan Thank you. I will try that
Chuck Corvec OP  @Reply  
    
3 months ago
Bryan

Ok so that did not help
I changed the field name to LogDateTime
I made the necessary changes to reflect the new name
I Changed the Clear Button

Things I have noticed ...
the me.requery always produces an error
  Runitime error 3420
  Object invalid or no longer set

If I comment out the me.query
   The form loads but no recors
   If I add a date range and requery it works
   Then I can use the other search boxes to drill down further

This is definitely not how it worked on Richards video Search Form 2.0 Video

I am still very confused.
Gonna downlaod his free db and try doing it there
Chuck Corvec OP  @Reply  
    
3 months ago
Bryan Ok so I did download the DB and followed along. I ran in to an issue with the Is Null or part of the query for the date field but for the most part it worked. The form did not load showing no records. I am going to review my code again! Dang this is a pain in the butt!
Chuck Corvec OP  @Reply  
    
3 months ago
Update

Because so much has changed I will lay this out again
The form LogSearch_frm is used to view my Log_tbl which gets an entry every time someone logs on or off the database
I have added three search fields to the form StartDateSearch, EndDateSearch and ComputerUserSearch
The values in the date field id obvious but a sample of the data in the ComputerUserSearch box is CFCWORKSTATION.Chuck, EASC-D-008.Carla or EASC-Management.Chuck
By storing that in one field I can search for a user or a computer easily

If I only use ComputerUserSearch in the underlying query it works great

If I add "Is Null Or Between [forms]![LogSearch_frm]![StartDateSearch] And [forms]![LogSearch_frm]![EndDateSearch]" to the LogDateTime field in the LogSearch_qry

I get this error on when the form attempts it's onload Me.Requery.  I will upload the image
Chuck Corvec OP  @Reply  
    
3 months ago

Bryan Coleman  @Reply  
     
3 months ago

Bryan Coleman  @Reply  
     
3 months ago
did you set your defaults?
check you References
under the Tools tab in the VBA editor, select References; check the box if you see any Missing libraries
Kevin Robertson  @Reply  
          
3 months ago
Chuck When you click Debug in the Error Dialog you posted above which line is highlighted?
Chuck Corvec OP  @Reply  
    
3 months ago
Kevin

The requery line

me.requery

I also tried the full form path version

Same thing
Chuck Corvec OP  @Reply  
    
3 months ago
Bryan
Hi Brian

My references point to Microsoft Office 16
Do I need to add the 14 one as well
Bryan Coleman  @Reply  
     
3 months ago
Chuck
No, Office 16 just means that you a newer office then me. I just check to see if there is a bold [Missing]...
Chuck Corvec OP  @Reply  
    
3 months ago
Bryan
No there isn't, so I am good on that front
Chuck Corvec OP  @Reply  
    
3 months ago
ANyone got any more ideas. I am literally pulling my hair out!
Donald Blackwell  @Reply  
       
3 months ago
Hi Chuck,

can you show us a screen shot of your query and form in design view along with any code you have. Maybe if we see the actual objects, we might see something that you're missing.
Chuck Corvec OP  @Reply  
    
3 months ago
Donald Will do
Chuck Corvec OP  @Reply  
    
3 months ago

Chuck Corvec OP  @Reply  
    
3 months ago

Chuck Corvec OP  @Reply  
    
3 months ago

Chuck Corvec OP  @Reply  
    
3 months ago
Donald

So the premise is the form is supposed to display all records until some criteria is entered in to the purple txt boxes
The form's record source is the query
If I run just the query and click ok on earch parameter request it show 0 records
So I do not think the issue is in the form but in thequery
The query is an adaptation of the one used in Richards Search Form 2.0 video
Igore the fact that I have one line in my code commented out. That was me testing and I forgot to uncomment it before taking the screen shot

If I run the form I get 0 records returned, just like if I ran jst the query
If However I put some valid criteria inthe Computer or User unbound txt box like easc-d-004 or chuck or carla it works
I can then drill down with a date range. This is down right bizzare!
Chuck Corvec OP  @Reply  
    
3 months ago

Chuck Corvec OP  @Reply  
    
3 months ago

Kevin Robertson  @Reply  
          
3 months ago
Chuck Have you tried using Query Parameters?
Kevin Robertson  @Reply  
          
3 months ago

Chuck Corvec OP  @Reply  
    
3 months ago
Kevin
That took the error away. But my form still does not show any records on load
If I try to search for something in the ComputerUserSearch text box I get nothing
If I search by StartDateSearch only I get nothing
If I use a range it works
And THEN I can drill down by ComputerUser Searcg=h
Donald Blackwell  @Reply  
       
3 months ago
Hi Chuck,
The way your query is set up is with the AND condition so:
When it opens, it will only show records where the date is null and the user is null (since all 3 fields are blank)
If you enter something in the user field and run the search, it is returning nothing likely because there are no users that meet that user criteria with a null date
If you enter a date range and leave the user blank, it should show all users between that range.

If your log table auto assigns a time stamp to the logdatetime field, you could remove "IS Null" from that part of the query because it should never be null..

If you want to be able to show all records for the entered user OR all records between a range, then you would need to move the criteria to separate lines.

And if you want to show:
All Records between specific date if user is null
or All Records for a specific user if the between dates are null
or All Records for a specific user during specific dates

Then you'll need a little bit of code to modify your query on the fly or have multiple queries I think.
Kevin Robertson  @Reply  
          
3 months ago
In your Query add the NZ Function to the criteria of your Date field and give values if null way outside your date range and you should see all records (depending on other criteria).

Is Null Or Between Nz([Forms]![LogSearch_frm]![StartDateSearch],#1900-01-01#) And Nz([Forms]![LogSearch_frm]![EndDateSearch],#2500-01-01#)
Chuck Corvec OP  @Reply  
    
3 months ago
OMG Kevin
How did I miss that. It is even in the video now that I reviewed it. The form is working perfectly now.

Thank you so much

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Search Form 2.0.
 

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 8/8/2026 11:48:06 AM. PLT: 1s