Solved

Report field query syntax

Posted on 2014-04-21
1
412 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 36

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

740 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