Connecting ADODB to a combobox

Johann
Lounger
Posts: 38
Joined: 03 Feb 2013, 15:23

Connecting ADODB to a combobox

Post by Johann »

help! =)


How to connect the records in a column from database to one combo box. The records in the column will be the data for the combo box. THank you =). Need ASAP




*PS. Who has a reservation system there? :)). Can I see it. Thank you. :)
Student here.
Johann/Yuwan

User avatar
HansV
Administrator
Posts: 78642
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Connecting ADODB to a combobox

Post by HansV »

Added: since you mentioned a database, the reply below is for Access. But perhaps you want to use the combo box in another application. If so, please specify.

Open the form in design view and select the combo box.
Activate the Data tab of the Property Sheet.
S097.png
The Row Source Type property specifies how the combo box will be populated:
- Table/Query: the data come from a table or query (this is the default setting)
- Value List: the data are typed directly into the property.
- Field List: the combo box will list the field names of a table or query.

We need Table/Query here. With this setting, the Row Source property can be the name of a table or query in the database, or a SQL string that represents a select query.
In the screenshot above, the Row Source property contains the name of the Categories table.

By default, the combo box will display the first column of the row source. If you want to change this, activate the Format tab of the Property Sheet.
S098.png
In the above screenshot, the Column Count property of the combo box has been set to 2, and the Column Widths property to 0cm;2.54cm.
This means that the combo box has two columns, but the first one will be hidden (its width is 0), so the second column will be displayed.

PS: "reservation system" is rather vague. What would it be used for?
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Johann
Lounger
Posts: 38
Joined: 03 Feb 2013, 15:23

Re: Connecting ADODB to a combobox

Post by Johann »

Thank you. You always reply to my questions. =D. I'll try this now.


The reservation system is our project. I would like to use it as a guide if someone has one. =)
Student here.
Johann/Yuwan

User avatar
HansV
Administrator
Posts: 78642
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Connecting ADODB to a combobox

Post by HansV »

Can you tell us what kind of reservations the database is intended for?
Best wishes,
Hans

Johann
Lounger
Posts: 38
Joined: 03 Feb 2013, 15:23

Re: Connecting ADODB to a combobox

Post by Johann »

Reservation for a cruise.

The system includes
1.) search
the system will look for available ships for a certain cruise
2.) reservation
the system will reserve the cruise if there is an available one. Including the prices, rooms etc.



I can't understand how to do that. Thank you =)
Student here.
Johann/Yuwan

User avatar
HansV
Administrator
Posts: 78642
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Connecting ADODB to a combobox

Post by HansV »

Making reservations for hotel rooms is similar - see if you can adapt the data model from Hotel Room Booking Scenario for your purpose.
Best wishes,
Hans