I need a code

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
 
D

Dina

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?
 
M

Marshall Barton

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..
 

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

Similar Threads


Top