Show/Hide Combo box

S

SimonT

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
 
J

Jeff Boyce

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.
 
S

SimonT

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
 
J

Jeff Boyce

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.
 
T

tom_willpa

high quality Soccer jerseys NBA Jersey tracksuit and jackets, GHD
hairstraightener supplier from www.willpa.com

Are you a Retail businessman who bother by the purchase price? China
Cheapest TOP wholesale website can help you

we are specialize in replica sport goods manufacturing in china, we can
offer you all kinds of soccer jersey, NBA jersey,shoes and so on. they are
the best brand replica goods whih are look the same as the original goods.
excellent quality and steady supply for them. we have been marketed in Europe
and American for 3 year. all the goods we offer are AAA quality. our soccer
jersey are Thailand style. If any goods you buy from my company have problem,
we will refund or resend them again. Most of ourProducts have no minimum
order requirements,soyou can shop retail goods at wholesale prices. if you
can buy more than 300usd. We offer free shipping. The more you buy the more
discount for you.

National soccer jerseys: http://www.willpa.com
Club soccer jerseys: http://www.willpa.com
NBA Jerseys: http://www.willpa.com
T-shirt and shirt: http://www.willpa.com
Tracksuit: http://www.willpa.com
Hoody & Jackets: http://www.willpa.com
UGG boots: http://www.willpa.com
Hair style: http://www.willpa.com
shopping Index: http://www.willpa.com

EMS shipping. 7days arrive, paypal accept

want more information pls contact us or check our website: www.willpa.com
 
D

Dirk Goldgar

SimonT said:
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 -----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top