Hi,
New user here. Been using access for a number a years and have a database built that stores inventory items. I have a form created that displays all available inventory in real time.
I would like to filter this info based on two text boxes: one for Grade ([txtGrade]) and one for Diameter (txtDiamter]). The data is contained within a table [Inventory] and the two fields are formatted as text for [Grade] and double, standard with 4 decimals for [Diameter]. The diameters range in size from 1.0000 to 3.1875.
The filter based on grade works fine and the one for diameter works for any diameter except for when the filter is for 1.0000 or 2.0000 or 3.0000.
I have used code behind the after update event property on both text boxes as shown below:
Private Sub txtGrade_AfterUpdate()
On Error GoTo txtGrade_AfterUpdate_Err
' The following filter allows the user to change one or both filters and update the form
DoCmd.SetFilter "", "[Grade] Like '*" & txtGrade & "*' And [Diameter] Like '*" & txtDiameter & "*'", ""
txtGrade_AfterUpdate_Exit:
Exit Sub
txtGrade_AfterUpdate_Err:
MsgBox Error$
Resume txtGrade_AfterUpdate_Exit
End Sub
Private Sub txtDiameter_AfterUpdate()
On Error GoTo txtDiameter_AfterUpdate_Err
' The following filter allows the user to change one or both filters and update the form
DoCmd.SetFilter "", "[Diameter] Like '*" & txtDiameter & "*' And [Grade] Like '*" & txtGrade & "*'", ""
txtDiameter_AfterUpdate_Exit:
Exit Sub
txtDiameter_AfterUpdate_Err:
MsgBox Error$
Resume txtDiameter_AfterUpdate_Exit
End Sub
If I type in the numeral 1, in the txtDiameter box, the form filters for all diameters having a "1" in them. If I type in 1. (a 1 plus the decimal point) yields the same result. If I type in 1.0, the form is blank.
Can anyone help me with why this would happen?
Thanks in advance.