convert text box to combo box

G

Guest

Hi guys. I currently have a text box on a form that always has the same
things put in. What I would like to do is create a table that has those
values in it and convert the text box to a combo box bound to that table.
I've tried doing this before, but it created a lot of work for me because I
ended up having to go back to the table in datasheet view and select the
value that is supposed to be in the combo box from the list (if you were to
click on the value initially, it would tell you that the data entered didn't
match the type i.e. number or text that it was supposed to be). Really what
I would like to happen is probably a little to complicated, but here it is
(I'm sure someone here is smart enough to figure it out): the field is
actually a rank field. the people in the database are either a marine or
navy. I intend to put two check boxes on the form (one marine, one navy) to
specifiy which branch the person is in. I want to be able to type a paygrade
in (say E3 or E-3) or an actual rank (say PFC or PO1) and depending on the
check box, it would display the equivalent rank for that branch. For
example, if Marine is checked and I put in E4, it displays CPL. If Marine is
checked and I put in lcpl, it displays LCPL. If Navy is checked and I put in
e-5, it displays PO2. If Navy is checked and I put in cpo, it displays CPO.
I know this is a long post and I'm asking a lot, but I have to give someone
out there something to do today! Remember, right now all I have is a text
field with about 600 records that need to be converted.
 
B

BruceM

First, you will need to ensure that only one check box at a time can be
checked. You could use the After Update event of each one:
Me.chkMarine = Not Me.chkNavy
It would probably be simpler to use an option group.
I think it could get complicated if you want to type one of two different
values into a text box and have the corresponding value show up in another
text box. It will be simpler to use a two-column list (both rank and
paygrade) in the combo box.
Since some ranks such as Captain are in both services, I expect you will
need to adjust the combo box row source depending on whether Marine or Navy
is checked. Is there a field in the Rank/Paygrade table that identifies the
record as being for one service or the other?
I doubt this is as complicated as you fear, but it is not entirely clear
just what you want to do. For one thing, what do you mean by "I currently
have a text box on a form that always has the same things put in." A text
box is bound to a field, or it is unbound and used for a specific purpose,
so I don't understand the comment.
 
G

Guest

The "Rank" text box on the form is bound to the "Rank" field on my table. I
guess what I really want then is some code for the after update event of the
text box that will automatically adjust what is shown and what is put in the
table after typing in the various examples I gave. I could create a table
that would have the various paygrades and ranks, and it could look up in the
table what the value shown should be and what should be put in the main table.
 

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