Toggle Controls on sub form

G

Guest

Access 2002

On a sub form I wish to present the user with either a combo box
(cbResponse) or a text box (tbResponse) depending on the value in the
QuestionType control. Both controls are bound to the same field.

A search of this Group lead me to create these two controls and toggle the
Visible property.

The problem is that the sub form is continuous and, depending on the record
that has focus, all records display combo boxes or all records display text
boxes. Not what I was aiming for.

Is there a way for me to display the the control that is appropriate for
each record?
 
A

Allen Browne

It is not clear why you want 2 controls, but you cannot selectively toggle
the Visible property and get different results on different rows.

You can leave them both visible, and choose which one is in front (Format
menu in form design view.) You can use the Got Focus event of the one in
front to SetFocus to the other one. That makes it the one that's visible on
the current row only.
 
G

Guest

Thanks Allen

I was afraid the answer would be along those lines.

The reason for the two controls is that the response could be either free
text or from a predetermined list.

I can't see another way around it design-wise so, maybe I'll just have to
live with it unlees there is some inspiration.
 
A

Allen Browne

Perhaps you could place the text box to the right of the combo. One of the
choices in the combo could be "Other: please specify." Use the BeforeUpdate
event of the *form* to check that the text box is not null if the combo
contains that choice.
 

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