Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden forms 1

Status
Not open for further replies.

oraclejunior

Technical User
Jul 8, 2003
111
0
0
GB
I have a form called platform that has a navigation tree on the Left hand side showing registers and issues. On the top there are buttons that open forms called create owner, create register.

I want the forms to open as subforms in the center of the form Plat form but not to be visible when Platform first opens.

How do I set the subform to invisible when the Platform opens and the using a button make the form visible to enter data and then click a button in the subform to make it invisible again.

Thanks
 
On the forms On open event set the visible property of the subform to false.

On the click event of each button, set the visible property of the appropriate subform to true.


Honestly, I would write a procedure to make all forms not visible and call it on the open event and each click event (then make the appropriate one visible). That way it is easier to maintain and only one subform is visible at a time.
 
How are ya oraclejunior . . .
oraclejunior said:
[blue]I want the forms to open as subforms in the center of the form Plat form but not to be visible when Platform first opens.[/blue]
You need to set the Default [blue]Visible[/blue] property of the two subforms to [purple]No![/purple] for your open condition! . . .
[ol][li]Open [blue]platform[/blue] in design view.[/li]
[li]Call up the [blue]Properties[/blue] window (duoble-click the square box just to the left of the ruler. In the properties window select the [blue]Format tab[/blue].[/li]
[li]Select the subform from the combobox on the the [blue]Formatting ToolBar[/blue] (when you hover the mouse over the combo it'll say Object!).[/li]
[li]Set the [blue]Visible[/blue] property to [purple]No[/purple].[/li]
[li]Perform the step above for [blue]all other subforms[/blue].[/li]
[li]For the buttons you make [blue]that subform visible and all others hidden![/blue]The following is an example for the button the opens [blue]create owner[/blue]:
Code:
[blue]   Me[create owner].Visible = true
   Me![create register] = False[/blue]
[/li][/ol]
[blue]Your Thoughts . . .[/blue]



Calvin.gif
See Ya! . . . . . .
 
Woops! [blush] . . . Should be:
Code:
[blue]   Me[create owner].Visible = true
   Me![create register].Visible = False[/blue]

Calvin.gif
See Ya! . . . . . .
 
super guys that works. Problem now id I cannot enter any data into the forms. They allow me to click on drop downs and onto the text boxes but I cannot type anything in.

Also for example when I click on lets say create owner, the form comes up I then click on the text box but then I think I want to create owner I get an error saying somethin about you cannot hide the form because it has focus......

 
oraclejunior said:
[blue] . . . I get an error saying somethin about you cannot hide the form because it has focus......[/blue]
That is correct!. To correct this you need to [blue]shift the focus[/blue] to a control on the mainform (not on the subforms) before you manipulate the visible property of the subforms. Making your code:
Code:
[blue]   Me![purple][b][i]TextboxName[/i][/b][/purple].SetFocus
   Me[create owner].Visible = true
   Me![create register].Visible = False[/blue]
If necessary add an [blue]unbound textbox[/blue] (set width/height to zero) and use that instead.

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
I have created an unbound textbox that I use to set focus to. That resolves the issue of hiding the form.

Now the only problemo is the inability to type into the sub form. What causes this?

Thanks.
(by the way I am finding this site an excellent way to develop projects and learning through interactive questioning.
 
The foms used are all unbound. I use ADO to enter data into the tables. This works fine on the individual forms.

As soon as I use the same forms as subforms I cannot enter data into the text boxes.
 
oraclejunior said:
[blue]The foms used are all unbound. I use ADO to enter data into the tables. [purple]This works fine on the individual forms.[/purple][/blue]
Are you saying the [blue]RecordSource[/blue] property of the subforms are empty? (check them to be sure) . . . as well as the [blue]Link Master/Child[/blue] properties? . . .

I don't know what to expect if the underlying tables are Oracle based! . . . [blue]Are they?[/blue] . . . even so, this should matter not with an unbound form! . . .

[blue]Your Thoughts? . . .

Calvin.gif
See Ya! . . . . . .
 
Initially I created a number of unbound forms for creating owner, creating register, editing owner, editing register etc. Each form had its own set of buttons such as clear form, save details and exit.

These forms work ie I can create owners, registers, make amendments etc.

Then I got the idea to use a mainform with subforms that become visible as and when required.

I created these subforms and as above implemented the vba code so the appropriate forms become visible when they are called upon at the click of a button on the main form.

But I cannot enter data into the text boxes.

The Sorce object on each of the subforms is the original forms example CreateOwner subform has CreateOwnerForm as Source object. The enabled property = Yes, Locked = No, Link child and Master fields are blank. When I click on the Master or Child property I get the following error:

Cant build a link between unbound forms ??????
 
this bit of additional info may help. The mainform that the subforms sit in does not show any data appart from have a number of buttons to call each of the subforms.
 
Roger That oraclejunior . . .

I fully understand what your doing and when you say:
oraclejunior said:
[blue]Cant build a link between unbound forms ??????[/blue]
That is correct for an unbound form! The nitty gritty of the problem . . .
oraclejunior said:
[blue] . . . But I cannot enter data into the text boxes . . .[/blue]
This makes no sense as far unbound forms are concerned espcially in the matter of entering data. Since the subforms work as independent forms [purple]I'm fast believing this mainform or the db has some kind of corruption![/purple] 9I've simulated what you have with no problemo!

As a test open a new unbound form and setup the subforms one by one testing for editing!

[blue]Let me know the results! . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hi there,

I think you have a point. I have just created a new form and then one by one added on the subforms and now it works.

You have been a star with this, thank you for your help. I will be back with more as this system being developed will assist a multibillion pound project once complete.

Regards

OracleJunior....
 
Hi,

Problemo. The combos on the subforms do not refresh.

E.g. I create owner (works)
I then goto the update Owner subform (I can see owner)
I go back to crate owner and create owner2
O go back to update owner and I can only see owner1 and not 2.

How do I refresh/requery all subforms to ensure all info is current and consistent.

Thanks, I have tried recalcs, requery but all fails.
 
oraclejunior . . .

If you wouldn't mind start a new post so all can benefit from this new problem [thumbsup2] . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top