By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,497 Members | 2,127 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,497 IT Pros & Developers. It's quick & easy.

IIf in QBE

P: n/a
I am trying to do a simple IIf expression in the QBE for a query parameter.
What I am trying to type in is IIf([Forms]![frmTest]![tglEdit] = 0,0,,).
What it changes to when I type it in is IIf([Forms]![frmTest]![tglEdit] =
0,0,",") - this then stops the query from working. What do I need to type
to stop the inverted commas from surrounding the second comma?

dixie
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Tue, 27 Apr 2004 07:47:19 +1000, dixie wrote:
I am trying to do a simple IIf expression in the QBE for a query parameter.
What I am trying to type in is IIf([Forms]![frmTest]![tglEdit] = 0,0,,).
What it changes to when I type it in is IIf([Forms]![frmTest]![tglEdit] =
0,0,",") - this then stops the query from working. What do I need to type
to stop the inverted commas from surrounding the second comma?

dixie


Dixie,
For one thing you need to write the IIf expression correctly.
You have one too many commas as value separator, and therefore Access
believes you meant the last one to be a value of "," .

The IIf function returns 2 values, a True value if the crireria is
met; a False value otherwise.

=IIf([SomeField] = criteria,True Value,False Value)

=IIf([Forms]![frmTest]![tglEdit] = 0,0,some other value here)

What value do you wish if the criteria is not met?
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #2

P: n/a
dixie wrote:
I am trying to do a simple IIf expression in the QBE for a query parameter.
What I am trying to type in is IIf([Forms]![frmTest]![tglEdit] = 0,0,,).
What it changes to when I type it in is IIf([Forms]![frmTest]![tglEdit] =
0,0,",") - this then stops the query from working. What do I need to type
to stop the inverted commas from surrounding the second comma?

dixie

IIf([Forms]![frmTest]![tglEdit] = 0,0,,)


The syntax is wrong here, IIf() takes 3 parameters, hence two commas,
what do you want to output if tglEdit doesn't equal 0?

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #3

P: n/a
Whoops, sorry guys. I wanted no value for the case where the criteria was
not met. I have since done it in a different way whereby it picks up direct
from a text box on the form.

Thanks Fred

dixie

"fredg" <fg******@example.invalid> wrote in message
news:1s****************************@40tude.net...
On Tue, 27 Apr 2004 07:47:19 +1000, dixie wrote:
I am trying to do a simple IIf expression in the QBE for a query parameter. What I am trying to type in is IIf([Forms]![frmTest]![tglEdit] = 0,0,,).
What it changes to when I type it in is IIf([Forms]![frmTest]![tglEdit] = 0,0,",") - this then stops the query from working. What do I need to type to stop the inverted commas from surrounding the second comma?

dixie


Dixie,
For one thing you need to write the IIf expression correctly.
You have one too many commas as value separator, and therefore Access
believes you meant the last one to be a value of "," .

The IIf function returns 2 values, a True value if the crireria is
met; a False value otherwise.

=IIf([SomeField] = criteria,True Value,False Value)

=IIf([Forms]![frmTest]![tglEdit] = 0,0,some other value here)

What value do you wish if the criteria is not met?
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Nov 12 '05 #4

P: n/a
Sorry Trevor, I should have mentioned that in my original post. See my
reply to fredg.

Thanks for your reply.

dixie

"Trevor Best" <nospam@localhost> wrote in message
news:40***********************@auth.uk.news.easyne t.net...
dixie wrote:
I am trying to do a simple IIf expression in the QBE for a query parameter. What I am trying to type in is IIf([Forms]![frmTest]![tglEdit] = 0,0,,).
What it changes to when I type it in is IIf([Forms]![frmTest]![tglEdit] = 0,0,",") - this then stops the query from working. What do I need to type to stop the inverted commas from surrounding the second comma?

dixie

IIf([Forms]![frmTest]![tglEdit] = 0,0,,)


The syntax is wrong here, IIf() takes 3 parameters, hence two commas,
what do you want to output if tglEdit doesn't equal 0?

--
Error reading sig - A)bort R)etry I)nfluence with large hammer

Nov 12 '05 #5

P: n/a
"dixie" <di****@dogmail.com> wrote in
news:N_*************@nnrp1.ozemail.com.au:
I wanted no value for the case where the criteria was
not met.


In the QBE, IIf(Test, True) works. You don't need a False case.

That does not work in VBA, but in controls and the QBE, it does.
I've been using that forever.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #6

P: n/a
dixie wrote:
Sorry Trevor, I should have mentioned that in my original post. See my
reply to fredg.


IIf([Forms]![frmTest]![tglEdit] = 0,0,Null) or
IIf([Forms]![frmTest]![tglEdit] = 0,0,"")

--
Error reading sig - A)bort R)etry I)nfluence with large hammer
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.