Sorting a Combo box in a Query

jonobugs

Registered User.
Local time
Yesterday, 16:09
Joined
Apr 15, 2013
Messages
70
I'm using a simple query to enter data into a table and I was wondering how I could sort data that's coming from another table so that when I select the data it's easy to find.

I know that I could use the wizard tool to do this within the table, but I don't want to do this because I've had troubles later on when I use the combo text box directly in the table.

I tried invoking a query by clicking on the row source and it seemed to work, but nothing happens and if I try to edit the query, it's gone.

I'm just wondering why it's so easy to do when you do this in the table design but you can't seem to do it afterwards in a query. Or at least, I can't.

NOTE: I'm not interested in sort the query data itself, just the list that pops up when I select the studentID (which is just their name)
 

Attachments

  • student.jpg
    student.jpg
    77.3 KB · Views: 77
I wouldn't use lookup fields in a table - they will give you all sorts of issues later in life...
You also shouldn't be editing data directly in the table, always use a form. When you use a form you will find you can build a combo using the wizard that will be configurable exactly as you want it.
 
Hi Minty,

Yes, that's exactly why I wasn't using the lookup field in a table. I was trying to do it with a query. I didn't want to make a form because it's not something I would regularly input so I just wanted something quick. It works well, except when there are two students with the same first name.
 
Yes, that's exactly why I wasn't using the lookup field in a table. I was trying to do it with a query.

We avoid entering data in queries for exactly the same reason we avoid entering data in tables. Access (and other database) treat tables and queries almost identically.

I didn't want to make a form because it's not something I would regularly input so I just wanted something quick. It works well, except when there are two students with the same first name.

"It works well except" really means "it doesn't work well". Create a form.
 
We avoid entering data in queries for exactly the same reason we avoid entering data in tables. Access (and other database) treat tables and queries almost identically.



"It works well except" really means "it doesn't work well". Create a form.

Ha ha ha...you're so right. I just meant, that it was 'working' for me until I wanted to have it list the names in order -- then it STOPPED working for me.

Anyway, I avoid working directly from the tables, and I read that I should work from queries. I guess you can't believe everything you read. I always wondered why it was supposed to be safer working from a query rather than a table...I guess it isn't.

So, I made a form and I had trouble figuring out how to get a name from the Foreign key. I found that I needed to change the text box into a combo box before I could make a query that would allow me to use a lookup box that was sorted.

Thanks for the help!
 

Users who are viewing this thread

Back
Top Bottom