If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Parameter Query Question
Why doesn't this work?
In the Criteria field of a QBE grid, I have the following formula, to pull some parameters off a form. How can I code the "*" condition, if the chkAll is true? IIf([Forms]![frmLA_Control_Panel].[chkAll]=True,([tblOnliners]. [Region]) Like "*",[Forms]![frmLA_Control_Panel].[cboRegions]) (this doen't work) IIf([Forms]![frmLA_Control_Panel].[chkAll]=True,"*",[Forms]! [frmLA_Control_Panel].[cboRegions]) (this doesn't work either) |
#2
|
|||
|
|||
Parameter Query Question
"doesn't work" doesn't give us much to go on ... can you be a bit more
specific? Do you get an error message? What does it say? Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "Zoomiest" wrote in message ... Why doesn't this work? In the Criteria field of a QBE grid, I have the following formula, to pull some parameters off a form. How can I code the "*" condition, if the chkAll is true? IIf([Forms]![frmLA_Control_Panel].[chkAll]=True,([tblOnliners]. [Region]) Like "*",[Forms]![frmLA_Control_Panel].[cboRegions]) (this doen't work) IIf([Forms]![frmLA_Control_Panel].[chkAll]=True,"*",[Forms]! [frmLA_Control_Panel].[cboRegions]) (this doesn't work either) |
#3
|
|||
|
|||
Parameter Query Question
IIf() is a function returning a value, not a conditional statement; so
probably that you are trying to write something like: [tblOnliners].[Region]) Like IIf([Forms]![frmLA_Control_Panel].[chkAll]=True,"*",[Forms]![frmLA_Control_Panel].[cboRegions]) This is something close to your second attempt so maybe this is already what you have wrote with QBE but I don't know it; so I'm not sure. A much better solution would be to write something like directly in SQL: WHERE (Forms]![frmLA_Control_Panel].[chkAll]=True) OR ([tblOnliners].[Region] = [Forms]![frmLA_Control_Panel].[cboRegions]) You should forget about using the QBE and learn to write your queries directly in SQL. QBE is, at best, a bad tool with which you can only write simple expressions and that will quickly mix up your stuff if you trow anything at it that is not plain simple. You'll go nowhere with this (bad) tool if you insist to work with it. -- Sylvain Lafontaine, ing. MVP - Windows Live Platform Blog/web site: http://coding-paparazzi.sylvainlafontaine.com Independent consultant and remote programming for Access and SQL-Server (French) "Zoomiest" wrote in message ... Why doesn't this work? In the Criteria field of a QBE grid, I have the following formula, to pull some parameters off a form. How can I code the "*" condition, if the chkAll is true? IIf([Forms]![frmLA_Control_Panel].[chkAll]=True,([tblOnliners]. [Region]) Like "*",[Forms]![frmLA_Control_Panel].[cboRegions]) (this doen't work) IIf([Forms]![frmLA_Control_Panel].[chkAll]=True,"*",[Forms]! [frmLA_Control_Panel].[cboRegions]) (this doesn't work either) |
Thread Tools | |
Display Modes | |
|
|