Reputation: 55
I have a query called Search_Tool
which output one of the record from the table that is searched by Serial Number
. The Criteria of the Serial Number
is the one of the txtbox.value
in the form
. The query is then displayed on a List Box
. The query will be activated upon pressing a button
. However i need a msgbox prompt when one of the column displayed in the query is filled.
So when I input 123456789 into the text box and press search, it should prompt a msgbox when it detects that the Date
is not empty.
How can I make this msgbox happen?
I have made another post for clearer understanding: The blank column of the particular List Box based on query is not recognized as either empty or null
Private Sub cmdSearch_Click()
Dim check As String
DoCmd.OpenQuery "xxxxx_Search"
DoCmd.Close acQuery, "xxxxx_Search"
SearchList.Requery
If SearchList.ListCount = 0 Then
MsgBox ("No records found.")
DoCmd.Close
DoCmd.OpenForm "xxxxx_Unload"
Exit Sub
ElseIf Not IsNull("End_Date", "xxxxx_Search") Then
MsgBox ("The Unload data for this Serial Number have been filled.")
DoCmd.Close
DoCmd.OpenForm "xxxxx_Unload"
Exit Sub
End If
End Sub
SELECT xxxxx.Serial_Number, xxxxx.End_Date, xxxxx.End_Time, xxxxx.End_System_Time, xxxxx.End_Operator, xxxxx.Success, V.End_Remarks
FROM xxxxx
WHERE (((xxxxx.Serial_Number)=[Forms]![xxxxx_Unload]![txtSearch]));
Upvotes: 1
Views: 255
Reputation: 888
I have this function in my projects and use it instead of IsNull() - it is more flexible.
Public Function IsEmptyOrNull(strValue As Variant) As Boolean
On Error GoTo Err_
If Trim(strValue) = vbNullString Or isnull(strValue) Then
IsEmptyOrNull = True
End If
Err_:
End Function
Upvotes: 0
Reputation: 55831
You must address the control and its value, not its name:
ElseIf Not IsNull(Me![End_Date].Value) Then
For a listbox:
ElseIf Nz(Me!SearchList.Column(1)) <> "" Then
Upvotes: 1