Combo box will not select

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 12:15
Joined
Feb 28, 2001
Messages
29,677
First, hi to all. I've been away for a while because I'm up to my ... rear... in alligators down here in South Louisiana. I have a pair of big projects that have taken up all of my time, so I haven't visited lately.

Second, I don't expect anyone to actually be able to directly solve the poblem because I cannot post this database for review. I'm on a U.S. Government site that is rather picky about posting a database owned by the government. I'm looking for suggestions of where to look. This emoticon best describes what is going on with me right now.

:banghead:

Scenario: I am on WinXP Pro/Ac2k7 using my all-local development copy of a database that we use for tracking certain departmenal security events. I have a form that is bound to an underlying query. The form's navigation within the main query works OK. PageUP/PageDN work ok. Clicking navigation arrows works OK. The data shown by the main query is correct. It is responsive to navigation by any/all normal means.

What is vexing me is that I have occasion to want to filter the data shown by the primary query. So I put together some combo boxes to select one item from each of several categories. The idea is that if the user of the form selects one or more filters and then clicks the REFRESH command button, I will build a complex FILTER string and then turn FILTER ON to True and force the form to .REQUERY and .REFRESH itself. Ordinary enough, right? I've got several other forms that do the same thing so I set this form up the same way. I have comparison code to examine. At the moment, I'm having no joy whatsoever on this one.

The boxes start their existence not visible, enabled, or defined as a tab stop. They are in single-select mode (as opposed to multi-select). They are also locked. However, separate command buttons dynamically change some parts of that. Each of the offending combo boxes has only .GOTFOCUS and .LOSTFOCUS events. No .ONCHANGE or .ONCLICK or anything else. The .GOTFOCUS code changes the box from white to blue background to emphasize that it is selected. It also displays text in a dynamic HELPHINTS box that tells my user what that box represents. The .LOSTFOCUS code only blanks the HELPHINTS box and alters the color of the combo box.

When I click the button to change (for example) from "ALL SERVERS" to "SINGLE SERVER" mode, the button's .ONCLICK code enables the [SelServer] combo box (as described below) and does a .REQUERY to reset everything. To enable the boxes, I set them to .VISIBLE = True, .ENABLED = True, .LOCKED = False (plus some color selections based on my form's color scheme.) Their row sources are each based on a simple, single-table query. For example, the .ROWSOURCE for selecting a specific server is

SELECT [SRVName],[SRVID],[PRJID] FROM qtSRV ORDER BY [SRVNAME];

There are combo boxes for other factors such as user, project, and action request. Again, they are all simple, single-table queries. They all exhibit the same non-selection behavior.

The problem is that the combo boxes won't select anything. To try to understand this, I put a breakpoint in the combo box's .GOTFOCUS event and open the Locals Window. On-screen, the box is visible. The Locals Window verifies the state of the box as I described above.

When I click the down-arrow at the right end of the box, the drop-down list is the correct list for that box. But when I click on any row of the box, it doesn't select anything. I.e. my selection doesn't "stick."

So what I am asking is this: Can anyone offer suggestions for things that would prevent an enabled, visible, unlocked combo box that shows correct data to nevertheless not select a row when I click on it?

:banghead:
 
Richard, nice to see you. I've seen that if the form's AllowEdits property is set to no.
 
Richard, nice to see you. I've seen that if the form's AllowEdits property is set to no.
 
Hi, Bob. Good to hear from you again. I had forgotten that one. I'll have to check it and let you know what is going on. It is plausible because the original form on which this was based was a view-only form for which editing was not allowed. Now that its dataset has gotten quite large, I needed the filters to find a particular user's problem. So that could be it.

Thanks for the pointer!
 
:)

That was it, Bob. The parent of the cloned form had been set to disallow edits and I forgot to check that fact.

I didn't really expect that because the selector drop-downs aren't bound to anything in the form's "real" underlying record. They were just going to feed the filters. I wasn't really editing the record, but I guess Access isn't smart enough to see that the drop-down box has a .ROWSOURCE but no actual bound field.
 
Yep, it is a pain because there are times I could use it to have the combo able to be used but the actual form not editable. In those cases a parent form with the combo and then a subform set to not editable is how to get around that.
 

Users who are viewing this thread

Back
Top Bottom