Setting the value of text field based on 2 combo boxes

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

Guest

hello
I would like to set a value to a text field depending on the value of 2
combo boxes.
for example the combo box1 has category 1,2,3 and 4
combo box 2 has paidby client, company tbd, and other

Now i would like the fee ( which is a plain text field) to display a value
based on the values of the two combo boxes
for example if category =1 and paidby=client then fee =40
if category=1 and paidby=company then fee=30


Your help will be greatly appreciated
 
Hi fifi,
To answer your question please provide us with some details

1. category combo name
2. paidby combo name
3. category combo RowSource
2. paidby combo RowSource
 
My suggestion would be to load a new table (lets call it tblLookup) with all
of the combinations of combo box1 and combo box 2 in seperate columns along
with the respective Fee.

IE:

Combo1 |Combo2 |Fee
1 Paid By Client $20
1 company tbd $30
1 Other $40
2 Paid By Client $25
2 company tbd $35
2 Other $45

etc....

Then in your code you get your value simply have a line like this

FeeResult = DLookup("Fee","tblLookup","Combo1=" & me.ComboBox1 & " AND
Combo2 = '" & Me.ComboBox2 & "'")


Done


Mr. Smith
 
Thanks for the response,
1. the category company name is category
2. the paidyby combo name is mailbox paid by
3. the category rowsource is the category table which has 4 choices, 1,2,3,
and 4
4. the paiby combo rowsource is the paidby table which has 4 choices also,
client, company, TBD, and other.
Thank you for your help
 
My combos don't have any SQL, at least not that I am aware of. I created
using a wizard and I chose the 1rs option ( look up the value from a table).
Maybe that's the problem. Any suggestions.
I am getting desperate
 
Mr. Smith,
I am not sure I understand your suggestion. Can you please give me more
details?
Thank you so much for your time
 
Hi fifi

I have to go now, and I wont be around until tomorow if you have no luck,
you can post the mdb to
chamudim <@> hotmail <dot> com

Specify the form name, and I'll check that, if you do, please ZIP the file,
either wise hotmail will reject it
 
Thanks Ofer for your help,
I ended using option group instead of combo boxes.
But the problem i am encountering now is that the value 1,2 ,3 shows in the
table instead of the actual value.
for example when i created the paid by option group, i made company=1 to
client=2, and so on.
How do i make company, client show on the table instead of 1 or 2?
 

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