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