setting the value of a text field based on the selection in a comb

G

Guest

hi,
i have a combo box that let you select 1 of 4 categories. Now I would like
the fee to populate based on the selection.
Example
if cat=1 then me.fee=40
if cate=2 then me.fee=60
so on and so for
Thanks for your help
 
G

Guest

Hi Fifi

You "can" use code (a bit like youe example) but a much simpler method would
be to add a second column to your combo and add the value into that column.

If you don't want this displayed when you "drop down" you can set the column
width to 0cm.

You can refer to the column in a formula if you want to use it.

Me.[fieldName].column(0) - This would be the 1st column
Me.[fieldName].column(1) - This would be the 2nd column as column counts
start from 0


Hope this helps
 
G

Guest

Thank you the both of you for your response but I think I asked my question
wrongly.
My combo box is linked to a table that has 4 categories. I want the fee to
be equal to 40 if category one is selected and if for example it is paid by
client.
Now if category one is selected and paid by company, then fee=50
Thank you for your help
 
G

Guest

I don't know how you determine who paid, but you can repace [ClientPaid] the
example below with a condition that will evaluate to True if the client paid.

Select Case Me.Cat
Case is 1
Me.Fee = IIf([ClientPaid], 40, 50)
Case is 2
Me.Fee = IIf([ClientPaid], 60, 70)
Case is 3
Me.Fee = IIf([ClientPaid], 80, 90)
Case is 4
Me.Fee = IIf([ClientPaid], 100, 110)
End Select
 
G

Guest

I apologize for the headaches. The form is for billing existing customers.
So I will always know who pays. Like I said I have a combo box for category
and another one for paidby, now I would like the fee to be determined
depending on the conditions.
Like if cat=1 and paidby=client then fee=20. Let's keep in mind that the
user is not typing in the cat or paid. They just have to select from a drop
down

Klatuu said:
I don't know how you determine who paid, but you can repace [ClientPaid] the
example below with a condition that will evaluate to True if the client paid.

Select Case Me.Cat
Case is 1
Me.Fee = IIf([ClientPaid], 40, 50)
Case is 2
Me.Fee = IIf([ClientPaid], 60, 70)
Case is 3
Me.Fee = IIf([ClientPaid], 80, 90)
Case is 4
Me.Fee = IIf([ClientPaid], 100, 110)
End Select

fifi said:
Thank you the both of you for your response but I think I asked my question
wrongly.
My combo box is linked to a table that has 4 categories. I want the fee to
be equal to 40 if category one is selected and if for example it is paid by
client.
Now if category one is selected and paid by company, then fee=50
Thank you for your help
 
G

Guest

Like I said in my last post, change [ClientPaid] to a condition that will
evaluate to True. I don't know the name of your combo box nor the values it
returns, so I can't write it for you.
If you want to know what to put the code, I would suggest it be in the After
update event of the second of the two combos involved. Also, because users
don't have to follow a bouncing ball. you may want to test the other combo to
make sure it is not null.

fifi said:
I apologize for the headaches. The form is for billing existing customers.
So I will always know who pays. Like I said I have a combo box for category
and another one for paidby, now I would like the fee to be determined
depending on the conditions.
Like if cat=1 and paidby=client then fee=20. Let's keep in mind that the
user is not typing in the cat or paid. They just have to select from a drop
down

Klatuu said:
I don't know how you determine who paid, but you can repace [ClientPaid] the
example below with a condition that will evaluate to True if the client paid.

Select Case Me.Cat
Case is 1
Me.Fee = IIf([ClientPaid], 40, 50)
Case is 2
Me.Fee = IIf([ClientPaid], 60, 70)
Case is 3
Me.Fee = IIf([ClientPaid], 80, 90)
Case is 4
Me.Fee = IIf([ClientPaid], 100, 110)
End Select

fifi said:
Thank you the both of you for your response but I think I asked my question
wrongly.
My combo box is linked to a table that has 4 categories. I want the fee to
be equal to 40 if category one is selected and if for example it is paid by
client.
Now if category one is selected and paid by company, then fee=50
Thank you for your help

:

Me.fee = Choose(Me.cat, 40, 60, 90, 3)
fill in the real values.

:

hi,
i have a combo box that let you select 1 of 4 categories. Now I would like
the fee to populate based on the selection.
Example
if cat=1 then me.fee=40
if cate=2 then me.fee=60
so on and so for
Thanks for your help
 
G

Guest

Klatuu, client paid is not boolean. I have a combo box named paidby that can
have 4 values: client, company, tbd, other.
Thank you

Klatuu said:
Like I said in my last post, change [ClientPaid] to a condition that will
evaluate to True. I don't know the name of your combo box nor the values it
returns, so I can't write it for you.
If you want to know what to put the code, I would suggest it be in the After
update event of the second of the two combos involved. Also, because users
don't have to follow a bouncing ball. you may want to test the other combo to
make sure it is not null.

fifi said:
I apologize for the headaches. The form is for billing existing customers.
So I will always know who pays. Like I said I have a combo box for category
and another one for paidby, now I would like the fee to be determined
depending on the conditions.
Like if cat=1 and paidby=client then fee=20. Let's keep in mind that the
user is not typing in the cat or paid. They just have to select from a drop
down

Klatuu said:
I don't know how you determine who paid, but you can repace [ClientPaid] the
example below with a condition that will evaluate to True if the client paid.

Select Case Me.Cat
Case is 1
Me.Fee = IIf([ClientPaid], 40, 50)
Case is 2
Me.Fee = IIf([ClientPaid], 60, 70)
Case is 3
Me.Fee = IIf([ClientPaid], 80, 90)
Case is 4
Me.Fee = IIf([ClientPaid], 100, 110)
End Select

:

Thank you the both of you for your response but I think I asked my question
wrongly.
My combo box is linked to a table that has 4 categories. I want the fee to
be equal to 40 if category one is selected and if for example it is paid by
client.
Now if category one is selected and paid by company, then fee=50
Thank you for your help

:

Me.fee = Choose(Me.cat, 40, 60, 90, 3)
fill in the real values.

:

hi,
i have a combo box that let you select 1 of 4 categories. Now I would like
the fee to populate based on the selection.
Example
if cat=1 then me.fee=40
if cate=2 then me.fee=60
so on and so for
Thanks for your help
 
G

Guest

How about you give us all the info so we can give the proper assistance?
This is the 3rd change in requirements.

Based on the newest info, I would suggest you go with Wayne's original
suggestion.

fifi said:
Klatuu, client paid is not boolean. I have a combo box named paidby that can
have 4 values: client, company, tbd, other.
Thank you

Klatuu said:
Like I said in my last post, change [ClientPaid] to a condition that will
evaluate to True. I don't know the name of your combo box nor the values it
returns, so I can't write it for you.
If you want to know what to put the code, I would suggest it be in the After
update event of the second of the two combos involved. Also, because users
don't have to follow a bouncing ball. you may want to test the other combo to
make sure it is not null.

fifi said:
I apologize for the headaches. The form is for billing existing customers.
So I will always know who pays. Like I said I have a combo box for category
and another one for paidby, now I would like the fee to be determined
depending on the conditions.
Like if cat=1 and paidby=client then fee=20. Let's keep in mind that the
user is not typing in the cat or paid. They just have to select from a drop
down

:

I don't know how you determine who paid, but you can repace [ClientPaid] the
example below with a condition that will evaluate to True if the client paid.

Select Case Me.Cat
Case is 1
Me.Fee = IIf([ClientPaid], 40, 50)
Case is 2
Me.Fee = IIf([ClientPaid], 60, 70)
Case is 3
Me.Fee = IIf([ClientPaid], 80, 90)
Case is 4
Me.Fee = IIf([ClientPaid], 100, 110)
End Select

:

Thank you the both of you for your response but I think I asked my question
wrongly.
My combo box is linked to a table that has 4 categories. I want the fee to
be equal to 40 if category one is selected and if for example it is paid by
client.
Now if category one is selected and paid by company, then fee=50
Thank you for your help

:

Me.fee = Choose(Me.cat, 40, 60, 90, 3)
fill in the real values.

:

hi,
i have a combo box that let you select 1 of 4 categories. Now I would like
the fee to populate based on the selection.
Example
if cat=1 then me.fee=40
if cate=2 then me.fee=60
so on and so for
Thanks for your help
 
G

Guest

I have two combo boxes: category and paidby
the category rowsource is the category table which has 4 choices, 1,2,3,
and 4
the paiby combo rowsource is the paidby table which has 4 choices also,
client, company, TBD, and other.

the category combohas four rows:1st row is 1,2nd is 2, then 3 , then 4.
for the paidby combo, it is client, company, TBD then other.
Again I want something like if category =1 (or is the 1rst row is selected)
and paidby=client ( or 2nd row is selected) then fee= x dollars.
if category =3 (or is the 3rd row is selected) and paidby=client ( or 2nd
row is selected) then fee= y dollars

I hope I was a little bit more clear this time. I really appreciate your help

Klatuu said:
How about you give us all the info so we can give the proper assistance?
This is the 3rd change in requirements.

Based on the newest info, I would suggest you go with Wayne's original
suggestion.

fifi said:
Klatuu, client paid is not boolean. I have a combo box named paidby that can
have 4 values: client, company, tbd, other.
Thank you

Klatuu said:
Like I said in my last post, change [ClientPaid] to a condition that will
evaluate to True. I don't know the name of your combo box nor the values it
returns, so I can't write it for you.
If you want to know what to put the code, I would suggest it be in the After
update event of the second of the two combos involved. Also, because users
don't have to follow a bouncing ball. you may want to test the other combo to
make sure it is not null.

:

I apologize for the headaches. The form is for billing existing customers.
So I will always know who pays. Like I said I have a combo box for category
and another one for paidby, now I would like the fee to be determined
depending on the conditions.
Like if cat=1 and paidby=client then fee=20. Let's keep in mind that the
user is not typing in the cat or paid. They just have to select from a drop
down

:

I don't know how you determine who paid, but you can repace [ClientPaid] the
example below with a condition that will evaluate to True if the client paid.

Select Case Me.Cat
Case is 1
Me.Fee = IIf([ClientPaid], 40, 50)
Case is 2
Me.Fee = IIf([ClientPaid], 60, 70)
Case is 3
Me.Fee = IIf([ClientPaid], 80, 90)
Case is 4
Me.Fee = IIf([ClientPaid], 100, 110)
End Select

:

Thank you the both of you for your response but I think I asked my question
wrongly.
My combo box is linked to a table that has 4 categories. I want the fee to
be equal to 40 if category one is selected and if for example it is paid by
client.
Now if category one is selected and paid by company, then fee=50
Thank you for your help

:

Me.fee = Choose(Me.cat, 40, 60, 90, 3)
fill in the real values.

:

hi,
i have a combo box that let you select 1 of 4 categories. Now I would like
the fee to populate based on the selection.
Example
if cat=1 then me.fee=40
if cate=2 then me.fee=60
so on and so for
Thanks for your help
 
G

Guest

Thanks, fifi, that helps.
In this case, I think, perhaps, an array would be in order. It would be a 2
dimensional array that would provide a matrix of fees by payee. Logically,
it would look like this (except for correct fees)
Client Company TBD Other
Cat 1 40 40 50 40
2 50 60 50 60
3 60 70 70 60
4 80 100 80 90

Then you can determine which item in each of your combos is selected, and
use those numbers to locate the fee in the matrix.

Fee = aryCatFees(CatIndex, PayeeIndex)

Now you can use the

fifi said:
I have two combo boxes: category and paidby
the category rowsource is the category table which has 4 choices, 1,2,3,
and 4
the paiby combo rowsource is the paidby table which has 4 choices also,
client, company, TBD, and other.

the category combohas four rows:1st row is 1,2nd is 2, then 3 , then 4.
for the paidby combo, it is client, company, TBD then other.
Again I want something like if category =1 (or is the 1rst row is selected)
and paidby=client ( or 2nd row is selected) then fee= x dollars.
if category =3 (or is the 3rd row is selected) and paidby=client ( or 2nd
row is selected) then fee= y dollars

I hope I was a little bit more clear this time. I really appreciate your help

Klatuu said:
How about you give us all the info so we can give the proper assistance?
This is the 3rd change in requirements.

Based on the newest info, I would suggest you go with Wayne's original
suggestion.

fifi said:
Klatuu, client paid is not boolean. I have a combo box named paidby that can
have 4 values: client, company, tbd, other.
Thank you

:

Like I said in my last post, change [ClientPaid] to a condition that will
evaluate to True. I don't know the name of your combo box nor the values it
returns, so I can't write it for you.
If you want to know what to put the code, I would suggest it be in the After
update event of the second of the two combos involved. Also, because users
don't have to follow a bouncing ball. you may want to test the other combo to
make sure it is not null.

:

I apologize for the headaches. The form is for billing existing customers.
So I will always know who pays. Like I said I have a combo box for category
and another one for paidby, now I would like the fee to be determined
depending on the conditions.
Like if cat=1 and paidby=client then fee=20. Let's keep in mind that the
user is not typing in the cat or paid. They just have to select from a drop
down

:

I don't know how you determine who paid, but you can repace [ClientPaid] the
example below with a condition that will evaluate to True if the client paid.

Select Case Me.Cat
Case is 1
Me.Fee = IIf([ClientPaid], 40, 50)
Case is 2
Me.Fee = IIf([ClientPaid], 60, 70)
Case is 3
Me.Fee = IIf([ClientPaid], 80, 90)
Case is 4
Me.Fee = IIf([ClientPaid], 100, 110)
End Select

:

Thank you the both of you for your response but I think I asked my question
wrongly.
My combo box is linked to a table that has 4 categories. I want the fee to
be equal to 40 if category one is selected and if for example it is paid by
client.
Now if category one is selected and paid by company, then fee=50
Thank you for your help

:

Me.fee = Choose(Me.cat, 40, 60, 90, 3)
fill in the real values.

:

hi,
i have a combo box that let you select 1 of 4 categories. Now I would like
the fee to populate based on the selection.
Example
if cat=1 then me.fee=40
if cate=2 then me.fee=60
so on and so for
Thanks for your help
 

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

Top