Filter values in database

2019-08-08 19:41发布

问题:

I am looking for someone to explain how to filter a ms-access database by column and display only cells which have higher values than given value from textbox?

Example: If given value in textbox is 3:

Column1
1
2
3
4
5

Filtering...

Column1
4
5 

回答1:

You can refer to a form in a query:

SELECT Column1
FROM ATable
WHERE Column1 > Forms!AForm!txtTextbox

You can also apply a filter to a form, for the current form, you might say:

Private Sub txtTextbox_AfterUpdate()
    Me.Filter = "Column1>" & Me.txtTextbox
    Me.FilterOn = True
End Sub