0
點擊我想讓我的按鈕在me.txtAddNote爲空時不添加文本,並顯示提示用戶輸入文本或取消的消息。當me.txtAddNote有文本時,我想單擊以輸入文本。目前,我的代碼在兩種情況下甚至在msgbox彈出之前都會添加文本。任何幫助表示讚賞,謝謝。點擊命令,當文本框爲空白時不添加文本
Private Sub cmdAddNote_Click()
Dim LName As String
On Error Resume Next
LName = DLookup("[LNAME]", "[qryEmpDepDes]", "[EMP_NO]='" & Me.txtUserID & "'")
[NOTES] = Date & ": " & Me.txtAddNote & " (" & Me.txtUserID & " " & LName & ")" & vbNewLine & vbNewLine & [NOTES]
Me.txtAddNote = ""
Me.cmdAddNote.Enabled = True
Me.cmdClose.Enabled = True
Me.cmdClose.SetFocus
'5-16-2016 testing blank text box'
If Me.txtAddNote = "" Then
If MsgBox("No text is entered. Hit OK to enter text. Hit CANCEL to close out.", vbOKCancel) = vbOK Then
End If
Else
DoCmd.Close
End If
末次