Full Version: ComboBox and tables
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
S_R_T
table1 = student information From 1 = based of table 1
table2 = Student type Form2 = based of table 2

form1 has a combo box that looks up values from table 2, then save the selection in table 1

table 1 ends up giving me the values of the selection not the selection it self

example
table 2 has B.A, Masters, Or 2 year
when it gets stored in table 1 i get the 1, 2 or 3 values not the names it self like B.A, MASTER etc?

how can i make it give me the name?

please help , thank you guys
Fletch
Most likely, you have the 2 tables related by a primary - foreign key relationship. Moreover, you probably have autonumbers as the primary key for each table. As such, you want the key value (e.g. 1, 2, etc.) stored and not the name. You can always retrieve the the name of the degree from the table whenever you need it. If you want to actually see the degree in the table itself, you can set up the table to be a combobox or listbox for the given field, supply a good SQL statement, and then have the bound column have a width of 0".

In this manner, if you have B.A as a degree but later want to change it to be B.A. or Bachelors or something else, you don't have to go and update everyone's individual record.

Does that make sense? frown.gif

For pedagogical purposes, though, if you did want to actually save the value you would change the bound column and/or the SQL which supplies the data for the combo box on Form 1.

HTH frown.gif
S_R_T
I think it does make sense sir, i am more of a hands on person, once i implement your words, i will get the bigger picture

Thank you so much, and if i have more question to that point i will make sure i find you lol


thank you again
S_R_T
I am jsut not getting the big pciture, here is the download, if you would like , just set one table for me where i can see the actual value and i will do the rest

I am sorry if i am asking for too much, offcourse you dont have too but you seem like a nice guy

thank you so much for your previouse help anyways
Fletch
Okay, made some changes to your db--see if they make sense.

Here's a short list of what I did:

1) Look at the tables with NEW in their name--they're modified--not perfect, but better I think. Of greatest note, the courses table's fields are almost all changed to number data types since they all reference other fields.

2) Look at the relationships (Tools->Relationships).

3) When you open the courses table (not the form), notice how it appears that there is text in each record. However, these are really all numbers. If you look at the design, you'll notice under the Lookup tab of each field is SQL referencing the table and the fact that I made the column width of the column holding the primary key, an autonumber, to 0. Therefore, the user doesn't see the number since it's meaningless to the user.

4) I'm not sure if course and student ID's are manufactured by you, or if it matters what they are. I went with the assumption that you may need to assign a specific ID to each. However, I still added a primary key to each table since I like that approach to relating tables. There is another field where you can enter a text ID if needed for each.

5) On the courses form that I generated with a wizard real quick (so, needs a lot of clean up/formatting) you'll notice that you have combo boxes for each item. The SQL for each one was automatically generated by the wizard since I set it up that way in the table design. Likewise, the labels all had good names since I gave a caption to each field. You may also note for the student name how the last and first names are concatenated into one field for that combo box.

The key is to remember that inside Access it's really storing all the related fields into the courses table with a number--but, you really never see it unless you want to.

Obviously, what I've given you isn't done by any means, but I hope it makes sense. Also, as a side note, you have established a number of one-to-many relationships. For example, one disability may be associated with one course. However, is it ever possible that there may be multiple disabilities associated with a single course (or any of the other fields)--in that case, you may need to set up a many-to-many relationship.

So, to recap--not perfect and not complete, but I hope the attached DB helps! frown.gif
S_R_T
MAN, ????
Thank you so mu8ch, that is so nice of you,l i like evetrything you have done, it is a great start for me to create the project that i want,
you are great

Thank You
Thank you
Thank you

S_r_t
Fletch
Sure, glad to help! Hopefully it all makes sense to you! frown.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.