Michael Dean
asked on
how to count occurance of field
In access I have a table and within a QUery I want to check to see if a field is not Null and if so multiple 2 x 25).
So if [LarRecvDate] is not null then write 2 *25.
What would the syntax in the query be?
So if [LarRecvDate] is not null then write 2 *25.
What would the syntax in the query be?
You're going to need to be a bit more specific on exactly what you're trying to do in order for us to help you.
ASKER
ok in the row from the table I want to evaluate.
A field called "LarRecved" can be null or not null.
if the field is not null I want to calculate using an expression in the query.
So if LarRecved is not null multiply 2 *25.
Does this help?
A field called "LarRecved" can be null or not null.
if the field is not null I want to calculate using an expression in the query.
So if LarRecved is not null multiply 2 *25.
Does this help?
select [LarRecved], IIF([LarRecved] & ""<>"",2*25,Null)
from tableX
why not just use 50 instead of 2 * 25
post sample values from field LarRecved and the result you expect to get when LarRecved is NOT null and when LarRecved is NULL
from tableX
why not just use 50 instead of 2 * 25
post sample values from field LarRecved and the result you expect to get when LarRecved is NOT null and when LarRecved is NULL
ASKER
So either there is a date in LARRECVDATE or its empty
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",2*25,Null)
I could just enter 50 that is true. When I entered the above syntax it is giving me an error .
I am missing something?
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",2*25,Null)
I could just enter 50 that is true. When I entered the above syntax it is giving me an error .
I am missing something?
you have to include the "From TableName"
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",2*25,Null)
From TableName
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",2*25,Null)
From TableName
ASKER
Owed: select[LARRECVDATE], IIF([LARRECVDATE] & ""<>"",1*25,Null) from tblclaim1
still giving me a syntax error.
still giving me a syntax error.
copy this as the one COMPLETE query
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",1*25,Null) as Owed
from tblclaim1
OR post the whole query you are using
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",1*25,Null) as Owed
from tblclaim1
OR post the whole query you are using
ASKER
Here you go
SELECT tblClaim1.ClaimID, tblClaim1.ClaimNo, tblClaim1.Claimant, tblClaim1.LARRECVDATE, tblEorRecvd.EORRecDate
FROM tblClaim1 INNER JOIN tblEorRecvd ON tblClaim1.ClaimID = tblEorRecvd.ClaimID
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",1*25,Null) as Owed
from tblclaim1;
SELECT tblClaim1.ClaimID, tblClaim1.ClaimNo, tblClaim1.Claimant, tblClaim1.LARRECVDATE, tblEorRecvd.EORRecDate
FROM tblClaim1 INNER JOIN tblEorRecvd ON tblClaim1.ClaimID = tblEorRecvd.ClaimID
select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",1*25,Null) as Owed
from tblclaim1;
here is the query
SELECT tblClaim1.ClaimID, tblClaim1.ClaimNo, tblClaim1.Claimant, tblClaim1.LARRECVDATE, tblEorRecvd.EORRecDate, IIF(tblClaim1.[LARRECVDATE ] & ""<>"",1*25,Null) as Owed
FROM tblClaim1 INNER JOIN tblEorRecvd ON tblClaim1.ClaimID = tblEorRecvd.ClaimID
from tblclaim1;
SELECT tblClaim1.ClaimID, tblClaim1.ClaimNo, tblClaim1.Claimant, tblClaim1.LARRECVDATE, tblEorRecvd.EORRecDate, IIF(tblClaim1.[LARRECVDATE
FROM tblClaim1 INNER JOIN tblEorRecvd ON tblClaim1.ClaimID = tblEorRecvd.ClaimID
from tblclaim1;
ASKER
It says syntax error missing operator when I try and run it
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.