Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / June 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
fifi - 29 Jun 2006 16:37 GMT
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
Wayne-I-M - 29 Jun 2006 17:31 GMT
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

Signature

Wayne
Manchester, England.

> hi,
> i have a combo box  that let you select 1 of 4 categories.  Now I would like
[quoted text clipped - 4 lines]
> so on and so for
> Thanks for your help
Klatuu - 29 Jun 2006 19:13 GMT
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
[quoted text clipped - 4 lines]
> so on and so for
> Thanks for your help
fifi - 29 Jun 2006 21:02 GMT
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.
[quoted text clipped - 7 lines]
> > so on and so for
> > Thanks for your help
Klatuu - 29 Jun 2006 21:10 GMT
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.
[quoted text clipped - 15 lines]
> > > so on and so for
> > > Thanks for your help
fifi - 29 Jun 2006 21:17 GMT
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.
[quoted text clipped - 29 lines]
> > > > so on and so for
> > > > Thanks for your help
Klatuu - 29 Jun 2006 21:25 GMT
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
[quoted text clipped - 37 lines]
> > > > > so on and so for
> > > > > Thanks for your help
fifi - 29 Jun 2006 21:53 GMT
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
[quoted text clipped - 45 lines]
> > > > > > so on and so for
> > > > > > Thanks for your help
Klatuu - 29 Jun 2006 21:58 GMT
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.

> Klatuu, client paid is not boolean.  I have a combo box named paidby that can
> have 4 values: client, company, tbd, other.
[quoted text clipped - 49 lines]
> > > > > > > so on and so for
> > > > > > > Thanks for your help
fifi - 30 Jun 2006 13:57 GMT
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

> How about you give us all the info so we can give the proper assistance?  
> This is the 3rd change in requirements.
[quoted text clipped - 55 lines]
> > > > > > > > so on and so for
> > > > > > > > Thanks for your help
Klatuu - 30 Jun 2006 14:49 GMT
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

> I have two combo boxes: category and paidby
>  the category rowsource is the category table which has 4 choices, 1,2,3,
[quoted text clipped - 70 lines]
> > > > > > > > > so on and so for
> > > > > > > > > Thanks for your help
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.