473,480 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

complicated expression

I need to create a conditional expression that's not a simple one.
I need the expression to be in the field of a table, that depends on another
field (different column) in that same table. It should be something like
this:

ColumnA
-----------
valueA = X
valueB = Y
valueC = Z

ColumnB
----------
value1 = 30% of valueA, between 3000 and 100,000
value2 = 30% of valueB, between 3000 and 100,000
value3 = 30% of valueC, between 3000 and 100,000

If value1, 2 or 3 is less than 3,000 it stays at 3,000; if it's more than
100,000 it stays at 100k. Anything in between remains 30%.

Thanks!
Nov 13 '05 #1
4 1393
SELECT ColumnA, IIf(ColumnA * .3 < 3000, 3000, IIf(ColumnA * .3 > 100000,
100000, ColumnA * .3)) AS ColumnB
FROM YourTable

I hope I understood correctly what you want.

Yannick

"d.p." <d_*****@yahoo.com> wrote in message
news:40**********************@news.zen.co.uk...
I need to create a conditional expression that's not a simple one.
I need the expression to be in the field of a table, that depends on another field (different column) in that same table. It should be something like
this:

ColumnA
-----------
valueA = X
valueB = Y
valueC = Z

ColumnB
----------
value1 = 30% of valueA, between 3000 and 100,000
value2 = 30% of valueB, between 3000 and 100,000
value3 = 30% of valueC, between 3000 and 100,000

If value1, 2 or 3 is less than 3,000 it stays at 3,000; if it's more than
100,000 it stays at 100k. Anything in between remains 30%.

Thanks!

Nov 13 '05 #2
thanks, works great! I had the feeling it would be that but it only works
within a query. Is there a way to have this in the table itself?
It's like with Excel, a value in column B is a formula that depends on the
value of a cell in column A.
"Yannick Turgeon" <no****@nowhere.com> wrote in message
news:us********************@news20.bellglobal.com. ..
SELECT ColumnA, IIf(ColumnA * .3 < 3000, 3000, IIf(ColumnA * .3 > 100000,
100000, ColumnA * .3)) AS ColumnB
FROM YourTable

I hope I understood correctly what you want.

Yannick

"d.p." <d_*****@yahoo.com> wrote in message
news:40**********************@news.zen.co.uk...
I need to create a conditional expression that's not a simple one.
I need the expression to be in the field of a table, that depends on

another
field (different column) in that same table. It should be something like
this:

ColumnA
-----------
valueA = X
valueB = Y
valueC = Z

ColumnB
----------
value1 = 30% of valueA, between 3000 and 100,000
value2 = 30% of valueB, between 3000 and 100,000
value3 = 30% of valueC, between 3000 and 100,000

If value1, 2 or 3 is less than 3,000 it stays at 3,000; if it's more than 100,000 it stays at 100k. Anything in between remains 30%.

Thanks!


Nov 13 '05 #3
No, you can't.

Even if I don't know anything about your precise goal, I'm sure a query will
do the work you want. Just save this SQL code I gave you as a query, open it
directly - from Access or programmaticaly - and you will be able to change
ColumnA and see the change in ColumnB in your query. This will be exactly as
it would be a table with a calculated field.

HTH

Yannick

"d.p." <d_*****@yahoo.com> wrote in message
news:40**********************@news.zen.co.uk...
thanks, works great! I had the feeling it would be that but it only works
within a query. Is there a way to have this in the table itself?
It's like with Excel, a value in column B is a formula that depends on the
value of a cell in column A.
"Yannick Turgeon" <no****@nowhere.com> wrote in message
news:us********************@news20.bellglobal.com. ..
SELECT ColumnA, IIf(ColumnA * .3 < 3000, 3000, IIf(ColumnA * .3 > 100000,
100000, ColumnA * .3)) AS ColumnB
FROM YourTable

I hope I understood correctly what you want.

Yannick

"d.p." <d_*****@yahoo.com> wrote in message
news:40**********************@news.zen.co.uk...
I need to create a conditional expression that's not a simple one.
I need the expression to be in the field of a table, that depends on

another
field (different column) in that same table. It should be something like this:

ColumnA
-----------
valueA = X
valueB = Y
valueC = Z

ColumnB
----------
value1 = 30% of valueA, between 3000 and 100,000
value2 = 30% of valueB, between 3000 and 100,000
value3 = 30% of valueC, between 3000 and 100,000

If value1, 2 or 3 is less than 3,000 it stays at 3,000; if it's more

than 100,000 it stays at 100k. Anything in between remains 30%.

Thanks!



Nov 13 '05 #4
ok, thanks a lot for your help! much appretiated
"Yannick Turgeon" <no****@nowhere.com> wrote in message
news:Hc********************@news20.bellglobal.com. ..
No, you can't.

Even if I don't know anything about your precise goal, I'm sure a query will do the work you want. Just save this SQL code I gave you as a query, open it directly - from Access or programmaticaly - and you will be able to change
ColumnA and see the change in ColumnB in your query. This will be exactly as it would be a table with a calculated field.

HTH

Yannick

"d.p." <d_*****@yahoo.com> wrote in message
news:40**********************@news.zen.co.uk...
thanks, works great! I had the feeling it would be that but it only works
within a query. Is there a way to have this in the table itself?
It's like with Excel, a value in column B is a formula that depends on the value of a cell in column A.
"Yannick Turgeon" <no****@nowhere.com> wrote in message
news:us********************@news20.bellglobal.com. ..
SELECT ColumnA, IIf(ColumnA * .3 < 3000, 3000, IIf(ColumnA * .3 >

100000, 100000, ColumnA * .3)) AS ColumnB
FROM YourTable

I hope I understood correctly what you want.

Yannick

"d.p." <d_*****@yahoo.com> wrote in message
news:40**********************@news.zen.co.uk...
> I need to create a conditional expression that's not a simple one.
> I need the expression to be in the field of a table, that depends on
another
> field (different column) in that same table. It should be something like > this:
>
> ColumnA
> -----------
> valueA = X
> valueB = Y
> valueC = Z
>
> ColumnB
> ----------
> value1 = 30% of valueA, between 3000 and 100,000
> value2 = 30% of valueB, between 3000 and 100,000
> value3 = 30% of valueC, between 3000 and 100,000
>
> If value1, 2 or 3 is less than 3,000 it stays at 3,000; if it's more

than
> 100,000 it stays at 100k. Anything in between remains 30%.
>
> Thanks!
>
>



Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1214
by: infinull | last post by:
I am using a javascript rich-text-editor to allow a content writer to easily see what there content looks like, however, the content management system that I have made would like to accept bbcode...
1
1521
by: i6033162556-signup1 | last post by:
I need to convert some long codes inline. I want to know the generate rules for doing that. 1 first remove <script></script> 2 use / in front of all "s 3 remove all newline characters. ...
1
1279
by: sathyashrayan | last post by:
Groups, Take a look at the following program taken from C snippet archive. -----------------------code------------------------ void bitstring(char *str, long byze, int biz, int strwid) { int...
26
2671
by: jshanman | last post by:
I am writing a timeline that uses Google Maps. I have a function that converts a date time to latitude coords. This function is used to draw the markers on the timeline. I need a reverse function...
1
1658
by: paul_zaoldyeck | last post by:
Good Day everyone!!! i have here a serious problem.my project is delayed because of this. i'm trying to make a function for an XML Reader that accepts values from the other modules(done by the...
5
2447
by: jayanthigk2004 | last post by:
Is it possible to write a regular expression for this ? Pattern: 999-99-999 Where 9 is any number from 0 to 9 However the user need not enter ALL the digits and dashes as given in the...
19
2366
by: arnuld | last post by:
this programme runs without any error but it does not do what i want it to do: ------------- PROGRAMME -------------- /* K&R2, section 1.6 Arrays; Exercise 1-13. STATEMENT: Write a program...
1
2810
by: Kev | last post by:
Hi, I am trying to total a column (Shift1) in a subform (continous forms) from the after update event of the (Shift1) column control within the subform. This column stores shift codes, I want to...
7
2294
by: MarkNeumann | last post by:
I'm coming from a Corel paradox background and moving into an Access environment. So I'm struggling with something that I think is probably way simpler than I'm making it out to be. Access 2007...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
6886
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4472
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.