I have a form which is based on a Table called T_Product. There is an unbound ComboBox where I can select a Product record, this works OK. I have now added a field in the T_Product table called ProdComp. The idea of this field, is when I enter data in the product form, I can separate Products from Components and vice versa. When I Type “=Product” in the ProdComp field in the T_Product query grid criteria, I can only select products from the combo box. I then remove this selection and type “=Component” and can only select components, this works as I want. I have never used an Option Group before, so I decided to use this for my selection from the combo box. When I select Product, then select from the combo box, all listings appear, I select Component, then select from the combo box, all listings appear, I choose All and all listings appear. My selections will not filter for my choice. Below is the code I used in the Option Group and the Sequel statement for the combo box. I would appreciate some assistance in what I am doing wrong.
Option Group
Private Sub Frame110_AfterUpdate()
If Frame110 = 1 Then
Me.Filter = "ProdComp = ‘Product’"
Me.FilterOn = True
End If
If Frame110 = 2 Then
Me.Filter = "ProdComp = ‘Component’"
Me.FilterOn = True
End If
If Frame110 = 3 Then
Me.FilterOn = False
End If
End Sub
Combo Box
SELECT DISTINCTROW T_Product.ProductID, T_Product.Product, T_Product.Manufacturer, T_Product.ProdComp
FROM T_Product
ORDER BY T_Product.Product, T_Product.Manufacturer;
kevsim
Option Group
Private Sub Frame110_AfterUpdate()
If Frame110 = 1 Then
Me.Filter = "ProdComp = ‘Product’"
Me.FilterOn = True
End If
If Frame110 = 2 Then
Me.Filter = "ProdComp = ‘Component’"
Me.FilterOn = True
End If
If Frame110 = 3 Then
Me.FilterOn = False
End If
End Sub
Combo Box
SELECT DISTINCTROW T_Product.ProductID, T_Product.Product, T_Product.Manufacturer, T_Product.ProdComp
FROM T_Product
ORDER BY T_Product.Product, T_Product.Manufacturer;
kevsim