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
Solved

DCount VBA syntax issue

Posted on 2013-12-02
2
429 Views
Last Modified: 2013-12-02
What is wrong with this?

Me.txtListingsSoldPending = Nz(DCount("[ID]", "tblTransactions", "[ListingAgent] = " & Forms!frmSelectDateRangeAndMembers!txtMemberName & " And [ListMonth] = " & Forms!frmSelectDateRangeAndMembers!txtMonth & " And [ListYear] = " & Forms!frmSelectDateRangeAndMembers!txtYear & " And [Pending] = True), 0)
0
Comment
Question by:SteveL13
2 Comments
 
LVL 28

Expert Comment

by:omgang
ID: 39690020
What errors are you receiving?  Are all data types text?  If so, I believe you may need to qualify the form control values with apostrophes, e.g.

Me.txtListingsSoldPending = Nz(DCount("[ID]", "tblTransactions", "[ListingAgent] = '" & Forms!frmSelectDateRangeAndMembers!txtMemberName & "' And [ListMonth] = '" & Forms!frmSelectDateRangeAndMembers!txtMonth & "' And [ListYear] = '" & Forms!frmSelectDateRangeAndMembers!txtYear & "' And [Pending] = True), 0)

If the month and year values are numeric you'd leave off the apostrophes.
OM Gang
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39690028
Give this a try - You're Missing an end quote:


Me.txtListingsSoldPending = Nz(DCount("[ID]", "tblTransactions", "[ListingAgent] = " & Forms!frmSelectDateRangeAndMembers!txtMemberName & " And [ListMonth] = " & Forms!frmSelectDateRangeAndMembers!txtMonth & " And [ListYear] = " & Forms!frmSelectDateRangeAndMembers!txtYear & " And [Pending] = True"), 0) 

Open in new window

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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 …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

808 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