Private Sub cmderq_Click()
On Error GoTo Err_cmderq_Click
Dim strWhere As String
strWhere = ""
If Not IsNull(Me.Text1) Then
strWhere = strWhere & "([yearmonth] like '" & Me.Text1 & "') AND "
End If
If Not IsNull(Me.Text2) Then
strWhere = strWhere & "([codeno] like '*" & Me.Text2 & "*') AND "
End If
If Not IsNull(Me.Text3) Then
strWhere = strWhere & "([area] like '" & Me.Text3 & "') AND "
End If
If Not IsNull(Me.Text4) Then
strWhere = strWhere & "([place] like '*" & Me.Text4 & "*') AND "
End If
If Not IsNull(Me.Text5) Then
strWhere = strWhere & "([customer] like '*" & Me.Text5 & "*') AND "
End If
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
strWhere = "select * from stock_q where " & strWhere
Me.List1.RowSource = strWhere
Me.List1.Requery
Exit_cmderq_Click:
Exit Sub
Err_cmderq_Click:
MsgBox Err.Description
Resume Exit_cmderq_Click
End Sub