Solved

Syntax error with between dates

Posted on 2016-11-21
6
17 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
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 33

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now