If, Then Statements

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

Guest

Hello,
I have taken the advice of Tim and Dave (thank you); however, this is what I
am running into now.
I created the following expression:

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
It is supposed to compute like this:
If the # of charges entered in the charges field is greater than or equal to
5 then "4", If the # of charges entered equals 3 OR 4 then "2", If the # of
charges equals 1 or 2 then "0". The first two parts of the expression work
but if I enter either 1 or 2 the query is bringing in the #2 not the #0. Any
insight?
 
This is the problem:
[charges]=3 or 4

If [Charges] is text, then it should be:
[charges]="3 or 4"
otherwise, it should be:
[charges]=3 or [charges]=4
Same for the last criteria

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
 
Dave, I am confused by your first email. I did create two columns but then I
am stuck after that.

Klatuu said:
This is the problem:
[charges]=3 or 4

If [Charges] is text, then it should be:
[charges]="3 or 4"
otherwise, it should be:
[charges]=3 or [charges]=4
Same for the last criteria

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Hello,
I have taken the advice of Tim and Dave (thank you); however, this is what I
am running into now.
I created the following expression:

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
It is supposed to compute like this:
If the # of charges entered in the charges field is greater than or equal to
5 then "4", If the # of charges entered equals 3 OR 4 then "2", If the # of
charges equals 1 or 2 then "0". The first two parts of the expression work
but if I enter either 1 or 2 the query is bringing in the #2 not the #0. Any
insight?
 
Okay, Sharon. I know this was a different thread, so I don't remember the
detail. Can you post back with exactly what you are trying to do? Sorry, but
I'm old and suffer from CRS :)
--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Dave, I am confused by your first email. I did create two columns but then I
am stuck after that.

Klatuu said:
This is the problem:
[charges]=3 or 4

If [Charges] is text, then it should be:
[charges]="3 or 4"
otherwise, it should be:
[charges]=3 or [charges]=4
Same for the last criteria

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Hello,
I have taken the advice of Tim and Dave (thank you); however, this is what I
am running into now.
I created the following expression:

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
It is supposed to compute like this:
If the # of charges entered in the charges field is greater than or equal to
5 then "4", If the # of charges entered equals 3 OR 4 then "2", If the # of
charges equals 1 or 2 then "0". The first two parts of the expression work
but if I enter either 1 or 2 the query is bringing in the #2 not the #0. Any
insight?
 
Hi Dave,
This was my original post and your response:

Tim's solution would work. As an alternative, I would suggest adding an
additiona column to your combo for MSCO, and assigning MSCO Score its value
in the After Update event of the MSCO combo:
So you columns would be:

5 or More 4
3 or 4 2
1 0r 2 O

Then in the After Update event:

Me.txtMSCOscore = Me.cboMSCO.Column(1)


Klatuu said:
Okay, Sharon. I know this was a different thread, so I don't remember the
detail. Can you post back with exactly what you are trying to do? Sorry, but
I'm old and suffer from CRS :)
--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Dave, I am confused by your first email. I did create two columns but then I
am stuck after that.

Klatuu said:
This is the problem:
[charges]=3 or 4

If [Charges] is text, then it should be:
[charges]="3 or 4"
otherwise, it should be:
[charges]=3 or [charges]=4
Same for the last criteria

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
--
Dave Hargis, Microsoft Access MVP


:

Hello,
I have taken the advice of Tim and Dave (thank you); however, this is what I
am running into now.
I created the following expression:

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
It is supposed to compute like this:
If the # of charges entered in the charges field is greater than or equal to
5 then "4", If the # of charges entered equals 3 OR 4 then "2", If the # of
charges equals 1 or 2 then "0". The first two parts of the expression work
but if I enter either 1 or 2 the query is bringing in the #2 not the #0. Any
insight?
 
Okay, I got it.
First, let's set up the combo box correctly.
Make the Row Source Type Value List
Make the Column Count 2
Make the column width property 0.5";0" (This will make the score value
invisible)
Make the Bound column 2
Make this the Row Source:
"5 or More";"4";"2 or 3";"2";"1 or 2";"0"
Make the Limit To List Property to Yes
Then in the After Update event of the the combo box:
Me.txtMSCOscore = Me.cboMSCO

That assumes the control the MSCO Score field is bound to is txtMSCOscore.
This will populate the control with the score value that corresponds to the
value selected.

Hope that makes it clear. If not, post back and we can make it work.


--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Hi Dave,
This was my original post and your response:

Tim's solution would work. As an alternative, I would suggest adding an
additiona column to your combo for MSCO, and assigning MSCO Score its value
in the After Update event of the MSCO combo:
So you columns would be:

5 or More 4
3 or 4 2
1 0r 2 O

Then in the After Update event:

Me.txtMSCOscore = Me.cboMSCO.Column(1)


Klatuu said:
Okay, Sharon. I know this was a different thread, so I don't remember the
detail. Can you post back with exactly what you are trying to do? Sorry, but
I'm old and suffer from CRS :)
--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Dave, I am confused by your first email. I did create two columns but then I
am stuck after that.

:

This is the problem:
[charges]=3 or 4

If [Charges] is text, then it should be:
[charges]="3 or 4"
otherwise, it should be:
[charges]=3 or [charges]=4
Same for the last criteria

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
--
Dave Hargis, Microsoft Access MVP


:

Hello,
I have taken the advice of Tim and Dave (thank you); however, this is what I
am running into now.
I created the following expression:

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
It is supposed to compute like this:
If the # of charges entered in the charges field is greater than or equal to
5 then "4", If the # of charges entered equals 3 OR 4 then "2", If the # of
charges equals 1 or 2 then "0". The first two parts of the expression work
but if I enter either 1 or 2 the query is bringing in the #2 not the #0. Any
insight?
 
Hi Dave,
I am pretty sure that I got it now...Thank you.

Klatuu said:
Okay, I got it.
First, let's set up the combo box correctly.
Make the Row Source Type Value List
Make the Column Count 2
Make the column width property 0.5";0" (This will make the score value
invisible)
Make the Bound column 2
Make this the Row Source:
"5 or More";"4";"2 or 3";"2";"1 or 2";"0"
Make the Limit To List Property to Yes
Then in the After Update event of the the combo box:
Me.txtMSCOscore = Me.cboMSCO

That assumes the control the MSCO Score field is bound to is txtMSCOscore.
This will populate the control with the score value that corresponds to the
value selected.

Hope that makes it clear. If not, post back and we can make it work.


--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Hi Dave,
This was my original post and your response:

Tim's solution would work. As an alternative, I would suggest adding an
additiona column to your combo for MSCO, and assigning MSCO Score its value
in the After Update event of the MSCO combo:
So you columns would be:

5 or More 4
3 or 4 2
1 0r 2 O

Then in the After Update event:

Me.txtMSCOscore = Me.cboMSCO.Column(1)


Klatuu said:
Okay, Sharon. I know this was a different thread, so I don't remember the
detail. Can you post back with exactly what you are trying to do? Sorry, but
I'm old and suffer from CRS :)
--
Dave Hargis, Microsoft Access MVP


:

Dave, I am confused by your first email. I did create two columns but then I
am stuck after that.

:

This is the problem:
[charges]=3 or 4

If [Charges] is text, then it should be:
[charges]="3 or 4"
otherwise, it should be:
[charges]=3 or [charges]=4
Same for the last criteria

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
--
Dave Hargis, Microsoft Access MVP


:

Hello,
I have taken the advice of Tim and Dave (thank you); however, this is what I
am running into now.
I created the following expression:

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
It is supposed to compute like this:
If the # of charges entered in the charges field is greater than or equal to
5 then "4", If the # of charges entered equals 3 OR 4 then "2", If the # of
charges equals 1 or 2 then "0". The first two parts of the expression work
but if I enter either 1 or 2 the query is bringing in the #2 not the #0. Any
insight?
 
Dave,
I am now designing the real database and I have followed the instructions
you gave below. I am having trouble with the macro that I enter into the
"after update" field. It is telling me that macro does not exist. Any
insight?

Klatuu said:
Okay, I got it.
First, let's set up the combo box correctly.
Make the Row Source Type Value List
Make the Column Count 2
Make the column width property 0.5";0" (This will make the score value
invisible)
Make the Bound column 2
Make this the Row Source:
"5 or More";"4";"2 or 3";"2";"1 or 2";"0"
Make the Limit To List Property to Yes
Then in the After Update event of the the combo box:
Me.txtMSCOscore = Me.cboMSCO

That assumes the control the MSCO Score field is bound to is txtMSCOscore.
This will populate the control with the score value that corresponds to the
value selected.

Hope that makes it clear. If not, post back and we can make it work.


--
Dave Hargis, Microsoft Access MVP


Sharon Walls said:
Hi Dave,
This was my original post and your response:

Tim's solution would work. As an alternative, I would suggest adding an
additiona column to your combo for MSCO, and assigning MSCO Score its value
in the After Update event of the MSCO combo:
So you columns would be:

5 or More 4
3 or 4 2
1 0r 2 O

Then in the After Update event:

Me.txtMSCOscore = Me.cboMSCO.Column(1)


Klatuu said:
Okay, Sharon. I know this was a different thread, so I don't remember the
detail. Can you post back with exactly what you are trying to do? Sorry, but
I'm old and suffer from CRS :)
--
Dave Hargis, Microsoft Access MVP


:

Dave, I am confused by your first email. I did create two columns but then I
am stuck after that.

:

This is the problem:
[charges]=3 or 4

If [Charges] is text, then it should be:
[charges]="3 or 4"
otherwise, it should be:
[charges]=3 or [charges]=4
Same for the last criteria

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
--
Dave Hargis, Microsoft Access MVP


:

Hello,
I have taken the advice of Tim and Dave (thank you); however, this is what I
am running into now.
I created the following expression:

IIf([charges]>=5,4,IIf([charges]=3 or 4,2,IIf([charges]=1 or 2,0,)))
It is supposed to compute like this:
If the # of charges entered in the charges field is greater than or equal to
5 then "4", If the # of charges entered equals 3 OR 4 then "2", If the # of
charges equals 1 or 2 then "0". The first two parts of the expression work
but if I enter either 1 or 2 the query is bringing in the #2 not the #0. Any
insight?
 
Back
Top