Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Syntax error with between dates

Posted on 2016-11-21
6
Medium Priority
?
45 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 31

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 31

Expert Comment

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

Open in new window

0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 34

Accepted Solution

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

Expert Comment

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

Expert Comment

by:Dale Fye
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

705 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