Petar Petrovic
Petar Petrovic

Reputation: 17

Filter values in database

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 

Upvotes: 1

Views: 139

Answers (1)

Fionnuala
Fionnuala

Reputation: 91316

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

Upvotes: 1

Related Questions