Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Correct syntax for report

Posted on 2013-11-02
4
Medium Priority
?
338 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 2000 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

971 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