Password protect a page on a tab control

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Password protect a page on a tab control

Post by Leesha »

Hi,

I have [pageAR] that is a page on a tab control on a form. I would like to passoword protect this page so that when someone clicks on the tab they are prompted to enter a password. If they don't know the password they won't be able to see the page. I tried the on click event to have a page the the password load but that doesn't work. What am I doing wrong, or is there a better approach?

Thanks,
Leesha

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Password protect a page on a tab control

Post by HansV »

You should use the On Change event of the tab control instead of the On Click event.

But there is a problem with this approach: Access will first switch to the tab page, then run the code. So you should also hide all controls on the tab page, and only make them visible when the correct password has been entered.

Alternatively, you could hide the tab page, and provide a command button that prompts for the password, and makes the tab page visible when the correct password has been entered.
Best wishes,
Hans

Leesha
BronzeLounger
Posts: 1488
Joined: 05 Feb 2010, 22:25

Re: Password protect a page on a tab control

Post by Leesha »

I went with option 1. Worked like a charm!
Thanks,
Leesha