Hide all controls inside another control

G

Guest

I would like to create several different boxes that have some of the same
controls in them and just display the appropriate one based on a value on the
form.

IE if this was a direct flight I would display the box with just the
original flight number, departure time, and arrival time at destination
airport.
If this were a connecting flight I would display the box that had the
original flight number departure time, arrival time at connecting aiport,
connecting flight number, departure time of 2nd flight and arrival time at
destination airport.

Is there some type of control that I can set these different controls in and
then based on the value txtDirectFlight = Yes/No display the proper box?

I have tried a rectangle, options group, bound box, and can't seem to figure
it out.

Any help is appreciated.
 
G

Graham R Seach

Of course it can be done, but where is the flight information coming from?
Is it part of the form's recordset, or are we supposed to look it up
somewhere? If so, where? Also, are you really using a text box called
txtDirectFlight? If so, are you really using "Yes" and "No" as its vpossible
values? What happens if the dumb user enters something else? I think it
would be better to use a CheckBox.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
J

John Vinson

Is there some type of control that I can set these different controls in and
then based on the value txtDirectFlight = Yes/No display the proper box?

I have tried a rectangle, options group, bound box, and can't seem to figure
it out.

Try a Page control; put one set of controls on one page, the rest on
another. Either have the user simply select the appropriate page (by
default it looks like tabs on a file folder, but you can use buttons
as the view instead); or programmatically select another page in the
AfterUpdate event of txtDirectFlight.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
G

Guest

Thanks for your response. I just used that as an example. Most everthing
will be based on what type of order it is which is inputed at the time the
order is placed. If its a Convention Order I will want to display ground
carrier information. If its an air shipment I will want to display a
different set of controls.

I want to display this information on a summary page and have it in the same
area of the page each time. I would like to have a series of different
boxes?? with the applicable controls in them which would all have their
visible property set to false. When the summary form gets focus I would like
to place the applicable box in a certian position on the form, and set the
visible propery to true.
 
G

Graham R Seach

OK, but flight data *must* be stored somewhere, and I'm assuming you'll need
to retrieve that data based on a Flight No entered/selected on the form.

I would add 6 TextBoxes to the form, the first 3 visible, the last 3
invisible:

* txtFlightNo1
* txtDepTime1
* txtArrTime1

* txtFlightNo2
* txtDepTime2
* txtArrTime2

When the user enters/selects a specific Flight No, retrieve the details of
that flight from a recordset. If that flight has more than one leg, pull the
data for the next leg, display the 2nd set of TextBoxes, and display the
data in them. If the flight consists of one leg only, clear then hide the 3
TextBoxes.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
G

Guest

I am probably confusing the issue.

All I really want to know is if there is a way of putting several txtboxes,
within 1 control, (lets call it the Master Control) and when I set the
visible propery on the "master control" if al the txtboes insde the "master
control" will take on the same visible properties of the master control?

I will design different master controls, with different txtboxes where the
control source is set to the field I need to be displayed, and then set the
visible property on the "Master Control" I want to display based on some
criteria.

Thanks again for your consideration.
 
R

Rick Brandt

John Vinson said:
Try a Page control; put one set of controls on one page, the rest on
another. Either have the user simply select the appropriate page (by
default it looks like tabs on a file folder, but you can use buttons
as the view instead); or programmatically select another page in the
AfterUpdate event of txtDirectFlight.

A TabControl with a single page on it and set to PageStyle = "none" can indeed
act similar to a frame in Java in that you can put a bunch of objects on it and
when you hide the TabControl it will have the affect of hiding all of those
controls. Since objects not on the TabControl will still show through it the
objects grouped on the TabControl need not even be located all together. The
only downside is that being on the TabControl imposes a separate and
non-continuous tab order from the rest of the form. That means you can't have
the same seamless tab order that have without a TabControl unless you do some
extra work.

You would have to decide if the extra work to maintain a seamless tab order is
more trouble that an alternative way to hide all of the target controls.
 
D

Dirk Goldgar

Rick Brandt said:
You would have to decide if the extra work to maintain a seamless tab
order is more trouble that an alternative way to hide all of the
target controls.

Such as, for example, setting the Tag property of all the controls in
each group to the same value (e.g., "Group1", "Group2", "Group3"), and
then having a procedure that loops through the form's Controls
collection and sets the Visible property of all controls that have a
give Tag value.
 

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