Hi,
I'm new to this forum.
I'm developing an Access 2003 database. In that database I have a form that starts up when the database is opened. On this startup form I have buttons to open other forms. Those other forms I also can open from a custom menu bar. This to make the database as user friendly as it is possible.
Now I want to hide the startup form whenever I open another form by either opening it from the menu bar or either by clicking on a button on the startup form.
When the other form is unloaded, the startup form needs to be unhided.
Now, I do know the code to hide/unhide the startup form by clicking on a button on that form. But not in combination when a form is opened from the menu bar.
Is this workable? And if yes, how should I do in VBA code?
Thank you very much for your help.
My practice:
From Form_Start I wish to open Form_Localitati by clicking a button named cmdOpen_Localitati: - Private Sub cmdOpen_Localitati_Click()
-
Me.Visible = False
-
DoCmd.OpenForm "Localitati", , , , , , Me.Name
-
End Sub
Note please that I pass the name of current form in OpenArgs arguments ( , , , , , , Me.Name)
The code in Form_Localitati (the second form) will be: - Option Explicit
-
Dim FormaApelanta 'Retain the main form's name
-
-
Private Sub Form_Load()
-
FormaApelanta = Me.OpenArgs
-
............
-
End Sub
-
-
Private Sub Form_Close()
-
Dim frm As Form
-
For Each frm In Application.Forms
-
If frm.Name = FormaApelanta Then
-
frm.Visible = True 'Make visible the main form
-
Exit For
-
End If
-
Next frm
-
............
-
End Sub
5 1770
although it might not be what is best for you, but you could put in the code to "hide all other forms" in each form's OnLoad event ... this way it does not matter how the form is opened
My practice:
From Form_Start I wish to open Form_Localitati by clicking a button named cmdOpen_Localitati: - Private Sub cmdOpen_Localitati_Click()
-
Me.Visible = False
-
DoCmd.OpenForm "Localitati", , , , , , Me.Name
-
End Sub
Note please that I pass the name of current form in OpenArgs arguments ( , , , , , , Me.Name)
The code in Form_Localitati (the second form) will be: - Option Explicit
-
Dim FormaApelanta 'Retain the main form's name
-
-
Private Sub Form_Load()
-
FormaApelanta = Me.OpenArgs
-
............
-
End Sub
-
-
Private Sub Form_Close()
-
Dim frm As Form
-
For Each frm In Application.Forms
-
If frm.Name = FormaApelanta Then
-
frm.Visible = True 'Make visible the main form
-
Exit For
-
End If
-
Next frm
-
............
-
End Sub
NeoPa 32,556
Expert Mod 16PB
I'm afraid I had to reset the Best Answer as it doesn't actually answer the question. There is nothing in there to handle making the calling form visible again on close of the called form.
Personally, I handle this situation with a class that captures closing of a form and remembers where the open was called from, but the simpler answer has been posted already by Mihail. As it's already there I won't repeat it. I may suggest that such a call (using OpenArgs) is much more clear when using named parameters, but otherwise this is an easy and well laid out solution which really ought to have been selected as Best Answer.
I'm open to posting my class-based solution if anyone's interested, but it's less straightforward than using OpenArgs frankly.
Hi !
Yes NeoPa. I am interested to see your solution because I wish to learn about classes. I know what the classes can do but I don't know HOW. So, if you are so kind... Thank you !
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ice Man |
last post by:
Hi all
How Can I submit a form by clicking on an image instead of the submit
button?
Thanks
|
by: Lance |
last post by:
Is there a "best" technique for hiding a form's Close ControlBox button (i.e., the button with an "X" in the top-right corner of a form) but still show the minimize and maximize buttons? I've found...
|
by: MuZZy |
last post by:
Hi,
I'm trying to find a way to find out a form menu height/color as i think
it changes depending on various Windows settings.
I need to create a form of height/color of form menu so that i can...
|
by: ILCSP |
last post by:
Hello,
I am trying to create a form in Visual Basic.Net with a dynamically
created Menu bar. I need the drop down part of a menu item (Reports)
to be dynamically generated according to the...
|
by: Alex |
last post by:
Hello all,
I have a main form(say "form1") .i want to display another form(say
"form2") on occuring of an event (say a button click) and want to hide
it after some time so that it will again...
|
by: abouddan |
last post by:
Hi all
My request has two faces:
1- I need to create my own menu in my project that runs when the application is start. But I want that menu to starts manuly, I mean by runnig codes so I can...
|
by: Kirthikaiitm |
last post by:
Hi,
I have a image button (APPLY)
On clicking apply button how to move the content from textbox to another textarea.
I wrote the code in JScript. But once i click APPLY button the form is...
|
by: ismailc |
last post by:
Good day;
When I click anywhere on the form a particular button remains selected & focused.
Even while i'm busy typing in another textbox the button looks as if it's being selected with a dark...
|
by: samsanjay |
last post by:
Hi everyone,
i m a beginner in c#. i m trying to develop a notepad editor application in c# using windows forms.. i have created a find modeless dialog. when i click the find button, it is able to...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |