In fact, it seems to me it may be better to put checking code into the KeyPress() subroutine of the textbox into which the user is typing the password:
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(" ") Or KeyAscii = vbTab Then
' Remove the keystroke, so the text box never sees it.
KeyAscii = 0
End If
End Sub