Combo Box On Click

  • Thread starter Thread starter Leslie
  • Start date Start date
L

Leslie

I have a few combo boxes on my Form and the OnClick,
OnEnter, doesn't work.
Any advice?
Thanks

Leslie
 
Leslie,

Your posting provides very little information that would allow someone to
offer a diagnosis or provide suggestions. Just saying: "doesn't work" may
explain it all to someone who can *see* your application - but we cannot.

You may want to provide the following information:

1. What is it that you expect your combo box(es) to do?
2. What happens when you click on the combo box? An error message?
Incorrect data? Nothing?
3. Are you using code associated with the events you question? If so,
post the relevant code AND if the code is failing, indicate which line of
code fails.
4. On what type of form are you using these combo boxes? Single form or
continuous? Bound or unbound?
5. Are the combo box(es) bound or unbound?
 
Cheryl,

I should've provide more information, however I indicated
that the OnClick,
OnEnter, doesn't work.

Basically my problem is, any code/event I put in for the
combo box doesn't work. I even tried DoCmd.Close and
nothing happens.

I also tried to insert a new unbound Combo box with the On
Click event as DoCmd.Close with no results

Please advice

Thanks
Leslie
 
Basically my problem is, any code/event I put in for the
combo box doesn't work.

Yes, this is what you said in your original post; and it's no more
illuminating. If you want some code to run when your cursor first enters
the combo box, try the Got Focus event. If you want some code to run when
the value in the combo box is changed, try the After Update event.

Unless you can tell us *what you want your code to do* and post the code,
the only thing I can suggest you do is: Try another Event
 
Geezus Cheryl how much do you want???

I have the exact same problem. Using Access XP regardless of the file
format the .adp file is saved in. Be it 2002 or 2000.

I have the following code as an event procedure for the On_Click event
for a combobox. Not rocket science, just one function call.

**************

Private Sub cboResourceCompanyID_Click()

FillComboBox "vw_ResourceCompanyNames"

End Sub

**************


It doesn't run. Equally...


**************

Private Sub cboResourceCompanyID_Click()

msgBox "Doesn't work",vbOKOnly,"What the...?"

End Sub

**************


....doesn't work.


You could have tried that and saved us all a lot of heartache.

When I set a break point on the line "Private Sub
cboResourceCompanyID_Click()" in the code above, then single click the
combo box on the form (when its running of course), nothing happens.

I have several other combo boxes I tried to do this for with the same
result and replicated the problem on another fresh form as well. The
form works in every other way in a proper, predictable fashion. I
should also point out that "[Event Procedure]" certainly DOES appear in
the On Click event of the Properties window for every combo box tested.

I've been developing in Access since V2 and honestly can't remember ever
running an On Click event on a combo box before but as I try to now I am
finding this to appear very much like a critical bug for my purposes.

I have a requirement where I need the On Click event specifically as
opposed to an On Enter or Got Focus because I need for my user to be
able to tab across the field without the function "FillComboBox" being
called. I only want the function to occur if the user specifically
clicks on the combo box. The reason for this is because I load my form
with the combo set to Value list and supply the rowsource as a string
then switch to "Table/View/StoredProc" and populate it with an SQL
command only on demand. The following code is used and works as
expected when called from the GotFocus event:

(edited for brevity)********

Function FillComboBox(strSQL As String)

If Screen.ActiveControl.RowSourceType = "Table/View/StoredProc"
Then Exit Function

Screen.ActiveControl.RowSourceType = "Table/View/StoredProc"
Screen.ActiveControl.RowSource = strSQL

DoCmd.OpenForm "frm_Msg"
Forms!frm_Msg!lblMsg.Caption = "Creating List"
DoEvents

Screen.ActiveControl.Requery

DoCmd.Close acForm, "frm_Msg"

End Function

*****************************

This is done for performance reasons to enable the app to be efficient
over dial up modem in some circumstances, reducing the data calls to the
server at form load.

Mr. Smith
 
You might want to refer to Dirk Goldgar's post in the following link which
explains the circumstances in which the Combo Box Click Event will/will not
fire:

http://tinyurl.com/2ycjj



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Mr.Smith said:
Geezus Cheryl how much do you want???

I have the exact same problem. Using Access XP regardless of the file
format the .adp file is saved in. Be it 2002 or 2000.

I have the following code as an event procedure for the On_Click event
for a combobox. Not rocket science, just one function call.

**************

Private Sub cboResourceCompanyID_Click()

FillComboBox "vw_ResourceCompanyNames"

End Sub

**************


It doesn't run. Equally...


**************

Private Sub cboResourceCompanyID_Click()

msgBox "Doesn't work",vbOKOnly,"What the...?"

End Sub

**************


...doesn't work.


You could have tried that and saved us all a lot of heartache.

When I set a break point on the line "Private Sub
cboResourceCompanyID_Click()" in the code above, then single click the
combo box on the form (when its running of course), nothing happens.

I have several other combo boxes I tried to do this for with the same
result and replicated the problem on another fresh form as well. The
form works in every other way in a proper, predictable fashion. I
should also point out that "[Event Procedure]" certainly DOES appear in
the On Click event of the Properties window for every combo box tested.

I've been developing in Access since V2 and honestly can't remember ever
running an On Click event on a combo box before but as I try to now I am
finding this to appear very much like a critical bug for my purposes.

I have a requirement where I need the On Click event specifically as
opposed to an On Enter or Got Focus because I need for my user to be
able to tab across the field without the function "FillComboBox" being
called. I only want the function to occur if the user specifically
clicks on the combo box. The reason for this is because I load my form
with the combo set to Value list and supply the rowsource as a string
then switch to "Table/View/StoredProc" and populate it with an SQL
command only on demand. The following code is used and works as
expected when called from the GotFocus event:

(edited for brevity)********

Function FillComboBox(strSQL As String)

If Screen.ActiveControl.RowSourceType = "Table/View/StoredProc"
Then Exit Function

Screen.ActiveControl.RowSourceType = "Table/View/StoredProc"
Screen.ActiveControl.RowSource = strSQL

DoCmd.OpenForm "frm_Msg"
Forms!frm_Msg!lblMsg.Caption = "Creating List"
DoEvents

Screen.ActiveControl.Requery

DoCmd.Close acForm, "frm_Msg"

End Function

*****************************

This is done for performance reasons to enable the app to be efficient
over dial up modem in some circumstances, reducing the data calls to the
server at form load.

Mr. Smith




Cheryl said:
Yes, this is what you said in your original post; and it's no more
illuminating. If you want some code to run when your cursor first enters
the combo box, try the Got Focus event. If you want some code to run when
the value in the combo box is changed, try the After Update event.

Unless you can tell us *what you want your code to do* and post the code,
the only thing I can suggest you do is: Try another Event
 
Yeah you're right I've since discovered this myself. The onClick
actually functions as more of an On Select.

Anyway the OnMouseDown has cured it. At first I tried the on Mouse up
but it too works more as an On Select.


With thanks,
Mr. Smith.


Cheryl said:
You might want to refer to Dirk Goldgar's post in the following link which
explains the circumstances in which the Combo Box Click Event will/will not
fire:

http://tinyurl.com/2ycjj



--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Geezus Cheryl how much do you want???

I have the exact same problem. Using Access XP regardless of the file
format the .adp file is saved in. Be it 2002 or 2000.

I have the following code as an event procedure for the On_Click event
for a combobox. Not rocket science, just one function call.

**************

Private Sub cboResourceCompanyID_Click()

FillComboBox "vw_ResourceCompanyNames"

End Sub

**************


It doesn't run. Equally...


**************

Private Sub cboResourceCompanyID_Click()

msgBox "Doesn't work",vbOKOnly,"What the...?"

End Sub

**************


...doesn't work.


You could have tried that and saved us all a lot of heartache.

When I set a break point on the line "Private Sub
cboResourceCompanyID_Click()" in the code above, then single click the
combo box on the form (when its running of course), nothing happens.

I have several other combo boxes I tried to do this for with the same
result and replicated the problem on another fresh form as well. The
form works in every other way in a proper, predictable fashion. I
should also point out that "[Event Procedure]" certainly DOES appear in
the On Click event of the Properties window for every combo box tested.

I've been developing in Access since V2 and honestly can't remember ever
running an On Click event on a combo box before but as I try to now I am
finding this to appear very much like a critical bug for my purposes.

I have a requirement where I need the On Click event specifically as
opposed to an On Enter or Got Focus because I need for my user to be
able to tab across the field without the function "FillComboBox" being
called. I only want the function to occur if the user specifically
clicks on the combo box. The reason for this is because I load my form
with the combo set to Value list and supply the rowsource as a string
then switch to "Table/View/StoredProc" and populate it with an SQL
command only on demand. The following code is used and works as
expected when called from the GotFocus event:

(edited for brevity)********

Function FillComboBox(strSQL As String)

If Screen.ActiveControl.RowSourceType = "Table/View/StoredProc"
Then Exit Function

Screen.ActiveControl.RowSourceType = "Table/View/StoredProc"
Screen.ActiveControl.RowSource = strSQL

DoCmd.OpenForm "frm_Msg"
Forms!frm_Msg!lblMsg.Caption = "Creating List"
DoEvents

Screen.ActiveControl.Requery

DoCmd.Close acForm, "frm_Msg"

End Function

*****************************

This is done for performance reasons to enable the app to be efficient
over dial up modem in some circumstances, reducing the data calls to the
server at form load.

Mr. Smith




Cheryl said:
Basically my problem is, any code/event I put in for the
combo box doesn't work.


Yes, this is what you said in your original post; and it's no more
illuminating. If you want some code to run when your cursor first
enters
the combo box, try the Got Focus event. If you want some code to run
when
the value in the combo box is changed, try the After Update event.

Unless you can tell us *what you want your code to do* and post the
code,
the only thing I can suggest you do is: Try another Event


--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX




Cheryl,

I should've provide more information, however I indicated
that the OnClick,
OnEnter, doesn't work.

Basically my problem is, any code/event I put in for the
combo box doesn't work. I even tried DoCmd.Close and
nothing happens.

I also tried to insert a new unbound Combo box with the On
Click event as DoCmd.Close with no results

Please advice

Thanks
Leslie


-----Original Message-----
Leslie,

Your posting provides very little information that would

allow someone to


offer a diagnosis or provide suggestions. Just

saying: "doesn't work" may


explain it all to someone who can *see* your application -

but we cannot.


You may want to provide the following information:

1. What is it that you expect your combo box(es) to do?
2. What happens when you click on the combo box? An

error message?


Incorrect data? Nothing?
3. Are you using code associated with the events you

question? If so,


post the relevant code AND if the code is failing,

indicate which line of


code fails.
4. On what type of form are you using these combo

boxes? Single form or


continuous? Bound or unbound?
5. Are the combo box(es) bound or unbound?




--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX



message




I have a few combo boxes on my Form and the OnClick,
OnEnter, doesn't work.
Any advice?
Thanks

Leslie



.
 
Back
Top