By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,662 Members | 1,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,662 IT Pros & Developers. It's quick & easy.

Building an expression

P: 3
I am new to Microsoft Access and I am having to make a change to code that already exists. Here is what I am trying to do:

B_COST: IIf([DISTR_AMT]NOT NULL,"B_COST",IIf([INSUR]NOT NULL,"B_COST"))

What I am trying to accomplish is the field B_COST will consist of amounts from DISTR_AMT if it is not null or amounts from INSUR if it is not null. I tried using an OR statment but it did not like it.

thanks
Jun 11 '07 #1
Share this Question
Share on Google+
6 Replies


10K+
P: 13,264
I am new to Microsoft Access and I am having to make a change to code that already exists. Here is what I am trying to do:

B_COST: IIf([DISTR_AMT]NOT NULL,"B_COST",IIf([INSUR]NOT NULL,"B_COST"))

What I am trying to accomplish is the field B_COST will consist of amounts from DISTR_AMT if it is not null or amounts from INSUR if it is not null. I tried using an OR statment but it did not like it.

thanks
Hi and welcome to TSDN. Hope you have a great time here. I'll have to move your thread to the access forum where the experts there can help.
Jun 11 '07 #2

P: 3
thank you as you can tell I am new to both the scripts and microsoft access. How do I know if somebody has posted to my question
Jun 11 '07 #3

10K+
P: 13,264
thank you as you can tell I am new to both the scripts and microsoft access. How do I know if somebody has posted to my question
You can set email notification in your control panel (link is at the top of the page to the right). You can also check in this thread the same way you saw my response. Anyway they wont take too long to respond otherwise they will be in trouble with me ...


@Access experts: Now don't be lazy in here. Give some help.
Jun 11 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
@r035198x "Your wish is my command :)"


B_COST: IIf(NOT IsNull([DISTR_AMT]),[DISTR_AMT],IIf(NOT IsNull([INSUR]),[DISTR_AMT],0))

This will check DISTR_AMT first and if it is not null will put the value in B_COST. If it is null it will look in INSUR and if that is not null it will put the value in B_COST. If both are null it will put 0.

Note: If DISTR_AMT is not null it will never check INSUR.
Jun 11 '07 #5

P: 3
@r035198x "Your wish is my command :)"


B_COST: IIf(NOT IsNull([DISTR_AMT]),[DISTR_AMT],IIf(NOT IsNull([INSUR]),[DISTR_AMT],0))

This will check DISTR_AMT first and if it is not null will put the value in B_COST. If it is null it will look in INSUR and if that is not null it will put the value in B_COST. If both are null it will put 0.

Note: If DISTR_AMT is not null it will never check INSUR.
Thanks for the code, but that did not give me both amounts, it only gave me DISTR_AMT. If DISTR_AMT was null it not give me INSUR amount
Jun 12 '07 #6

MMcCarthy
Expert Mod 10K+
P: 14,534
Thanks for the code, but that did not give me both amounts, it only gave me DISTR_AMT. If DISTR_AMT was null it not give me INSUR amount
That's what I said I was giving you. Your original question said you wanted DISTR_AMT or INSUR. Explain the full logic of what you want and I can help you with the code. Give the logic in English, don't worry about the code
Jun 12 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.