The Royale - S2-E12
Continuity mistake: As the Texan follows the dice on Data's last throw, his glasses are on. As he complains about losing his bet, his glasses are suddenly missing.
The Royale - S2-E12
Continuity mistake: When Data is first playing Blackjack, his first face up card dealt is a 7, followed by a 5. In the close up when the final card is dealt, the first two cards are now 3 and 2.
Answer: Yes. The doors to the holodecks can be locked when in use by anyone aboard the Enterprise so they couldn't be disturbed. However, high ranking officers like Captain Picard could override the doors as it's seen that overrides are in use even for the crews quarters. Even Barclay, when he's indulging in one of his fantasies could have the doors to the holodeck unlocked by an override code.