 |
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1616
|
Re: How to create a start page
The select case (and similar methods) would be the only way, and you'd have to update it whenever you add a new form regardless.
(as a note, I wouldn't be using a data environment to retrieve the data anyway, use variables)
|
|
18-12-2002 at 04:07 AM |
|
|
JLRodgers Level: Moderator
 Registered: 04-04-2002 Posts: 1616
|
Re: How to create a start page
That's the thing, no matter how it's done, you have to update the code with all new forms that are added (which is what dchildress was trying to aviod).
Of course it's only annoying during the first stages when new forms are added frequently. Towards the final version, few to no modifications are (normally) made to form names, so few changes are normally needed.
The only way no to use a select case would be (although NOT a good idea, and normally not even possible):
1) Load ALL forms that can be the startup form
2) Loop through all the forms, making the one that's the desired start form visible.
' To load a form
' Load frmMain
' Load frmForm1
' etc for all possible startup forms
' Assuming all forms are loaded
Dim fForm As Form
For Each fForm in Forms ' Forms being all loaded forms
If fForm.Name = strStartupForm Then
fForm.Visible = True
End If
Next
|
the catch here is, normally any code that's in the Form_Activate or Form_Load (or anything similar that's done at loading) has to be removed/moved otherwise everything will be run when the form's loaded. Any .Visible events in the form that run when loaded/activated have to be removed...
|
|
18-12-2002 at 10:02 PM |
|
|
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Re: How to create a start page
additional help i hope..
if that's the case, then i suggest that all the code in each form's load or activate event be placed inside a sub, whether private or public...
i'll post back and give code samples.
please be a little patient.
thansk,.
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
19-12-2002 at 03:19 PM |
|
|
|
|
 |
 |