Solved

Report field query syntax

Posted on 2014-04-21
1
411 Views
Last Modified: 2014-04-21
Can an expert tell me what is wrong with this syntax?

me.txtListingsTakenActual = Queries!qryTeamPerfRptListingsTaken.CountOfID WHERE "Listing Month" = me.txtMonthName AND "Listing Year" = me.txtYear

--Steve
0
Comment
Question by:SteveL13
1 Comment
 
LVL 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40012493
It looks like you are trying to run a query and place the results in a text box.  That isn't how it works.  A query returns a recordset.  It doesn't return a string.  Your syntax is also incorrect.

To open a recordset, you can use DAO or ADO.  If all you want is a single column returned, it might be easier to use DLookup()

me.txtListingsTakenActual = DLookup("CountOfID", "Queries!qryTeamPerfRptListingsTaken", "[Listing Month] '" = me.txtMonthName & "' AND [Listing Year]  = " & me.txtYear)

Based on what you started with, I am assuming that year and month are separate fields and that month is a string and year is numeric.  You will need to adjust the delimiters if that is incorrect.
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

Title # Comments Views Activity
Adding new field to an existing database in access 3 25
DateAdd every year from Jun 3 24
Record with #Error 8 33
MS Access VBA Code to Include Library References 4 49
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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

839 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