Star Trek: The Next Generation Season 3 Episode 21
Stardate: 43807.4. A nervous and insecure officer, Lt. Reginald Barclay, places the Enterprise in great danger when he neglects his duties in Engineering, and instead spends his time acting out his fantasies on the holodeck.