combo boxes
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access Training and help » Combo Boxes

Combo Boxes

resolvedResolved · Medium Priority · Version 2007

replyReply Thu 10 Apr 2008, 12:09Delegate Sarah said...

Sarah has attended:
Access Intermediate course
Access Intermediate course
Access Advanced course
Project Management course

Combo Boxes

Hi -

I have a form (based on one table) on which I have added a Combo box in order to quickly select which company is shown on the form. My form is already created and when you open it it automatically defaults the sorting of Company Name by A-Z, which is ideal. When I put my Combo Box in (via the wizard on the form) my list of names in there is not sorted at all and I cannot figure out how to make it default to sort A-Z on Company Names like the form does.

Without the ComboBox being sorted it is as good as useless for a quick selection tool.

Also - is it possible to have a combo box (or another search tool) on a sub-form?

Please help!

Thanks

For upcoming training course dates see: Pricing & availability

replyReply Tue 13 May 2008, 16:21Trainer Richard said...

RE: Combo Boxes

Hello Sarah,

Hope you enjoyed your Microsoft Access courses with BEST Training.
Thank you for your question regarding Combo Boxes.

1.ORDERING COMBO BOX LIST
As the content of a Combo box list is generated by an SQL query, it makes sense that if we modify the query or data source, then the list will also change.

To make this change, switch to the properties window of the combo box, then select the DATA tab.
Under ROW SOURCE, click the three dots (...) at the end of the property to launch the query builder.
Sort the field you want ordered
Close the query, click on YES.
This will update the SQL statement and sort the list.

An alternative is to build the Combo box from scratch by using the TOOLBOX and Wizard. During this process, one of the options is to sort the fields.

2. COMBO BOX IN SUBFORM
Best way to do this is to ensure that the combo box exists at the TABLE level and then it will show through to the form. I suggest you make a copy of your database, test your changes, and once you are confident in makeing the changes then implement to your live database.

Here is an example
Let say you have a Supplier and a Product table.
The Product table will have a field that looks up the Supplier name - should be a Lookup field (in other words, Combo Box!)
Once you have set this up, make a simple form from the Product table. Notice how the Supplier field is a Combo box!
Apply this thinking to your subform, and let me know what you come up with.

I hope this resolves your question. If it has, please mark this question as resolved.

If you require further assistance, please reply to this post. Or perhaps you have another Microsoft Office question?

Have a great day.
Regards,

Richard
Microsoft Office Specialist Trainer

 

Please browse our web site to find out more about
microsoft access training course and other Microsoft training courses.

Access tip:

Calculating The Difference Between Dates

If you wish to calculate the time between two date fields, this can be done in a number of ways:

1. As a calculated field in a query
2. As a calculated control in a form or report
3. As a calculation in a VBA procedure.

The basic syntax to get the number of days between two dates is:

=[One Date Field] - [Another Date Field]

You can also use one of the following functions:

=Month([One Date Field] - [Another Date Field])
which calculates the number of months between the two fields

=Year([One Date Field] - [Another Date Field])
which calculates the number of years between the two fields.

Another function is the DateDiff() function.

It uses an argument to determine how the time interval is measured. For example:

=DateDiff("q",[One Date Field] - [Another Date Field])
returns the number of quarters between the two fields.

Other intervals that can be used in this expression are as follows:
"yyyy" - Years
"m" - Months
"d" - Days
"w" - Weekdays
"ww" - Weeks
"h" - Hours
"n" - Minutes
"s" - Seconds

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard