Combo Box on Toolbar (1 Viewer)

shadow9449

Registered User.
Local time
Today, 15:26
Joined
Mar 5, 2004
Messages
1,037
After several nights of reading through the documentation on the ability to add a combo box to a toolbar, I have not been able to create a combo box with more than one column and hide the key column.

Here's my goal (I think that many people would want to do the same):

In any database that deals with a client table, a good way to access a client's record is by putting a combo box on the client screen with (at least) 2 columns, one is the client's ID and the other is a Last, First field. (I usually put another column with phone number as well). The user selects the client and the value of the combo box is set to the (hidden) ID field and the AfterUpdate event pulls up the appropriate recordf.

My idea is to put this combo box right on the toolbar for easier access. You may want to call up a client even if the client screen happens not to be open.

The combo box on toolbars seem to work with indexes rather than allowing you to hide (or size) a column, making this seemingly impossible.

Another issue I found is updating the contents of the combo box.

Since Access doesn't refresh the contents of a combo box, I always set mine to have no rowsource. In the OnGotFocus event of the combo box, I assign the rowsource programatically to the client list (or whatever list the combo box is meant for) so you always get up to the minute results. The amount of time that it takes to load 10,000 names into there even over a LAN is so fast that the user doesn't notice that it's loading.

I'm not sure what would happen if I had to do the same with the toolbar combo box. First of all, I'm not aware of any OnGotFocus event so you'd literally have to keep refreshing the contents every time someone changed, added or deleted a client from the client table. To refresh the contents, it seems that you can't just set the rowsource to a SQL recordsource. (The way I did it was to have a loop go through my database using DAO and using the AddNew command for each client). You would actually have to loop through, clearing out every item and then adding them back in each time someone updated the client database.

All the above is based on what I was able to derive from the documentation that Microsoft has provided for this feature. I do see that there are many events, styles and properties of the combobox that have scant explanation and I'm hoping that someone with more knowledge can help me out here with the problems I'm having. I think this can be a wonderful and much-overlooked tool for many Access developers if it can be used as I want to.

Thanks

SHADOW
 
R

Rich

Guest
Putting the combo in the form header is much easier, why create work? Or just create a pop up form that looks like a toolbar
 

shadow9449

Registered User.
Local time
Today, 15:26
Joined
Mar 5, 2004
Messages
1,037
Putting the combo in the form header is much easier, why create work? Or just create a pop up form that looks like a toolbar

Why do people like you always have to try to simplify things?? ;)

Ok, the answer is that there already is a combo box in the client form and it has more functionality, actually. There are 3 radio buttons on top allowing you to search by name, phone or invoice number. The problem is that you can need to lookup or access a client while the client screen is closed. Imagine you're running your month end reporting and you have a number of reports open and active, and someone comes in to buy something or you need to check someone's account for reference. In many programs there are so many other features that you may be working on with the client screen closed that this combo box would be a great tool.

SHADOW
 

Users who are viewing this thread

Top Bottom