Hide Form

JPR

Registered User.
Local time
Today, 15:24
Joined
Jan 23, 2009
Messages
201
Hello,
For my db, I have created a form which I use as a kind of login screen that has a combo from which users select their name. Once selected, a command opens the main form.

DoCmd.OpenForm "FrmMenu", acNormal, "", "", , acNormal
DoCmd.Maximize

Since most other forms in the db have a reference to this combo by displaying the users name and saving it when records are added or changed I would like to add a code that keeps the login from either minimized or hidden, simply a way that users cannot close it.

Thank you for any help you can provide.
 
Try:
Code:
DoCmd.OpenForm "FrmMenu", acNormal, "", "", , acNormal

DoCmd.Maximize

Forms!NameOfFormToHide.Visible = False
 
Hello,
I have added your code, but all forms seem to disappear, as if the hide function prevents to view the frmMenu.
 
Private Sub cboLogIn_Change()
DoCmd.Echo False, ""
DoCmd.OpenForm "FrmMenu", acNormal, "", "", , acNormal
DoCmd.Maximize
Forms!login.Visible = True
End Sub
 
Sorry forgot to say that the login is a pop up form and the frmMenu has a normal view. Thank you
 
Forms!login.Visible = True
should be:
Forms!login.Visible = False
I wouldn't have login as a pop up.
 
All my templates use a hidden form once a user logs in you could download them Here

The time and billing "Project" Being the last one

mick
 
Another approach is to save the user name as a global variable (or a tempvar) so its value remains available to the database whilst it remains open.
If you do that, the login form can be closed rather than just hidden
 
Another approach is to save the user name as a global variable (or a tempvar) so its value remains available to the database whilst it remains open.
If you do that, the login form can be closed rather than just hidden
Thanks. But would not know how to write such a code.
 
All my templates use a hidden form once a user logs in you could download them Here

The time and billing "Project" Being the last one

mick
Thanks. Got an error while trying to download. Will have to try tomorrow.
 
Yes, made all the changes as suggest but the login does not hide and the frmMenu does not show up. Strange
Where do you have the code and have you checked that the code does actually run
 
Hi, the code is in the AfterUpdate Event. The code does run without the Forms!Login.visible = True line. It works also if I put it in the OnChange event (without the hide line).

Private Sub cboLogIn_AfterUpdate()
DoCmd.Echo False, ""
DoCmd.OpenForm "FrmMenu", acNormal, "", "", , acNormal
DoCmd.Maximize
Forms!login.Visible = True
End Sub
 
:unsure: Why do you keep using the line:
Forms!login.Visible = True

This makes the form visible

As I've stated before, this line needs to be:
Forms!login.Visible = FALSE
 
Sorry, my type. I did change the code to false but still getting the same problem. I cannot view any form.
By the way, I created a similar macro and converted it to VB. It's the only way works (although not the correct way)

DoCmd.Echo False, ""
DoCmd.OpenForm "LogIn", acNormal, "", "", , acNormal
DoCmd.Minimize
DoCmd.OpenForm "frmMenu", acNormal, "", "", , acNormal
DoCmd.Maximize
DoCmd.SelectObject acForm, "Login", True
DoCmd.Minimize
 
Remove the line:
DoCmd.Echo False, ""

or Add:
DoCmd.Echo True, ""

as the last line of code
 
Last edited:
Finally works!!! Thank for your help.
 

Users who are viewing this thread

Back
Top Bottom