Access 2000 Combo Box Question

G

Guest

Hi, I am new to Access 2000 so this is a pretty simple question. I
apologize in advance if my Access jargon is wrong. :)

I am currently designing a database form for simple data entry. I have
created a number of "field names" in the database table that I want to use in
designing my form. In the "design view" of my form, I have clicked and
dragged a number of my field names into the new layout. My problem is that
when I convert a text-entry only field into a combo box, there is no option
to customize what categories show up in the drop-down box. I can use the
tool box to create an entirely new combo box that has the desired categories,
but I do not know how to link it to the database so that it appears as a
field. Also, I do not know how to put this combo box in "tab-order" with the
rest of the form.

To be clear: I am trying to create a combo-box in my form that will be used
for data-entry purposes. I will use the combo box to select the hotel at
which a particular customer is staying.
 
D

David Lloyd

Diana:

You can use the Control Source property of the combo box to link it to a
field in the table. To customize the categories that show up in the combo
box use the Row Source Type and Row Source properties. These are all
located on the Data tab of the properties for the combo box. Use can get
help for these properties by pressing F1 and clicking in the box for the
respective property.

For the tab order, use the Tab Stop (yes) and Tab Index (this is the order
relative to the other controls) properties on the "Other" tab of the combo
box properties window.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hi, I am new to Access 2000 so this is a pretty simple question. I
apologize in advance if my Access jargon is wrong. :)

I am currently designing a database form for simple data entry. I have
created a number of "field names" in the database table that I want to use
in
designing my form. In the "design view" of my form, I have clicked and
dragged a number of my field names into the new layout. My problem is that
when I convert a text-entry only field into a combo box, there is no option
to customize what categories show up in the drop-down box. I can use the
tool box to create an entirely new combo box that has the desired
categories,
but I do not know how to link it to the database so that it appears as a
field. Also, I do not know how to put this combo box in "tab-order" with
the
rest of the form.

To be clear: I am trying to create a combo-box in my form that will be used
for data-entry purposes. I will use the combo box to select the hotel at
which a particular customer is staying.
 
G

Guest

The values in combo box's list are controlled by its RowSource property.
What you need to do therefore is, when you've changed the control bound to
the field in question to a combo box, to set its RowSource property
accordingly. Before you do this, however, you'll need a table of Hotels with
each hotel name appearing just once in a single column in the table.(I'm
assuming no two hotels have the same name).

Once you have this table you can then create a query which lists all the
hotels in alphabetical order by sorting the query on the Hotel column. All
you need to do then is open your form in design view, select the combo box
and in its properties sheet enter the name of the query as the RowSource
property. You'll find this on the Data tab of the properties sheet. Make
sure that the RowSourceType property is set to table/Query too. You don't
actually need to create the query as such; you can simply use the SQL as the
RowSource property, but creating a query is probably simpler at this stage if
you are new to this sort of thing.

To add a new hotel not in the list you have to add a new row to the Hotels
table first. There are ways you can automate this from the combo box on your
form, but lets get the basic functionality sorted out first before we tackle
that.
 
A

Avlan

I'd advice you to NOT put anything in a controls properties box except
the name and appearance. No code. If you put code there, and you have
50 controls in the end, you will have to check every one of them
manually if you want to debug.

If you put all code in your forms code window, you will have all code
neatly collected in one place. If theres a code problem, you know where
to look (and for instance, you can use 'find' to find a term or name.)

Put smt like this in you onload_form code:

Control.RowSource = "SELECT [name] FROM [hotels]"

Where 'hotels' is your tables name and 'name' is the column name with
the hotel names.

Check out www.w3schools.com for some basic SQL tutorials ("SELECT
[name] FROM [hotels]" is a SQL query.)
 
G

Guest

Thanks to all of you! I am able to use the combo box function now. I really
appreciate your help. :)

Sincerely, Diana
 

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