How to fill in field from a drop down

enriquephoenix

New member
Local time
Today, 08:33
Joined
Apr 19, 2007
Messages
6
Please help, how do I make this drop down fill in the information in the grade field?
 

Attachments

Ok - I have not looked at this - but what you need to do is

1- set up a query that has all the information in it that you require save qry as xxxxxx
now have a combo box use the wizard and tie it to xxxxxx

now you need to get to after update properties onthe combo box and get .... select code

you now have the combobox properties

now the fields on your form/table that you want populated
will correspond with the qry xxxxxx

so after updateing the comob
you will want field on form to equal the field in the qry
Note access starts counting from 0 - so 0 will be the first column in the qry-

so example
name =combobox.column(0)
address=combobox.column(1)
etc

now you need to tidy this up with 2 extras
one would be a save and the other refesh

if you don't put a refresh in any changes int he combox will not be reflected in your table/form
the save might not be requried - but i also put one in just for the hell of it ..

g
 
enriquephoenix,

Here is your sample back, with combo working.
 

Attachments

Ansentry, thanks for your reply. It works and does the job, but it is not what I am looking for. I need to keep the same structure as I put in my example. There is alot going on on this form, and I need it to update the field in this manner. I hope somebody can help me. Thanks...
 
I need to keep the same structure as I put in my example.
No, what you really NEED to do is to design the database properly and ASentry has provided you a semi-step towards that. Just looking at the structure you currently have tells me that whatever you are planning to do, you are heading down the road of "heartache" and lots of pain when trying to pull MEANINGFUL data from this.

There have been many examples of student tracking databases and structure bantered around here so you should be able to get an idea. Also look into NORMALIZATION as that is EXTREMELY important.

Of course, if this is just a school project for a class you are taking, and you've been given instructions to make a combo box update a text box then that is different.
 
Ok, here is the reason that I think I need to somehow change this. Everything works great, but in “tblstudents”, it shows the “gradeid” for the grade and not the grade itself. This is fine but I have to keep track of these values, but the VBA script that I am using to keep track of any changes will no give me the grade, it will only give me the “gradeid”.

I guess what I am getting at is that if I use the “gradeid” then I have to find a way to convert the number back to a grade. Therefore, I am trying to just have the combo box fill in the text box, since I know the data will be the grade itself.

I hope this makes sense.
 
I guess what I am getting at is that if I use the “gradeid” then I have to find a way to convert the number back to a grade.
That is what queries are for. You link your tables together and display the parts you want to display. So you would add the two tables to your query and then display the name and then the grade name from the other table.
 

Users who are viewing this thread

Back
Top Bottom