Solved

how to count occurance of field

Posted on 2012-03-24
11
363 Views
Last Modified: 2012-03-24
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?
0
Comment
Question by:seamus9909
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 6

Expert Comment

by:worthyking1
ID: 37760779
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.
0
 

Author Comment

by:seamus9909
ID: 37760798
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?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37760982
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
0
Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

 

Author Comment

by:seamus9909
ID: 37761054
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?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37761059
you have to include the "From TableName"


select [LARRECVDATE], IIF([LARRECVDATE] & ""<>"",2*25,Null)
From TableName
0
 

Author Comment

by:seamus9909
ID: 37761070
Owed: select[LARRECVDATE], IIF([LARRECVDATE] & ""<>"",1*25,Null) from tblclaim1

still giving me a syntax error.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37761071
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
0
 

Author Comment

by:seamus9909
ID: 37761079
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;
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37761082
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;
0
 

Author Comment

by:seamus9909
ID: 37761104
It says syntax error missing operator when I try and run it
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 37761111
oops, sorry, copied the wrong one


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
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question