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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query



 
 
Thread Tools Display Modes
  #1  
Old April 1st, 2007, 09:51 PM posted to microsoft.public.access.forms
Vesta via AccessMonster.com
external usenet poster
 
Posts: 2
Default Query

Hi,

The query below is working fine but once I have added this new line before
the last line:
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Quantity Error", (SKF.
Quantity),

An error mssg will appear and I'm unable to save the Query:
[Syntax error in query expression will show]
Pls help.
Thank you


PARAMETERS [Forms]![frmErrorTyQuery]![cboTyError] Short, [Forms]!
[frmErrorTyQuery]![txtFty] Short, [Forms]![frmErrorTyQuery]![txtStatus] Long,
[Forms]![frmErrorTyQuery]![txtPrefix] Short;
SELECT SKF.*
FROM SKF
WHERE IIf((Forms!frmErrorTyQuery!txtFty Is Null) Or (SKF.Factory Like "*" &
Forms!frmErrorTyQuery!txtFty & "*")) And ((Forms!frmErrorTyQuery!txtStatus Is
Null) Or (SKF.Status=Forms!frmErrorTyQuery!txtStatus)) And ((Forms!
frmErrorTyQuery!txtPrefix Is Null) Or (SKF.Prefix Like "*" & Forms!
frmErrorTyQuery!txtPrefix & "*")) And
IIf([Forms]![frmErrorTyQuery]![cboTyError] = "Pack Label", (SKF.PackLabel),
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Export Pack", (SKF.
ExportPack),
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Product Quality", (SKF.
ProductQuality), True)));

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200704/1

  #2  
Old April 2nd, 2007, 12:30 AM posted to microsoft.public.access.forms
Ken Kazinski
external usenet poster
 
Posts: 5
Default Query

The IIF statement is in the form of IIF ( expression, true, false).

It looks as if you are trying to do a else if in the true part.



"Vesta via AccessMonster.com" wrote:

Hi,

The query below is working fine but once I have added this new line before
the last line:
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Quantity Error", (SKF.
Quantity),

An error mssg will appear and I'm unable to save the Query:
[Syntax error in query expression will show]
Pls help.
Thank you


PARAMETERS [Forms]![frmErrorTyQuery]![cboTyError] Short, [Forms]!
[frmErrorTyQuery]![txtFty] Short, [Forms]![frmErrorTyQuery]![txtStatus] Long,
[Forms]![frmErrorTyQuery]![txtPrefix] Short;
SELECT SKF.*
FROM SKF
WHERE IIf((Forms!frmErrorTyQuery!txtFty Is Null) Or (SKF.Factory Like "*" &
Forms!frmErrorTyQuery!txtFty & "*")) And ((Forms!frmErrorTyQuery!txtStatus Is
Null) Or (SKF.Status=Forms!frmErrorTyQuery!txtStatus)) And ((Forms!
frmErrorTyQuery!txtPrefix Is Null) Or (SKF.Prefix Like "*" & Forms!
frmErrorTyQuery!txtPrefix & "*")) And
IIf([Forms]![frmErrorTyQuery]![cboTyError] = "Pack Label", (SKF.PackLabel),
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Export Pack", (SKF.
ExportPack),
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Product Quality", (SKF.
ProductQuality), True)));

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200704/1


  #3  
Old April 2nd, 2007, 01:14 AM posted to microsoft.public.access.forms
SteveS
external usenet poster
 
Posts: 132
Default Query

The immediate IF function ( IIF() ) syntax does not have an "ELSEIIF" part.

Not knowing anything about your requirements....I tried to modify the query
(AKA air code):


Parameters [Forms]![frmErrorTyQuery]![cboTyError] Short,
[Forms]![frmErrorTyQuery]![txtFty]
Short,[Forms]![frmErrorTyQuery]![txtStatus] Long,
[Forms]![frmErrorTyQuery]![txtPrefix] Short;
SELECT SKF.*
FROM SKF
WHERE ((Forms!frmErrorTyQuery!txtFty Is Null) Or (SKF.Factory Like "*" &
Forms!frmErrorTyQuery!txtFty & "*")) And ((Forms!frmErrorTyQuery!txtStatus Is
Null) Or (SKF.Status = Forms!frmErrorTyQuery!txtStatus)) And
((Forms!frmErrorTyQuery!txtPrefix Is Null) Or (SKF.Prefix Like "*" &
Forms!frmErrorTyQuery!txtPrefix & "*")) And
IIf([Forms]![frmErrorTyQuery]![cboTyError] = "Pack Label", SKF.PackLabel =
"Pack Label", IIf([Forms]![frmErrorTyQuery]![cboTyError] = "Export Pack",
SKF.ExportPack = "Export Pack", IIf([Forms]![frmErrorTyQuery]![cboTyError] =
"Product Quality", SKF.ProductQuality = "Product Quality", True)))


In the last IIF() , I'm not sure what will happen if it falls thru to the
last part, the "TRUE".


--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"Vesta via AccessMonster.com" wrote:

Hi,

The query below is working fine but once I have added this new line before
the last line:
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Quantity Error", (SKF.
Quantity),

An error mssg will appear and I'm unable to save the Query:
[Syntax error in query expression will show]
Pls help.
Thank you


PARAMETERS [Forms]![frmErrorTyQuery]![cboTyError] Short, [Forms]!
[frmErrorTyQuery]![txtFty] Short, [Forms]![frmErrorTyQuery]![txtStatus] Long,
[Forms]![frmErrorTyQuery]![txtPrefix] Short;
SELECT SKF.*
FROM SKF
WHERE IIf((Forms!frmErrorTyQuery!txtFty Is Null) Or (SKF.Factory Like "*" &
Forms!frmErrorTyQuery!txtFty & "*")) And ((Forms!frmErrorTyQuery!txtStatus Is
Null) Or (SKF.Status=Forms!frmErrorTyQuery!txtStatus)) And ((Forms!
frmErrorTyQuery!txtPrefix Is Null) Or (SKF.Prefix Like "*" & Forms!
frmErrorTyQuery!txtPrefix & "*")) And
IIf([Forms]![frmErrorTyQuery]![cboTyError] = "Pack Label", (SKF.PackLabel),
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Export Pack", (SKF.
ExportPack),
ELSEIIf ([Forms]![frmErrorTyQuery]![cboTyError] = "Product Quality", (SKF.
ProductQuality), True)));

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200704/1


 




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 05:12 PM.


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