Query

  • Thread starter Vesta via AccessMonster.com
  • Start date
V

Vesta via AccessMonster.com

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)));
 
G

Guest

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.
 
G

Guest

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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top