A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Show/Hide Combo box



 
 
Thread Tools Display Modes
  #1  
Old March 31st, 2010, 05:35 PM posted to microsoft.public.access.forms
SimonT
external usenet poster
 
Posts: 12
Default Show/Hide Combo box

Hi Guys,

Does anyone know the syntax to hide a combo box on a form if it is opened in
edit mode?

I am not sure if I should hide the combo by default and make visible in
'Add' mode or to leave it visible and hide in 'edit' mode.

I am using the MS switchboard to control form access, I am assuming it will
be on the forms 'onLoad' event ?

Regards
Si

Access 2007


  #2  
Old March 31st, 2010, 05:41 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Show/Hide Combo box

Controls on a form have properties. One of the properties is the .Visible
property... another is the .Enabled property.

Users sometimes get nervous when things disappear ... consider using
..Enabled to enable/disable the control, rather than disappearing it.

When you switch to "edit mode", how are you doing that?

If you have a command button, you could add code to that control to change
the .Enabled (or .Visible) property.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"SimonT" wrote in message
...
Hi Guys,

Does anyone know the syntax to hide a combo box on a form if it is opened
in edit mode?

I am not sure if I should hide the combo by default and make visible in
'Add' mode or to leave it visible and hide in 'edit' mode.

I am using the MS switchboard to control form access, I am assuming it
will be on the forms 'onLoad' event ?

Regards
Si

Access 2007




  #3  
Old March 31st, 2010, 07:22 PM posted to microsoft.public.access.forms
SimonT
external usenet poster
 
Posts: 12
Default Show/Hide Combo box

Hi Jeff,

Thanks for that.

As I mentioned I have a switchboard form that has buttons to select a form
to open, this particular form can choose from:

1 opens form in add mode
2 opens form in edit mode

So what I want is if the user is to add and record, the combo box is not
visible, (The combo box is only used to locate a record on the form, so it
only required in edit mode)

Regards
Si
"Jeff Boyce" wrote in message
...
Controls on a form have properties. One of the properties is the .Visible
property... another is the .Enabled property.

Users sometimes get nervous when things disappear ... consider using
.Enabled to enable/disable the control, rather than disappearing it.

When you switch to "edit mode", how are you doing that?

If you have a command button, you could add code to that control to change
the .Enabled (or .Visible) property.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"SimonT" wrote in message
...
Hi Guys,

Does anyone know the syntax to hide a combo box on a form if it is opened
in edit mode?

I am not sure if I should hide the combo by default and make visible in
'Add' mode or to leave it visible and hide in 'edit' mode.

I am using the MS switchboard to control form access, I am assuming it
will be on the forms 'onLoad' event ?

Regards
Si

Access 2007





  #4  
Old March 31st, 2010, 07:36 PM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Show/Hide Combo box

Hopefully one of the other readers can help. My last use of the Switchboard
feature was many years ago.

(If I had to think up a work-around, I might use code in the form's OnOpen
event that checked whether it was being opened for Edit or Add, then modify
the combobox's .Visible or .Enabled property...)

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"SimonT" wrote in message
...
Hi Jeff,

Thanks for that.

As I mentioned I have a switchboard form that has buttons to select a form
to open, this particular form can choose from:

1 opens form in add mode
2 opens form in edit mode

So what I want is if the user is to add and record, the combo box is not
visible, (The combo box is only used to locate a record on the form, so it
only required in edit mode)

Regards
Si
"Jeff Boyce" wrote in message
...
Controls on a form have properties. One of the properties is the
.Visible property... another is the .Enabled property.

Users sometimes get nervous when things disappear ... consider using
.Enabled to enable/disable the control, rather than disappearing it.

When you switch to "edit mode", how are you doing that?

If you have a command button, you could add code to that control to
change the .Enabled (or .Visible) property.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"SimonT" wrote in message
...
Hi Guys,

Does anyone know the syntax to hide a combo box on a form if it is
opened in edit mode?

I am not sure if I should hide the combo by default and make visible in
'Add' mode or to leave it visible and hide in 'edit' mode.

I am using the MS switchboard to control form access, I am assuming it
will be on the forms 'onLoad' event ?

Regards
Si

Access 2007







  #5  
Old March 31st, 2010, 09:30 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Show/Hide Combo box

"SimonT" wrote in message
...
Hi Guys,

Does anyone know the syntax to hide a combo box on a form if it is opened
in edit mode?

I am not sure if I should hide the combo by default and make visible in
'Add' mode or to leave it visible and hide in 'edit' mode.

I am using the MS switchboard to control form access, I am assuming it
will be on the forms 'onLoad' event ?



You could use the form's Load event to check whether its recordset is empty.
That's not quite the same as knowing whether it was opened in add mode,
because you might just be opening it on an empty table, or a query that
returns no records. However, it might be good enough for your purposes.

'----- start of example code -----
Private Sub Form_Load()

Me.cboMyComboBox.Visible = _
(Me.Recordset.RecordCount 0)

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:47 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.