[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 69
  • Last Modified:

DCount with multiple criteria

What is wrong with:

=DCount("[ExpiredID]","tblExpiredListings","DiffAgentDateRelisted BETWEEN #" & [Forms]![frmExpiredListingReportDateRange]![txtStartDate] & "# AND #" & [Forms]![frmExpiredListingReportDateRange]![txtEndDate] & "#" & " AND [ListingAgent] = '" John Doe "'")
0
SteveL13
Asked:
SteveL13
3 Solutions
 
Patrick MatthewsCommented:
Your're missing some ampersands.  If you always want it to be John Doe, why not:

=DCount("[ExpiredID]","tblExpiredListings","DiffAgentDateRelisted BETWEEN #" & [Forms]![frmExpiredListingReportDateRange]![txtStartDate] & "# AND #" & [Forms]![frmExpiredListingReportDateRange]![txtEndDate] & "#" & " AND [ListingAgent] = 'John Doe'")
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you can combine your literals -- you also have an extra quote mark and spaces'
=DCount("[ExpiredID]","tblExpiredListings","DiffAgentDateRelisted BETWEEN #" & [Forms]![frmExpiredListingReportDateRange].[txtStartDate] & "# AND #" & [Forms]![frmExpiredListingReportDateRange].[txtEndDate] & "# AND [ListingAgent] = 'John Doe'")

Open in new window

 I like to use . instead of ! when referring to controls.
0
 
NorieCommented:
Try this.

=DCount("[ExpiredID]","tblExpiredListings","DiffAgentDateRelisted BETWEEN #" & [Forms]![frmExpiredListingReportDateRange]![txtStartDate] & "# AND #" & [Forms]![frmExpiredListingReportDateRange]![txtEndDate] & "# AND [ListingAgent] = 'John Doe '")
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now