Solved

Correct syntax for report

Posted on 2013-11-02
4
284 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now