Hi Guys
I have a small database with only three tables of Items “ItemsT”,” Products” and” Orgin”.
Main form “Search Items by combobox” contains sub_form of items table” ItemsT subform” Filtered by Three Combo Boxes
1. Cbo_ProdId (Source from Products Table).
2. Cb
rgin (Source from Orgin Table).
3. Cbo_thicknessId (Source by Grouping ItThickness from ItemsT Table).
Made by visual basic As Following
Function SearchCriter()
Option Compare Database
Private Sub Cb
rgin_AfterUpdate()
Call SearchCriter
End Sub
Private Sub Cbo_ProdId_AfterUpdate()
Call SearchCriter
End Sub
Private Sub Cbo_thicknessId_AfterUpdate()
Call SearchCriter
End Sub
Function SearchCriter()
Dim StrProdId, StrOrgin, thicknessId As String
Dim strCriteria As String
If IsNull(Me.Cbo_ProdId) Then
StrProdId = "[ItName] like '*'"
Else
StrProdId = "[ItName]= '" & Me.Cbo_ProdId & "'"
End If
If IsNull(Me.Cb
rgin) Then
StrOrgin = "[ItOrgin] like '*'"
Else
StrOrgin = "[ItOrgin]= '" & Me.Cb
rgin & "'"
End If
If IsNull(Me.Cbo_thicknessId) Then
thicknessId = "[ItThickness] like '*'"
Else
thicknessId = "[ItThickness]= " & Me.Cbo_thicknessId
End If
strCriteria = StrProdId & "And" & StrOrgin & "And" & thicknessId
task = "Select * from ItemsT where " & strCriteria
Me.ItemsT_subform.Form.RecordSource = task
Me.ItemsT_subform.Form.Requery
End Function
Private Sub cmd_Prod_Click()
Dim StrProdId, StrOrgin, thicknessId As String
Dim strCriteria As String
If IsNull(Me.Cbo_ProdId) Then
StrProdId = "[ItName] like '*'"
Else
StrProdId = "[ItName]= '" & Me.Cbo_ProdId & "'"
End If
If IsNull(Me.Cb
rgin) Then
StrOrgin = "[ItOrgin] like '*'"
Else
StrOrgin = "[ItOrgin]= '" & Me.Cb
rgin & "'"
End If
If IsNull(Me.Cbo_thicknessId) Then
thicknessId = "[ItThickness] like '*'"
Else
thicknessId = "[ItThickness]= " & Me.Cbo_thicknessId
End If
strCriteria = StrProdId & "And" & StrOrgin & "And" & thicknessId
DoCmd.OpenReport "ItemsT", acViewPreview, , strCriteria
End Sub
Need Any Code So that I can use filter like the filter in excel & access (When I search by ProdIt and if I want to search by ItOrgin not show all value in Orgin Combobox but only that Depending with Result of ProdIt.
There's a problem while uploading My Access DB But i sent it to the admin i hope he allows to perform uploading
I have a small database with only three tables of Items “ItemsT”,” Products” and” Orgin”.
Main form “Search Items by combobox” contains sub_form of items table” ItemsT subform” Filtered by Three Combo Boxes
1. Cbo_ProdId (Source from Products Table).
2. Cb

3. Cbo_thicknessId (Source by Grouping ItThickness from ItemsT Table).
Made by visual basic As Following
Function SearchCriter()
Option Compare Database
Private Sub Cb

Call SearchCriter
End Sub
Private Sub Cbo_ProdId_AfterUpdate()
Call SearchCriter
End Sub
Private Sub Cbo_thicknessId_AfterUpdate()
Call SearchCriter
End Sub
Function SearchCriter()
Dim StrProdId, StrOrgin, thicknessId As String
Dim strCriteria As String
If IsNull(Me.Cbo_ProdId) Then
StrProdId = "[ItName] like '*'"
Else
StrProdId = "[ItName]= '" & Me.Cbo_ProdId & "'"
End If
If IsNull(Me.Cb

StrOrgin = "[ItOrgin] like '*'"
Else
StrOrgin = "[ItOrgin]= '" & Me.Cb

End If
If IsNull(Me.Cbo_thicknessId) Then
thicknessId = "[ItThickness] like '*'"
Else
thicknessId = "[ItThickness]= " & Me.Cbo_thicknessId
End If
strCriteria = StrProdId & "And" & StrOrgin & "And" & thicknessId
task = "Select * from ItemsT where " & strCriteria
Me.ItemsT_subform.Form.RecordSource = task
Me.ItemsT_subform.Form.Requery
End Function
Private Sub cmd_Prod_Click()
Dim StrProdId, StrOrgin, thicknessId As String
Dim strCriteria As String
If IsNull(Me.Cbo_ProdId) Then
StrProdId = "[ItName] like '*'"
Else
StrProdId = "[ItName]= '" & Me.Cbo_ProdId & "'"
End If
If IsNull(Me.Cb

StrOrgin = "[ItOrgin] like '*'"
Else
StrOrgin = "[ItOrgin]= '" & Me.Cb

End If
If IsNull(Me.Cbo_thicknessId) Then
thicknessId = "[ItThickness] like '*'"
Else
thicknessId = "[ItThickness]= " & Me.Cbo_thicknessId
End If
strCriteria = StrProdId & "And" & StrOrgin & "And" & thicknessId
DoCmd.OpenReport "ItemsT", acViewPreview, , strCriteria
End Sub
Need Any Code So that I can use filter like the filter in excel & access (When I search by ProdIt and if I want to search by ItOrgin not show all value in Orgin Combobox but only that Depending with Result of ProdIt.
There's a problem while uploading My Access DB But i sent it to the admin i hope he allows to perform uploading