Combo Box to make visible

B

Bob Vance

Having trouble making cbOwnerName visible and not visible

My Combo box Row source below only 1 field it it "cmbShow2ndcompany"
SELECT [tblCompanyInfo].[Show2ndCompany] FROM tblCompanyInfo;

And my code on the form
If Me.cmbShow2ndcompany.Column(0) = -1 Then
cbOwnerNameCI.Visible = True

Else
cbOwnerNameCI.Visible = False
End If
 
S

Steve

Hello Bob,

Why don't you just use a ckeckbox named Show2ndcompany?

Your code would be:
cbOwnerNameCI.Visible = Show2ndcompany

Steve
(e-mail address removed)
 
B

Bob Vance

Thanks Steve, but my check box is on my main form
regards Bob

Steve said:
Hello Bob,

Why don't you just use a ckeckbox named Show2ndcompany?

Your code would be:
cbOwnerNameCI.Visible = Show2ndcompany

Steve
(e-mail address removed)



Bob Vance said:
Having trouble making cbOwnerName visible and not visible

My Combo box Row source below only 1 field it it "cmbShow2ndcompany"
SELECT [tblCompanyInfo].[Show2ndCompany] FROM tblCompanyInfo;

And my code on the form
If Me.cmbShow2ndcompany.Column(0) = -1 Then
cbOwnerNameCI.Visible = True

Else
cbOwnerNameCI.Visible = False
End If
 
S

Steve

Bob,

What check box on your main form are you talking about?

Where is cbOwnerNameCI?

Steve


Bob Vance said:
Thanks Steve, but my check box is on my main form
regards Bob

Steve said:
Hello Bob,

Why don't you just use a ckeckbox named Show2ndcompany?

Your code would be:
cbOwnerNameCI.Visible = Show2ndcompany

Steve
(e-mail address removed)



Bob Vance said:
Having trouble making cbOwnerName visible and not visible

My Combo box Row source below only 1 field it it "cmbShow2ndcompany"
SELECT [tblCompanyInfo].[Show2ndCompany] FROM tblCompanyInfo;

And my code on the form
If Me.cmbShow2ndcompany.Column(0) = -1 Then
cbOwnerNameCI.Visible = True

Else
cbOwnerNameCI.Visible = False
End If
 
C

Clif McIrvin

Hi Bob!

By "is on my main form" are you implying that you are working in a
subform? If so, and the flag you need is indeed a checkbox on your main
(parent) form then try using syntax like
Me.Parent.ControlName.Enabled
to refer to a control on the form one level up from the subform you are
on. That would be much more efficient than executing a query to get at
the data as you are doing now.

There's a very helpful document on The Access Web at
http://www.mvps.org/access/forms/frm0031.htm

with all kinds of useful syntax pointers.

As to your code -- are you getting an error?

Change
???

Clif

Bob Vance said:
Thanks Steve, but my check box is on my main form
regards Bob

Steve said:
Hello Bob,

Why don't you just use a ckeckbox named Show2ndcompany?

Your code would be:
cbOwnerNameCI.Visible = Show2ndcompany

Steve
(e-mail address removed)



Bob Vance said:
Having trouble making cbOwnerName visible and not visible

My Combo box Row source below only 1 field it it "cmbShow2ndcompany"
SELECT [tblCompanyInfo].[Show2ndCompany] FROM tblCompanyInfo;

And my code on the form
If Me.cmbShow2ndcompany.Column(0) = -1 Then
cbOwnerNameCI.Visible = True

Else
cbOwnerNameCI.Visible = False
End If
 
B

Bob Vance

Steve said:
Bob,

What check box on your main form are you talking about?

Where is cbOwnerNameCI?

Steve


news:eP%[email protected]...

Thanks Steve. My check box is on another from that when is not ticked the
combo box cbOwnerNameCI will be not visible
 
S

Steve

Put the following code in the open event of your form that contains
cbOwnerNameCI:
Me!cbOwnerNameCI.Visible = Forms!NameOfOtherForm!Show2ndcompany

Note that the other form must be open.

It would be easier if you put an unbound checkbox named Show2ndcompany on
your form that contains cbOwnerNameCI and put the fo9llowing code in the
AfterUpdate event of the checkbox:
Me!cbOwnerNameCI.Visible = Me!Show2ndcompany

Steve
 
B

Bob Vance

Brillaint Steve, thanks I put the check box on a form that was always
open,Regards Bob
 
B

Bob Vance

KenSheridan via AccessMonster.com said:
Bob:

I'm a little confused. Are you saying:

1. You have a check box on one form which is checked or unchecked. Yes my Main Form

2. A second form is opened from the first form and the cbOwnerNameCI
control
on this second form is either shown or hidden when the form opens by
virtue
of the value of the check box on the first form.

Yes Correct
3. You have another combo box on the second form, cmbShow2ndcompany, and
when an item is selected in that combo box the cbOwnerNameCI combo box
will
be shown/ hidden depending on the True or False value in the control's
selected row.
No Sorry I have removed that combo box as i did not need it...........Thanks
Ken
If so then, if the BoundColumn property of the cmbShow2ndcompany contril
is 1
you would need the following in its AfterUpdate event procedure:

Me.cbOwnerNameCI = Nz(Me.cmbShow2ndcompany,False)

Even if my interpretation is right I am nevertheless puzzled why you seem
to
be using a combo box to allow a choice of True or False rather than a
check
box on the second form as well as the first, and why the True and False
values in the combo box's list are being derived from rows in a table,
particularly as the table name suggests it holds something more than True
and
False values. It would perhaps help if you could explain in more detail
just
what you are tying to achieve here in terms of the data underlying the
form.

Ken Sheridan
Stafford, England

Bob said:
[quoted text clipped - 3 lines]

Thanks Steve. My check box is on another from that when is not ticked the
combo box cbOwnerNameCI will be not visible
 
B

Bob Vance

Why is this code not working for my Label "lblCI"
Regards Bob
Me!cbOwnerNameCI.Visible = Forms!frmMain!ckbShow2ndCompany
Me!lblCI.Visible = Forms!frmMain!ckbShow2ndCompany
 
J

John W. Vinson

Why is this code not working for my Label "lblCI"
Regards Bob
Me!cbOwnerNameCI.Visible = Forms!frmMain!ckbShow2ndCompany
Me!lblCI.Visible = Forms!frmMain!ckbShow2ndCompany

You may need to Repaint the form after setting the controls' visible property.
 
B

Bob Vance

Thanks John. Found the problem in "Case" I had the label as true visible,
took that away and it is fine
Regards Bob
 

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