a little complicated for me

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

Since I'm just a novice, I need some help with this.

In a query, I need to have a category on each article.
The Category is based on the size and code of the article.

I have
Article, Category, Size, Code

What I want, is to either leave Category blank, or to put Baby or Children
depending on what size it is.

If Code is Null, then Category should remain blank.
If Size is any of the following
62, 68, 74, 80, 86, 629, 749, 62/68, 74/80, 139, 169, 199
Then Category should be Baby.
Otherwise it should be Children.

I hope you understand what I mean.

Can anyone help me with this.
Take it easy when explaining. :)

BR
Claes
 
use built in function IIF ( argtest, result_if_true, result_if_false)

the results can be a constant, like "Baby" or the result of another
function, which could be another IIF()

So something like:

Category: IIF (ISNULL(
Code:
), "" , IIF( [size] IN ("62","68", ....) ,
"Baby", "Children")  )
 
You could use IIF function as like
IIf(IsNull(
Code:
)=False;IIf([Size]=62 Or [Size]=68 Or
[Size]=74;"Baby";"Children");"")
 
OK, it seems to work.
Thank you for helping a not to clever boy. :)
I havent actually tried the update yet, but it looks ok so far.

I have one more question related to this.

For the update query to know what records to update, I have created a field
called Updated.
If Updated is null, then it will update the records.

For this to work, I need it to fll in a value for it to find the correct
records next time.
Not to familiar with update querys, I assumed that I could instruct it to
change to "Yes" in this field.
Obviously I was wrong.

I read that I need to state an expression.
Does this mean that I can not simply write "Yes"?
If so, then how shall I make it change from null-value to "Yes"?

BR
Claes

"David F Cox" skrev:
use built in function IIF ( argtest, result_if_true, result_if_false)

the results can be a constant, like "Baby" or the result of another
function, which could be another IIF()

So something like:

Category: IIF (ISNULL(
Code:
), "" , IIF( [size] IN ("62","68", ....) ,
"Baby", "Children")  )


[QUOTE="Claes D"]
Hi.

Since I'm just a novice, I need some help with this.

In a query, I need to have a category on each article.
The Category is based on the size and code of the article.

I have
Article, Category, Size, Code

What I want, is to either leave Category blank, or to put Baby or Children
depending on what size it is.

If Code is Null, then Category should remain blank.
If Size is any of the following
62, 68, 74, 80, 86, 629, 749, 62/68, 74/80, 139, 169, 199
Then Category should be Baby.
Otherwise it should be Children.

I hope you understand what I mean.

Can anyone help me with this.
Take it easy when explaining.   :)

BR
Claes
[/QUOTE]
[/QUOTE]
 
If Updated is null, then it will update the records.

* shudder *

Perhaps you do not mean "null". you should use a Y/N field field for this,
with a default of No.

I hope this is what you have done. A Y/N field does not have a Null value,
but lets not go there at the moment.

If it is a Y/N field you can simply type Yes into the "Update to" row of the
update query design.



Claes D said:
OK, it seems to work.
Thank you for helping a not to clever boy. :)
I havent actually tried the update yet, but it looks ok so far.

I have one more question related to this.

For the update query to know what records to update, I have created a
field
called Updated.
If Updated is null, then it will update the records.

For this to work, I need it to fll in a value for it to find the correct
records next time.
Not to familiar with update querys, I assumed that I could instruct it to
change to "Yes" in this field.
Obviously I was wrong.

I read that I need to state an expression.
Does this mean that I can not simply write "Yes"?
If so, then how shall I make it change from null-value to "Yes"?

BR
Claes

"David F Cox" skrev:
use built in function IIF ( argtest, result_if_true, result_if_false)

the results can be a constant, like "Baby" or the result of another
function, which could be another IIF()

So something like:

Category: IIF (ISNULL(
Code:
), "" , IIF( [size] IN ("62","68", ....) ,
"Baby", "Children")  )


[QUOTE="Claes D"]
Hi.

Since I'm just a novice, I need some help with this.

In a query, I need to have a category on each article.
The Category is based on the size and code of the article.

I have
Article, Category, Size, Code

What I want, is to either leave Category blank, or to put Baby or
Children
depending on what size it is.

If Code is Null, then Category should remain blank.
If Size is any of the following
62, 68, 74, 80, 86, 629, 749, 62/68, 74/80, 139, 169, 199
Then Category should be Baby.
Otherwise it should be Children.

I hope you understand what I mean.

Can anyone help me with this.
Take it easy when explaining.   :)

BR
Claes
[/QUOTE]
[/QUOTE]
[/QUOTE]
 

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

Back
Top