Scott Jackson
Scott Jackson

Reputation: 31

SQL 2000, Access Query

I have a SQL database where one of my fields 'Status' has one of 10 entries in it (not from a dropdown list). I let some people have access to the data through an Access database, they can add and modify entries.

My question is, in Access, how can I make it so that the 'Status' field is a drop-down list from which the users can choose from (the 10 entries which are already in the SQL database)? It would be easier for them and also mean that mistakes cannot be made.

Many thanks

Scott

Upvotes: 1

Views: 112

Answers (4)

Andomar
Andomar

Reputation: 238296

In Access you can add lookup information to a column. That will automatically display a dropdown list.

Step 1: Start the lookup wizard:

alt text

Step 2: After the wizard, the lookup settings should look like this:

alt text

Step 3: When your users open a table, they should see the dropdown box:

alt text

Upvotes: 1

David-W-Fenton
David-W-Fenton

Reputation: 23067

Several issues here:

  1. table datasheets are not suitable user interface for users.

  2. you can create a saved QueryDef and if you view the properties of a field, the second tab is just like the second tab in table design, and allows you to use a combo box as your display type in your query. I would generally recommend against this, as, like table datasheets, a QueryDef is not a proper UI element, and if you use the saved query in other queries, you can run into the same problems that cause lookups in table fields to be such as bad idea.

  3. you're building a UI, so use the tools that Access provides you for building a UI. That means a form. Your form's recordsource would have the bare data, and you'd create a combo box on your form that is bound to the field in the table behind your form, and displays the values from the lookup tables. There's a wizard to step you through this. If you like the look of datasheets so much (column sizing, sorting, show/hiding are all features that are nice in datasheets), you can set your form to display as a datasheet.

My advice is that for building a user interface, use the tools Access provides for creating user interface. In my opinion, a dropdown list belongs in a form, and nowhere else. While I occasionally might add one to a query for quick-and-dirty editing, I would never do that in objects that users are going to use.

Upvotes: 0

Fionnuala
Fionnuala

Reputation: 91376

The usual way to do this is to use a combo box on a form with the row source taken from the look-up table and the bound column set to the field (column) of the table to be updated.

Upvotes: 1

nyn3x
nyn3x

Reputation: 919

In addition to the solution described by Andomar you must not use another table as the source for your lookup. You can also provide the lookup-values in a list, which is hardcoded in the table-definition. This is fine for simple scenarios where the lookup is something that is not likely to be changed.

Upvotes: 0

Related Questions