Link to home
Start Free TrialLog in
Avatar of Maurizio Aghileira
Maurizio Aghileira

asked on

Mi dà un errore quando inserisco la password Più la tabella non si apre (Frm_Database)

Database_Maury.accdbGood morning my name is Maurizio

And my problem that is driving me crazy is this:

If you try to take a close look at my created project that I inserted in the post in the Attachments section
You will immediately notice that he has a problem that I cannot solve
And it is this:

Once the Maschra Password is open I should enter a Password that can be found if necessary by pressing the (Help) button and so far it works great.

But if I press the (OK) button to close the form (FRM_Password) and open the (FRM_Database) the action stops giving me an error in this area:

>>>> DoCmd.OpenForm Forms! [Frm_Database], acViewNormal
DoCmd.Close
End Sub

Therefore I would like to know how to solve these problems and understand why?
Thanks !!!!!!!!
Greetings from A.Maurizio
Avatar of Bitsqueezer
Bitsqueezer
Flag of Germany image

Hi,

"Forms" is a collection which contains only all currently opened forms. But you are trying to open a form so you cannot find it in this collection - and Access cannot either, that's the reason for this error. Beside that, "OpenForm" wants to have a string containing the name of the form, but you are using the form object itself.

So correct would be:

DoCmd.OpenForm "frm_Database", acNormal

Open in new window

Also "acViewNormal" should be "acNormal" as you can see in the IntelliSense list.

"OpenForm" could also be used to bring a form back to front if it was already opened before. So if that is the case you could also use instead:

DoCmd.OpenForm Forms!frm_Database.Name, acNormal

Open in new window

But in that case you need to be sure that it was opened before.

Try to use the first way in all cases and it works for both cases.

Cheers,

Christian

Avatar of Maurizio Aghileira
Maurizio Aghileira

ASKER

Ciao Bitsqueezer vi ringrazio molto per il vostro consiglio e i codici che mi avete gentilmente offerto; né farò buon uso di esso.
Grazie
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.