Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox disappears on click

Status
Not open for further replies.

Swamphen

Programmer
Jul 17, 2001
84
IT
Hello.

I'm a complete newbie to Access when it comes to forms.

I'm creating a form at the moment and when a radio button in an option group gains focus,a VB event procedure enables an associated combobox and makes it visible by:

Me.ComboNr.Visible = True
Me.ComboNr.Enabled = True

This works fine, but when I try to get the listing of the combox by clicking on the dropdown-arrow, the combobox disappears.

I created the comboboxes with the wizard and I chose the following options:

1 column, 4 values manually given in

Where should I look?

Thanks

Swamphen

 
What event is the code for making the combo box visible in and have you got it in any other event besides that one.
 
On Got Focus -> combobox is made visible and is enabled
On Lost Focus -> combobox is made invisible and is disabled

The associated code is only used in those events.

swamphen
 
I think your confusing the Got and Lost Focus events. I take it what your trying to do is that when the radio button is set that the combo box becomes visible. So in the change event of the radio button put

if optradio then
combobox.visible = true
else
combobox.visible = false
end if

and discard completely the get and lost focus events. I hope this is what your after. If it's not then please mail me back and explain what exactly it is your doing. Best of Luck

Mark
 
Maybe the word "radio button" was confusing. It's kind of a radio button, but it resides inside an option group.

Only these events are availabe:
- On Got Focus
- On Lost Focus
- On Mouse Down
- On Mouse Up
- On Mouse Move
- On Key Up
- On Key Press
- On Key Down

And indeed, the problem resides in the fact that, when clicking the combobox, the LostFocus event is triggered.
But OnClick is not available (or is there some kind of inheritance in VB?), so maybe it is not feasible at all?

Maybe I should use a multicolumn combo box, which isn't as aesthetic but will do the trick as well.

And still another problem? I need the possibility to check two or more options at the same time. Is this possible with some form control? And is it possible in Access to give a field two values?

A lot of questions...hopefully some answers too.

thanks

swamphen
 
All I can think of then is to put the above code in the lost focus event. It will mean that they will have to tab off the radio button to see the combo box. You could try putting it into the mouse up event as well. Thats actually a better one so as soon as the mouse is released it will check to see whether or not it needs to activate the combo box or not. Hope this has been some help.
 
Probably I wasn't clear in my problem description.
But that's because I'm just starting to work with forms and vbs and that sort of things.

Anyway, I found a working solution by trying a few options, namely a vbs script on the level of the frame (ie the option group):

Private Sub Frame249_BeforeUpdate(Cancel As Integer)

If Me.Frame249.Value = 1 Then
With Me.Combo264
.Visible = True
.Enabled = True
End With
End If

etc.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top