A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Parameter Query Question



 
 
Thread Tools Display Modes
  #1  
Old March 1st, 2010, 11:33 PM posted to microsoft.public.access.queries
Zoomiest
external usenet poster
 
Posts: 11
Default 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  
Old March 1st, 2010, 11:57 PM posted to microsoft.public.access.queries
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 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  
Old March 2nd, 2010, 02:51 AM posted to microsoft.public.access.queries
Sylvain Lafontaine[_2_]
external usenet poster
 
Posts: 247
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.