Solved

Correct syntax for report

Posted on 2013-11-02
4
303 Views
Last Modified: 2013-11-02
I have a report with a solution from EE..... which is working great (Thanks!)

In the working report I have a text box with the control source as:

=[CountOfFrameModel]/DCount("FrameModel","tmain","frameLine='" & [FrameLine] & "'and tMain.FrameOWF = False and tMain.Status <> 'Cancelled'")


I would also like to add anothe criteria based on a form selection but can't find the syntax.... The form is [Form]![fReportSelect]![LocSelect]

The only catch is that there are 3 locations possible and "ALL"

So while I would like to add the "locseelct" to the text box's control source but also keep as it is above when "All" is selected from the locselect on the form.

Is this possible?  If I could get the syntax correct I thought perhaps of using an IF statement in the control box.
0
Comment
Question by:thandel
  • 3
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39618989
Try this:

=[CountOfFrameModel]/DCount("FrameModel","tmain","frameLine='" & [FrameLine] & "'and tMain.FrameOWF = False and tMain.Status <> 'Cancelled' AND locseelct LIKE '" & iif("" & [Form]![fReportSelect]![LocSelect] = "All", "*", "" & [Form]![fReportSelect]![LocSelect]) & "'")

Open in new window

0
 
LVL 61

Expert Comment

by:mbizup
ID: 39618997
Hmm... I copied the field name "locseelct" directly from your original post.

It looks like a typo to me, though.  If you have issues with what I posted, try using "locselect" instead of "locseelct"

=[CountOfFrameModel]/DCount("FrameModel","tmain","frameLine='" & [FrameLine] & "'and tMain.FrameOWF = False and tMain.Status <> 'Cancelled' AND locselect LIKE '" & iif("" & [Form]![fReportSelect]![LocSelect] = "All", "*", "" & [Form]![fReportSelect]![LocSelect]) & "'")

Open in new window

0
 

Author Comment

by:thandel
ID: 39619020
Thanks minor correction and added tMain.office but

=[CountOfFrameModel]/DCount("FrameModel","tmain","frameLine='" & [FrameLine] & "'and tMain.FrameOWF = False and tMain.Status <> 'Cancelled' AND  tMain.Office LIKE '" & IIf("" & Form!fReportSelect!LocSelect="All","*","" & Form!fReportSelect!LocSelect) & "'")

Is prompting for "Form".  I think Form!fReportSelect!LocSelect needs to be [Form]![fReportSelect]![LocSelect]
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39619037
Ooops ... actually it needs to be Forms!   (with an s):


=[CountOfFrameModel]/DCount("FrameModel","tmain","frameLine='" & [FrameLine] & "'and tMain.FrameOWF = False and tMain.Status <> 'Cancelled' AND  tMain.Office LIKE '" & IIf("" & Forms!fReportSelect!LocSelect="All","*","" & Forms!fReportSelect!LocSelect) & "'")

Open in new window

0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
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 …

786 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