Option Compare Database
Private Sub cmdSearch_Click()
On Error GoTo errr
Me.FloorMaintanance_subform.Form.RecordSource = SQL = "SELECT FloorMaintanance.* from FloorMaintanance " & BuildFilter
Me.FloorMaintanance_subform.Requery
Exit Sub
errr:
MsgBox Err.Description
End Sub
Private Function BuildFilter() As Variant
Dim varWhere As Variant
varWhere = Null
If Me.txtFloor > "" Then
varWhere = varWhere & "[FloorNO] like " & Me.txtFloor & " AND "
End If
If Me.txtstatus > "" Then
varWhere = varWhere & "[Status] like " & Me.txtstatus & " AND "
End If
If Me.txtCat > "" Then
varWhere = varWhere & "[Catergory] like " & Me.txtCat & " AND "
End If
If IsNull(varWhere) Then
varWhere = ""
Else
varWhere = "WHERE" & varWhere
If Right(varWhere, 3) = "AND" Then
varWhere = Left(varWhere, Len(varWhere) - 3)
End If
End If
BuildFilter = varWhere
End Function
hi friends
this coding not working i dnt know y
plz solve my problem
thanks
inthu