How To Disable Some ComboBox In Continus Subform ?

Ù

ياسر

Good Day:
I Have A form With Sub form then in the sub form i have 5 combo box in the
same row
I need to do this:
when i press combo 1 then if combo 1 = project then all other combo's be
enabled in the same row else if combo 1 <> projects all other combo's be
disabled in the same line of the row not in all sub form.
so how can i do this?
please help me
 
A

Albert D. Kallal

???? said:
Good Day:
I Have A form With Sub form then in the sub form i have 5 combo box in the
same row
I need to do this:
when i press combo 1 then if combo 1 = project then all other combo's be
enabled in the same row else if combo 1 <> projects all other combo's be
disabled in the same line of the row not in all sub form.
so how can i do this?
please help me

I certainly have a lot of continues forms where I set the controls enabled
property on/off. While this actually makes all instances of the control go
disabled, I actually find this works quite well. I mean, when you move
to the next row, those columns that you enable, or disable can then
be set. So, you could set the controls visible property as you move
the cursor up/down through the

In fact, I actually PREFER the above behavior, as then during
data entry it is VERY easy to see that the column in question
is enabled.

In place of a VERY HARD TO READ checkerboard pattern of enabled, and
disabled boxes, you get a very nice enable/display view as I move the cursor
up /down.

I have uploaded a gif animation of me navigating in a form, both of the two
screen shots will give you an idea of how this looks.

http://www.members.shaw.ca/AlbertKallal/HideColumn/index.htm

Take a look at both above access screens...you can see during navigation
that columns hide/display..and it not really a problem at all (in fact, as
mentioned, I kind of prefer the behavior in the above animations)
 
Ù

ياسر

Thank you for your nice offer
but in your forms
the all row is disabled or enabled together and thats what i don't want to do
i need to let every combo box in the same row can be disabled or enabled alone
and thats all i need
by selecting the first combo i can choose from drop down menu for example:
combo 1 = vacation the the second combo which contain the projects names
will be disabled or if the combo 1 = projects the combo 2 which contain the
projects names will be enabled in the same line not all the form
hope that you knows what i mean and waiting for help
 
A

Albert D. Kallal

It not possible to enable, or hide Individual controls in a continues form
without all instances of the controls in the form taking on the same
attributes.

(in other words, if you hide the control, then ALL instances of the control
will be hidden).

So I well understand your question. It is clear what you are asking for.
Unfortunately it's not possible to do is you ask with a continuous form.

The only consolation I can offer here is that since all controls will hide
or be in view at the SAME time, then it does give a very good feedback to
the user as to if the column is enabled or disabled during editing.

As you can see in that animation the animation leaves absolutely no doubt at
all during data entry as to when that column is enabled or disabled.

There is no question that many people (if not most) prefer this to work the
other way. In fact we see this question often here. Unfortunate as mentioned
this feature is not possible with the built in continuous form. You have to
resort to a third party ActiveX control (something like tlist7 for example),
or accept that having all controls a pure disappear it the same time it
gives
a good visual indication of the status of that column (again as mentioned,
this
is likely not an ideal situation, but it is only set of cards were being
dealt here).
 
Ù

ياسر

Thanks alot But Now!
What can I do To disable the combo's or Enable Them One By One?
Can you explain The steps ?
 
A

Albert D. Kallal

???? said:
Thanks alot But Now!
What can I do To disable the combo's or Enable Them One By One?

You can't. I It is not possible. did you even bother to read my last
response? I shall repeat for you:

<quote>
It not possible to enable, or hide Individual controls in a continues form
without all instances of the controls in the form taking on the same
attributes.
</quote>

What part about this not being possible did you fail to read? Is there
anything in the above quote that is not clear?
 
J

John W. Vinson

Good Day:
I Have A form With Sub form then in the sub form i have 5 combo box in the
same row
I need to do this:
when i press combo 1 then if combo 1 = project then all other combo's be
enabled in the same row else if combo 1 <> projects all other combo's be
disabled in the same line of the row not in all sub form.
so how can i do this?
please help me

You can use "Conditional Formatting". Open the form in design view; select
each combo box that you want to enable or disable. From the menu choose
Format... Conditional Formatting.

Select "Expression is" in the combo box on the conditional formatting popup;
put an expression like

[Combo1] = "Project"

and choose the "enabled" tool from the tools to the right of the box.
 
C

Chegu Tom

Try in the after update event of combo1 and in the onCurrent event of the
form

if me.combo1="Project" then
me.combo2.enabled=true
me.combo3.enabled=true
etc
else
me.combo2.enabled=false
me.combo3.enabled=false
etc
endif

this will change the individual Combo boxes in all of the rows. But as you
change rows (on current event) or change combo1 (after update event) the
status of those combo boxes (in all rows) will change according to the value
of combo1 in the current row

Tom
 
C

Chegu Tom

John

I didn't think to do it this way

Will the conditional formatting enable or disable individual rows on the
continuous form, or will all rows change format together?

Tom

John W. Vinson said:
Good Day:
I Have A form With Sub form then in the sub form i have 5 combo box in the
same row
I need to do this:
when i press combo 1 then if combo 1 = project then all other combo's be
enabled in the same row else if combo 1 <> projects all other combo's be
disabled in the same line of the row not in all sub form.
so how can i do this?
please help me

You can use "Conditional Formatting". Open the form in design view; select
each combo box that you want to enable or disable. From the menu choose
Format... Conditional Formatting.

Select "Expression is" in the combo box on the conditional formatting
popup;
put an expression like

[Combo1] = "Project"

and choose the "enabled" tool from the tools to the right of the box.
 
A

Albert D. Kallal

Chegu Tom said:
John

I didn't think to do it this way

Will the conditional formatting enable or disable individual rows on the
continuous form, or will all rows change format together?

Tom

Conditional formatting is row by row. so, you can't hide the control...but
changing the color or enabling the control is possible. You just can't use
code to change the enabled or visible property to one instance of the
control.

So, hiding is not possible with code or conditional formatting.

Enabling is NOT possible with code, but is possible with conditional
formatting, and it will apply to EACH instance in the continues form.

What one could likely do is use the controls on enter event, and if the
condition is such that you are not to modify the control, the code jumps the
cursor out. You then use conditional formatting to change the color of the
text to the SAME as the background. This could produce an effect that would
be very similar to hiding.

Conditional formatting using the enabled feature sounds like a good solution
here and can be done without my kludge approach as per above...
 
J

John W. Vinson

John

I didn't think to do it this way

Will the conditional formatting enable or disable individual rows on the
continuous form, or will all rows change format together?

Individual rows; not just individual rows, you can set it up for individual
controls on each row, with the same or different conditions. It's a really
nice feature that only came in with (IIRC) 2002, so some folks might not be
aware of it. There might be more awareness that you can use Conditional
Formatting to change the *apperance* of a control, but you can change its
enabled state as well.
 
D

David W. Fenton

I Have A form With Sub form then in the sub form i have 5 combo
box in the same row
I need to do this:
when i press combo 1 then if combo 1 = project then all other
combo's be enabled in the same row else if combo 1 <> projects all
other combo's be disabled in the same line of the row not in all
sub form. so how can i do this?

You can't. This is why I believe that continuous forms should not be
editable.

Bind a subform control with a single detail record to the continuous
subform, and use the continuous for as a list to pick from for a
record that you want to edit. That way your detail subform can
on-the-fly hide/reveal controls and change rowsources, labels,
controlsources as needed.
 
A

AccessVandal via AccessMonster.com

You can use the Pat Hartman's combobox cascade idea. But this only when the
user in on the record of the cont' form. If the focus is not on the form, the
appearance the comboboxes will be enabled until the user goes to the row of
the record. And if that is acceptable to you than...

You have 5 comboboxes (assuming they are bound to the recordsource of the
form). In each combobox afterupdate event and one Oncurrent event of your
form.

Private Sub Combo1_AfterUpdate()

If combo1 = "Project" then
'disable the control or controls or may not need to
else
'enable the control or controls or may not need to
End If

End Sub

Do this for all rest the comboboxes afterupdate event.

In the Form's OnCurrent event.

You must the define the comboboxes condition (Enabled or Disabled) when the
user selects the record for the first time.

First I don't have a clue of what to disabled or to enabled, so I'll just do
a guess.

Private Sub Form_Current()

If combo1 = "Project" then
combo2.enabled = false
combo3.enabled = true
combo4.enabled = true
combo5.enabled = false
End If

If combo2 = "SomethingElse" then
combo1.enabled = false
combo3.enabled = true
combo4.enabled = true
combo5.enabled = false
End If

'and so on ... blah blah
'you get the drift

End Sub

If you're completely lost. Write down the logical squence step by step.
 
J

John W. Vinson

You can't.

Well, actually you can, with Conditional Formatting (in 2002 and later).
This is why I believe that continuous forms should not be
editable.

say WHAT!?

David, you just destroyed fifteen years of my database work. I don't think
I've ever implemented a database without several continuous forms routinely
used for data entry and editing!

Could you explain your rationale? You've certainly raised my curiosity!
 
D

David W. Fenton

Well, actually you can, with Conditional Formatting (in 2002 and
later).

Certain kinds of things you can do (and it was introduced in 2000,
not 2002), but things like hiding and showing controls and changing
rowsources of combo boxes don't work.
say WHAT!?

David, you just destroyed fifteen years of my database work. I
don't think I've ever implemented a database without several
continuous forms routinely used for data entry and editing!

Could you explain your rationale? You've certainly raised my
curiosity!

I think it's user unfriendly to force editing in a continuous form,
except for a few types of entities, such as an invoice.

There are a number reasons why I have concluded this:

1. my users have never felt comfortable editing in subforms.

2. I have consistently run into problems with conditional display of
controls and most importantly, conditional assignment of rowsources
to combo boxes.

Because of that, I've always almost implemented a read-only
continuous form as a super-listbox (i.e., with much better features
than a mere listbox) from which the user selects a record, and then
the record is loaded into the detail form. It's very easy to do this
by using the PK of the continuous subform as the link criteria for
the detail form.

The place where it gets tricky is adding new records, but I consider
this a feature and not a drawback, because I long ago gave up on
trying to use the same form both for adding new records and for
editing already-created records. First off, if you have any required
fields, it's easy for the user to get stuck in a record. Secondly,
cancelling the add requires deleting the record, and you lose an
Autonumber. Now, that's no disaster, as Autonumbers don't have any
meaning, but I prefer to not load a multi-user shared back end with
having to add an Autonumber and then end up deleting.

With an unbound dialog form for adding new records, you can collect
the required fields and only add the record when you have all the
right data. And cancelling does nothing to the underlying data
table. Also, it's an excellent place to check for possible
duplicates because you then don't load the database with the locks
and error conditions that come from trying to insert a record that
violates a unique index.

This has been my SOP for nearly 10 years, and I've found it much
less work than trying to get editable continuous forms to do all the
things that are needed in my apps.
 

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