Combo box locked?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I don't know what I've done, but my combo boxes just stop functioning! (i.e.
when I click on the arrow, the list drops down, but when I try to select any
item, there's no responce at all - as if it is locked)

I've checked its Lock and Enable properties, and Lock is no, Enable is yes.
Does anyone have any idea what's happening here?? Any suggestion is
appreciated.

Regards,
Sam
 
Sam

On every form in your application? On only one form? All combo boxes?
Only selected combo boxes?
 
Check the "Allow Additions" and "AllowEdits" properties of the form. If they
are set to 'No' the dropdown will do what you said yours is doing.
 
Thanks DanJ. The form's "AllowEdits" property was the problem!
These combo boxes are back alive with form's AllowEdit being set to Yes.
But, the AllowAddition didn't seem to have any effect in my case...just
thought you might wanna know :)

Regards,
Sam
 
No worry. Thanks for attempting.
It was the form's "AllowEdit" property that causes the problem in my case.
Those combo boxes are working fine now with form's AllowEdit set to Yes.
 
Thanks Jeff,
It's just this one form with all the combo boxes that didn't work.
The problem in my case was as DanJ suggested, which is, by setting the
form's AllowEdit would actually prevent these combo boxes from functioning.

Regards,
Sam
 
Sorry DanJ, coming back to my problem again.
I guess my Access isn't very stable at the moment, and it's very irritating...

I was just trying to play around with these form's properties (AllowFilters,
AllowEdits, AllowDeletions, AllowAdditions) to see how each one effects the
combo box functionality. But then regardless of any or all of the above
properties is set to Yes or No, the combo boxes work OK so long as I switch
to DesignView first, then switch back to FormView. Otherwise, they don't work
even if all of the above properties are set to Yes.

Is this something wrong with my database or Access 2002 itself?

Regards,
Sam
 
Sorry Jeff, coming back to my problem again.
I guess my Access isn't very stable at the moment, and it's very irritating...

I was just trying to play around with these form's properties (AllowFilters,
AllowEdits, AllowDeletions, AllowAdditions) to see how each one effects the
combo box functionality. But then regardless of any or all of the above
properties is set to Yes or No, the combo boxes work OK so long as I switch
to DesignView first, then switch back to FormView. Otherwise, they don't work
even if all of the above properties are set to Yes.

Is this something wrong with my database or Access 2002 itself?

Regards,
Sam
 
Just to further clarify my situation and hope that helps spotting where the
problem is...
I have all the controls (except combo boxes) hidden in the form's OnLoad
event. And in each combo box's AfterUpdate event, all the hidden controls
become visible. In theory this should work and shouldn't be the cause of my
combo box problem here I guess. So what might be wrong?

Regards,
Sam
 
I am trying to figure out myself what causes the problem before I get some
generous feedback here. But just to further clarify my situation and hope
that helps spotting where the problem is...
I have all the controls (except combo boxes) hidden in the form's OnLoad
event. And in each combo box's AfterUpdate event, all the hidden controls
become visible. In theory this should work and shouldn't be the cause of my
combo box problem here I guess. So what might be wrong?

Regards,
Sam
 
Hi Jeff,

All combo boxes in the form are unbound. All of which are based on the same
query as the form, except one combo box.

I created a solid-filled box that is used to cover up all the controls in
the form when the form is opened, so that the user can only see the combo
box, which they will then use to reach for records.

To make the "cover" work, I make all controls (except combo boxes) invisible
in the form's OnLoad event. Then make these controls visible again in all
combo boxes's AfterUpdate event.

This is what my code looks like:
---
Private Sub Form_Load()
' Hide the Database Window
DoCmd.SelectObject acForm, , False
DoCmd.RunCommand acCmdWindowHide
' Hide the Menu Bar (File, Edit, ...etc)
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
' Hide the Form View toolbar
CommandBars("Form View").Visible = False
' Disable 'Close(X) button' from the application window
' and 'Exit' from File menu
Call SetEnabledState(False)
' Disable cboVersionStatus and cboType
cboVersionStatus.Enabled = False
cboType.Enabled = False
' Hide all controls until a selection is made
' through one of the combo boxes
[FormerDWGNo].Visible = False
[LatestIssue].Visible = False
[DWGNo].Visible = False
[VersionStatus].Visible = False
[JobNo].Visible = False
[NoOfSheets].Visible = False
[Category].Visible = False
[Type].Visible = False
[Size].Visible = False
Code:
.Visible = False
[Title].Visible = False
[Material].Visible = False
[Originator].Visible = False
[OrigDate].Visible = False
[ApprovedBy].Visible = False
[ApprovalDate].Visible = False
[TestEquipment].Visible = False
[Note].Visible = False
[Comment_Label].Visible = False
[Comment1].Visible = False
[Comment2].Visible = False
[Comment3].Visible = False
[cbHideComment].Visible = False
[cbViewCategory].Visible = False
[cbViewType].Visible = False
[cbViewSize].Visible = False
[cbStaffListOpen1].Visible = False
[cbStaffListOpen2].Visible = False
[cbTestHistoryOpen].Visible = False
[PDFDrawing].Visible = False
[DrawingFile].Visible = False
[sfReidAmendedProductDrawings_User].Visible = False
[Box95].Visible = False
[Box115].Visible = False
[Box127].Visible = False
' Set focus to cboDWGNo
Me.cboDWGNo.SetFocus
' Maximize the form
DoCmd.Maximize
End Sub
---
' cboJobNo is one of the combo boxes
Private Sub cboJobNo_AfterUpdate()
' Turn off screen repainting and display Hourglass
' until the procedure has finished running
Application.Echo False
DoCmd.Hourglass True
' Clear cboDWGNo, cboVersionStatus, cboCategory,
' cboType and cboFormerDWGNo (show as blank)
Me.cboDWGNo = Null
Me.cboVersionStatus = Null
Me.cboCategory = Null
Me.cboType = Null
Me.cboFormerDWGNo = Null
' Clear the list of cboVersionStatus and cboType
Me.cboVersionStatus.RowSource = qryReidProductDrawings
Me.cboType.RowSource = qryReidProductDrawings
' Disable cboVersionStatus and cboType
cboVersionStatus.Enabled = False
cboType.Enabled = False
' Unhide all controls after a selection is made
' in this combo box cboJobNo
[FormerDWGNo].Visible = True
[LatestIssue].Visible = True
[DWGNo].Visible = True
[VersionStatus].Visible = True
[JobNo].Visible = True
[NoOfSheets].Visible = True
[Category].Visible = True
[Type].Visible = True
[Size].Visible = True
[Code].Visible = True
[Title].Visible = True
[Material].Visible = True
[Originator].Visible = True
[OrigDate].Visible = True
[ApprovedBy].Visible = True
[ApprovalDate].Visible = True
[TestEquipment].Visible = True
[Note].Visible = True
[Comment_Label].Visible = True
[Comment1].Visible = True
[Comment2].Visible = True
[Comment3].Visible = True
[cbHideComment].Visible = True
[cbViewCategory].Visible = True
[cbViewType].Visible = True
[cbViewSize].Visible = True
[cbStaffListOpen1].Visible = True
[cbStaffListOpen2].Visible = True
[cbTestHistoryOpen].Visible = True
[PDFDrawing].Visible = True
[DrawingFile].Visible = True
[sfReidAmendedProductDrawings_User].Visible = True
' These are the _covers_
[Box95].Visible = True
[Box115].Visible = True
[Box127].Visible = True
' Apply filter
Me.Filter = "[JobNo] = '" & Me![cboJobNo] & "'"
Me.FilterOn = True
' When the task is done, change hourglass back
' to a pointer and screen repainting is turned back on
Application.Echo True
DoCmd.Hourglass False
End Sub
 
Sam,

I read the other threads, and you said that you are hiding controls with a
box. I'm not sure I understand why you are doing that, but is is possible
that the rectangle is on top of your controls and therefore gets the focus of
your click. Check to make sure that rectangle is in back of the controls
when the controls are made visible.

There is an easier way to do what I think you are trying to do. You can use
the 'Tag' property to mark all the controls that you want to 'Hide and Show'
and then Hide them when the form opens and show them when a choice is made in
the combo box.

For example you could enter "Hide" in the tag property of the controls to
hide and use the following code in the Open Event:

Private Sub Form_Open()
Dim ctl as Control
For each ctl in Me.Controls
If ctl.tag = "Hide" then
ctl.visible=False
End if
Next ctl
End sub

Then you could use the following in the combo boxes AfterUpdate event:

Private Sub cboDWGNo_AtterUpdate()
Dim ctl as Control
.......Your other code

For each ctl in Me.Controls
If ctl.tag = "Hide" then
ctl.visible=True
End if
Next ctl
End sub

You could also create a subroutine to avoid the redundant code above and
just call it, but this should work fine.

Hope I didn't misunderstand what you are trying to do!

Dan
 
I like Dan's suggestion -- it would simplify what you are doing. And you
can add a msgbox line of code in the GotFocus event of one of your controls,
to make sure whether/if it is getting the focus.


--
Good luck

Jeff Boyce
<Access MVP>

Sam Kuo said:
Hi Jeff,

All combo boxes in the form are unbound. All of which are based on the same
query as the form, except one combo box.

I created a solid-filled box that is used to cover up all the controls in
the form when the form is opened, so that the user can only see the combo
box, which they will then use to reach for records.

To make the "cover" work, I make all controls (except combo boxes) invisible
in the form's OnLoad event. Then make these controls visible again in all
combo boxes's AfterUpdate event.

This is what my code looks like:
---
Private Sub Form_Load()
' Hide the Database Window
DoCmd.SelectObject acForm, , False
DoCmd.RunCommand acCmdWindowHide
' Hide the Menu Bar (File, Edit, ...etc)
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
' Hide the Form View toolbar
CommandBars("Form View").Visible = False
' Disable 'Close(X) button' from the application window
' and 'Exit' from File menu
Call SetEnabledState(False)
' Disable cboVersionStatus and cboType
cboVersionStatus.Enabled = False
cboType.Enabled = False
' Hide all controls until a selection is made
' through one of the combo boxes
[FormerDWGNo].Visible = False
[LatestIssue].Visible = False
[DWGNo].Visible = False
[VersionStatus].Visible = False
[JobNo].Visible = False
[NoOfSheets].Visible = False
[Category].Visible = False
[Type].Visible = False
[Size].Visible = False
Code:
.Visible = False
[Title].Visible = False
[Material].Visible = False
[Originator].Visible = False
[OrigDate].Visible = False
[ApprovedBy].Visible = False
[ApprovalDate].Visible = False
[TestEquipment].Visible = False
[Note].Visible = False
[Comment_Label].Visible = False
[Comment1].Visible = False
[Comment2].Visible = False
[Comment3].Visible = False
[cbHideComment].Visible = False
[cbViewCategory].Visible = False
[cbViewType].Visible = False
[cbViewSize].Visible = False
[cbStaffListOpen1].Visible = False
[cbStaffListOpen2].Visible = False
[cbTestHistoryOpen].Visible = False
[PDFDrawing].Visible = False
[DrawingFile].Visible = False
[sfReidAmendedProductDrawings_User].Visible = False
[Box95].Visible = False
[Box115].Visible = False
[Box127].Visible = False
' Set focus to cboDWGNo
Me.cboDWGNo.SetFocus
' Maximize the form
DoCmd.Maximize
End Sub
---
' cboJobNo is one of the combo boxes
Private Sub cboJobNo_AfterUpdate()
' Turn off screen repainting and display Hourglass
' until the procedure has finished running
Application.Echo False
DoCmd.Hourglass True
' Clear cboDWGNo, cboVersionStatus, cboCategory,
' cboType and cboFormerDWGNo (show as blank)
Me.cboDWGNo = Null
Me.cboVersionStatus = Null
Me.cboCategory = Null
Me.cboType = Null
Me.cboFormerDWGNo = Null
' Clear the list of cboVersionStatus and cboType
Me.cboVersionStatus.RowSource = qryReidProductDrawings
Me.cboType.RowSource = qryReidProductDrawings
' Disable cboVersionStatus and cboType
cboVersionStatus.Enabled = False
cboType.Enabled = False
' Unhide all controls after a selection is made
' in this combo box cboJobNo
[FormerDWGNo].Visible = True
[LatestIssue].Visible = True
[DWGNo].Visible = True
[VersionStatus].Visible = True
[JobNo].Visible = True
[NoOfSheets].Visible = True
[Category].Visible = True
[Type].Visible = True
[Size].Visible = True
[Code].Visible = True
[Title].Visible = True
[Material].Visible = True
[Originator].Visible = True
[OrigDate].Visible = True
[ApprovedBy].Visible = True
[ApprovalDate].Visible = True
[TestEquipment].Visible = True
[Note].Visible = True
[Comment_Label].Visible = True
[Comment1].Visible = True
[Comment2].Visible = True
[Comment3].Visible = True
[cbHideComment].Visible = True
[cbViewCategory].Visible = True
[cbViewType].Visible = True
[cbViewSize].Visible = True
[cbStaffListOpen1].Visible = True
[cbStaffListOpen2].Visible = True
[cbTestHistoryOpen].Visible = True
[PDFDrawing].Visible = True
[DrawingFile].Visible = True
[sfReidAmendedProductDrawings_User].Visible = True
' These are the _covers_
[Box95].Visible = True
[Box115].Visible = True
[Box127].Visible = True
' Apply filter
Me.Filter = "[JobNo] = '" & Me![cboJobNo] & "'"
Me.FilterOn = True
' When the task is done, change hourglass back
' to a pointer and screen repainting is turned back on
Application.Echo True
DoCmd.Hourglass False
End Sub

[QUOTE="Jeff Boyce"]
Sam

Are the combo boxes bound or unbound?

--
Good luck

Jeff Boyce
<Access MVP>

 where
the of
my
[/QUOTE][/QUOTE]
 
Thanks Dan. This is exactly what I would like to do, and your kind suggestion
makes it work perfectly without any redundancy (unlike what I had
originally...)

Please bear with me with this one more question. Now that I can use the tag
property to make some controls invisible when the form opens up, but how
should I amend the lines in the combo box's AfterUpdates event such that at
the same time while those hidden controls turns visible, some other controls
(2 labels in fact, I have set their tag properties to something like
HideGreeting) become invisible after the combo box updates?

Private Sub cboDWGNo_AfterUpdate()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Hide" Then
ctl.Visible = True
End If
Next ctl

I also found out why the combo boxes didn't work before in my case (for both
your lines and my redundant approach). It was because the form I had with
these combo boxes is meant to be the startup form, but I didn't specify
anything in Tools_Startup_Display Form/Page. So after I specify the form as
the startup form, these combo boxes are back alive! I then went trying
without this particular form being the startup form, and the combo boxes also
work just fine.

Hope this would be helpful to someone experience the same problem I have here.
Thanks Dan.

Regards,
Sam
 
Thank Jeff. I think the Dan's suggestion is brilliant too.
I also find out why my combo boxes didn't work in the form. It was because
the form is a startup form, but I didn't specify anything under
Tools_Startup_Dispaly Form/Page. After I did that, these combo boxes are back
to work!

Your kind advice has very helpful and much appreciated.

Cheers,
Sam

Jeff Boyce said:
I like Dan's suggestion -- it would simplify what you are doing. And you
can add a msgbox line of code in the GotFocus event of one of your controls,
to make sure whether/if it is getting the focus.


--
Good luck

Jeff Boyce
<Access MVP>

Sam Kuo said:
Hi Jeff,

All combo boxes in the form are unbound. All of which are based on the same
query as the form, except one combo box.

I created a solid-filled box that is used to cover up all the controls in
the form when the form is opened, so that the user can only see the combo
box, which they will then use to reach for records.

To make the "cover" work, I make all controls (except combo boxes) invisible
in the form's OnLoad event. Then make these controls visible again in all
combo boxes's AfterUpdate event.

This is what my code looks like:
---
Private Sub Form_Load()
' Hide the Database Window
DoCmd.SelectObject acForm, , False
DoCmd.RunCommand acCmdWindowHide
' Hide the Menu Bar (File, Edit, ...etc)
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
' Hide the Form View toolbar
CommandBars("Form View").Visible = False
' Disable 'Close(X) button' from the application window
' and 'Exit' from File menu
Call SetEnabledState(False)
' Disable cboVersionStatus and cboType
cboVersionStatus.Enabled = False
cboType.Enabled = False
' Hide all controls until a selection is made
' through one of the combo boxes
[FormerDWGNo].Visible = False
[LatestIssue].Visible = False
[DWGNo].Visible = False
[VersionStatus].Visible = False
[JobNo].Visible = False
[NoOfSheets].Visible = False
[Category].Visible = False
[Type].Visible = False
[Size].Visible = False
Code:
.Visible = False
[Title].Visible = False
[Material].Visible = False
[Originator].Visible = False
[OrigDate].Visible = False
[ApprovedBy].Visible = False
[ApprovalDate].Visible = False
[TestEquipment].Visible = False
[Note].Visible = False
[Comment_Label].Visible = False
[Comment1].Visible = False
[Comment2].Visible = False
[Comment3].Visible = False
[cbHideComment].Visible = False
[cbViewCategory].Visible = False
[cbViewType].Visible = False
[cbViewSize].Visible = False
[cbStaffListOpen1].Visible = False
[cbStaffListOpen2].Visible = False
[cbTestHistoryOpen].Visible = False
[PDFDrawing].Visible = False
[DrawingFile].Visible = False
[sfReidAmendedProductDrawings_User].Visible = False
[Box95].Visible = False
[Box115].Visible = False
[Box127].Visible = False
' Set focus to cboDWGNo
Me.cboDWGNo.SetFocus
' Maximize the form
DoCmd.Maximize
End Sub
---
' cboJobNo is one of the combo boxes
Private Sub cboJobNo_AfterUpdate()
' Turn off screen repainting and display Hourglass
' until the procedure has finished running
Application.Echo False
DoCmd.Hourglass True
' Clear cboDWGNo, cboVersionStatus, cboCategory,
' cboType and cboFormerDWGNo (show as blank)
Me.cboDWGNo = Null
Me.cboVersionStatus = Null
Me.cboCategory = Null
Me.cboType = Null
Me.cboFormerDWGNo = Null
' Clear the list of cboVersionStatus and cboType
Me.cboVersionStatus.RowSource = qryReidProductDrawings
Me.cboType.RowSource = qryReidProductDrawings
' Disable cboVersionStatus and cboType
cboVersionStatus.Enabled = False
cboType.Enabled = False
' Unhide all controls after a selection is made
' in this combo box cboJobNo
[FormerDWGNo].Visible = True
[LatestIssue].Visible = True
[DWGNo].Visible = True
[VersionStatus].Visible = True
[JobNo].Visible = True
[NoOfSheets].Visible = True
[Category].Visible = True
[Type].Visible = True
[Size].Visible = True
[Code].Visible = True
[Title].Visible = True
[Material].Visible = True
[Originator].Visible = True
[OrigDate].Visible = True
[ApprovedBy].Visible = True
[ApprovalDate].Visible = True
[TestEquipment].Visible = True
[Note].Visible = True
[Comment_Label].Visible = True
[Comment1].Visible = True
[Comment2].Visible = True
[Comment3].Visible = True
[cbHideComment].Visible = True
[cbViewCategory].Visible = True
[cbViewType].Visible = True
[cbViewSize].Visible = True
[cbStaffListOpen1].Visible = True
[cbStaffListOpen2].Visible = True
[cbTestHistoryOpen].Visible = True
[PDFDrawing].Visible = True
[DrawingFile].Visible = True
[sfReidAmendedProductDrawings_User].Visible = True
' These are the _covers_
[Box95].Visible = True
[Box115].Visible = True
[Box127].Visible = True
' Apply filter
Me.Filter = "[JobNo] = '" & Me![cboJobNo] & "'"
Me.FilterOn = True
' When the task is done, change hourglass back
' to a pointer and screen repainting is turned back on
Application.Echo True
DoCmd.Hourglass False
End Sub

[QUOTE="Jeff Boyce"]
Sam

Are the combo boxes bound or unbound?

--
Good luck

Jeff Boyce
<Access MVP>

Just to further clarify my situation and hope that helps spotting where
the
problem is...
I have all the controls (except combo boxes) hidden in the form's OnLoad
event. And in each combo box's AfterUpdate event, all the hidden controls
become visible. In theory this should work and shouldn't be the cause of
my
combo box problem here I guess. So what might be wrong?

Regards,
Sam

:

Sam

On every form in your application?  On only one form?  All combo boxes?
Only selected combo boxes?

--
More info, please ...

Jeff Boyce
<Access MVP>

Hi,

I don't know what I've done, but my combo boxes just stop functioning!
(i.e.
when I click on the arrow, the list drops down, but when I try to
select
any
item, there's no responce at all - as if it is locked)

I've checked its Lock and Enable properties, and Lock is no, Enable is
yes.
Does anyone have any idea what's happening here?? Any suggestion is
appreciated.

Regards,
Sam
[/QUOTE][/QUOTE]
[/QUOTE]
 
Back
Top