Question : How to vba programatically prompt the user to enter a password when trying to open a table from the database window

How can we vba programatically prompt the user to enter a valid password when trying to open select tables (or all tables) from the database window and then close the database if three invalid password entries have been made?  I have a sample db attached.  In one portion of the question:  I would like the user to enter a valid password, no matter what table the user is trying to access from the database window.  In the other portion of the question:  Say, I would like the user to enter a valid password for only trying to access the "tblAudit" table from the database window while all the other tables can be opened readily.  How can this be done programatically using vba code.  For simplicity, let's assume the password is "test".
Attachments:
 
 

Answer : How to vba programatically prompt the user to enter a password when trying to open a table from the database window

I don't believe you can use a wildcard with a multiple parameter that way.

Something like this might work

StringVar Array Input := {?AnyStringPrompt};  // replace this with your string prompt
NumberVar howmany:= count (Input);
Numbervar Index;
BooleanVar SelectFormula:= False;

For Index := 1 to howmany do
  SelectFormula := SelectFormula OR {DepartmentField} StartsWith Input[Index];

SelectFormula

mlmcc
Random Solutions  
 
programming4us programming4us