Code Correction and modified for efficiency

Private Sub Command1_Click()
If Text1.Text = "hey" Then
Text2.Text = "Access Granted"
Text2.Text = "Access Denied"
End If
End Sub

I don't know why you tried to use the "Val" function. That converts text into numbers. "hey" is converted to 0. "123" is converted to 123. And you don't need to use a variable anyway.
Domain Registration, Hosting, Management