Iif statement in SQL append query?

R

Randy

Can an Iif statement be used in this append query? What I need is after
WHERE ,,IIF [EndCertNolbl] is Null then I want only the [BeginCertNolbl]
appended. If [EndCertNolbl] is populated or Not Null than the following
code is correct...Thanks...Randy

INSERT INTO CheckedOutCertsAllNumbers ( CertNo, Inspector, TypeOfCert,
DateCheckedOut, BeginingCertInitial )
SELECT [N]+[Forms]![frmCheckedOutCertificates]![BeginCertNolbl] AS Expr1,
[CheckedOutCertificates].[Inspector], [CheckedOutCertificates].[TypeOfCert],
[CheckedOutCertificates].[DateCheckedOut],
[CheckedOutCertificates].[BeginningInitial]
FROM Num, CheckedOutCertificates
WHERE
((([N]+[Forms]![frmCheckedOutCertificates]![BeginCertNolbl])<=[Forms]![frmCheckedOutCertificates]![EndCertNolbl])
And
(([CheckedOutCertificates].[Inspector])=[Forms]![frmCheckedOutCertificates]![cboInspector])
And
(([CheckedOutCertificates].[TypeOfCert])=[Forms]![frmCheckedOutCertificates]![cboTypeofCert])
And
(([CheckedOutCertificates].[DateCheckedOut])=[Forms]![frmCheckedOutCertificates]![DateCheckedOutlbl])
And
(([CheckedOutCertificates].[BeginningInitial])=[Forms]![frmCheckedOutCertificates]![BeginningInitiallbl]))
ORDER BY [N]+[Forms]![frmCheckedOutCertificates]![BeginCertNolbl];
 
M

[MVP] S.Clark

If it can't be done in one query, then you could always make a second query
that handles the condition.

Personally, I don't like using IIF().
 

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