Solved

Syntax error with between dates

Posted on 2016-11-21
6
39 Views
Last Modified: 2016-11-21
Can someone tell me what is wrong with this?

=DCount("[ExpiredID]", "tblExpiredListings", "SameAgentDateRelisted", = BETWEEN #" & Forms![frmExpiredListingReportDateRange]![txtStartDate] & "#" AND #" & Forms![frmExpiredListingReportDateRange]![txtEndDate] & "#")
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 41896383
With between, no need for =.
0
 

Author Comment

by:SteveL13
ID: 41896386
Still getting an error...

"The expression you entered contains invalid syntax"
0
 
LVL 30

Expert Comment

by:hnasr
ID: 41896390
Try:
DCount("[ExpiredID]", "tblExpiredListings", "SameAgentDateRelisted BETWEEN #" & Forms![frmExpiredListingReportDateRange]![txtStartDate] & "#" AND #" & Forms![frmExpiredListingReportDateRange]![txtEndDate] & "#") 

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

Accepted Solution

by:
Norie earned 500 total points
ID: 41896392
Perhaps.
=DCount("[ExpiredID]", "tblExpiredListings", "SameAgentDateRelisted BETWEEN #" & Forms![frmExpiredListingReportDateRange]![txtStartDate] & "# AND #" & Forms![frmExpiredListingReportDateRange]![txtEndDate] & "#")
0
 
LVL 30

Expert Comment

by:hnasr
ID: 41896394
DCount("[ExpiredID]", "tblExpiredListings", "SameAgentDateRelisted BETWEEN #" & Forms![frmExpiredListingReportDateRange]![txtStartDate] & "# AND #" & Forms![frmExpiredListingReportDateRange]![txtEndDate] & "#")
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 41896416
You might even want to consider something like the following, which includes NZ() function calls to fill in the date parameters if they are empty in the form:

DCount("[ExpiredID]", "tblExpiredListings", "SameAgentDateRelisted BETWEEN #" & NZ(Forms![frmExpiredListingReportDateRange]![txtStartDate], Date()-1) & "# AND #" & NZ(Forms![frmExpiredListingReportDateRange]![txtEndDate], Date() + 1) & "#")

Just a thought.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question