own passwort - function

  • Thread starter Thread starter Thomas Sandgruber
  • Start date Start date
T

Thomas Sandgruber

Hello NG



I'd like to write a Passwort - function for several different access
applications.



Shout:

In the applications I have a main screen with a Button (BUTTONPW). When the
Button is pressed I call the function PASSWORTQUERY. (event: "When CLICK")



In this routine I call with DOCMD a Userform where the Users has to type in
the passwort.

Afterwards the user can click OK or Exit.
If Exit:

The Userform shoult be closed an the Programm returns to the Main screen



If OK:

The Passwort will be checked. The return should be true or false.



Problem:



After cklicking the button BUTTONPW the Userform comes up to the screen.

Instead of waiting for the the userinput, the programm continues with the
next line after the DOCMD. (look source-code: next line is msgbox)



Wish:

The program should call the passwort - window. The programm should wait
until the user puts in the passwort or presses Exit.



After putting in the passwort it should be checked

If Ok: true should be given back to the function PASSWORTQUERY

ELSE: false should be given back.



PasswortQuery should give this return value to the main screen



Do you have any ideas?



Sub BUTTONPW_CLICK , Dieser Button ist im
Hauptprogramm angelegt

Dim ret as boolean



' Jetzt Aufrufen des Passwortfensters



Ret = passwortabfrage ("TEST")





' Diese Anweisungen sollen solange warten, bis Passwortabfrage beendet ist

Msgbox(ret)

Msgbox("123")

Msgbox ("222")

Usw.



endsub







Function PasswortQuery (pw as string) as boolean

Dim returnwert as boolean



' Show Passwort - Window

Docmd.openform "PasswortInput",,,,,pw



PasswortQuery = returnwert



End function







Routines of the window PasswortInput

Routine: OK-Click



Dim ret as boolean



If passworteingegeben = pw

Ret = true

Else

....

endif







Routine EXIT - Click

PasswortInput.Close
 
Open the form as a dialog-form.
Then the code is not processed until the form is closed.

Alex
 
Back
Top