?
Solved

DCount VBA syntax issue

Posted on 2013-12-02
2
Medium Priority
?
450 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
[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
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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…
Suggested Courses

764 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