Solved

Report field query syntax

Posted on 2014-04-21
1
413 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
[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
1 Comment
 
LVL 37

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

739 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