I need a code

  • Thread starter Thread starter Interpack
  • Start date Start date
I

Interpack

Hello I have 2 comboboxes named TYPE1 and TYPE2 and a textbox named CODE. I
need a code that will be something like if TYPE1 = "red" and TYPE2 = "flat"
then CODE must be "2352", and so on. The user should not enter textbox CODE
at all but it should have the data right after the comboboxes TYPE1 and
TYPE2 are filled. Can someone help me
Thanks
Jimmy
 
try this:
put this on code2_lostfocus

if ((type1.text = "red") AND (type2.text = "flat")) then
code.text = "2352"
end if
is this what u meant?
 
Interpack said:
Hello I have 2 comboboxes named TYPE1 and TYPE2 and a textbox named CODE. I
need a code that will be something like if TYPE1 = "red" and TYPE2 = "flat"
then CODE must be "2352", and so on. The user should not enter textbox CODE
at all but it should have the data right after the comboboxes TYPE1 and
TYPE2 are filled.

Where do you keep the relationshi[ between Type1, Type2 and
Code. Most likely, it should be in a table. If it is, then
you can look it up and place the value in the text box.
E.g.

Me.txtCode = DLookup("Code", "thetable", _
"Type1 = """ & Me.cboType1 & """ And Type2 = """ _
& Me.cboType2 & """"

There are other ways that may be easier, but they depend on
how you've set up the combo boxes and the tables they're
based on..
 
Back
Top