user3187508
user3187508

Reputation: 25

How to filter results in access based on checkbox value

I'm doing an access database and I want to apply a filter in order to display some records on a report. This database is for a shop. Each bill has this information (in a table): unique bill number, client name, if the bill has been payed (or not) and other information not necessary for what I want to ask. The field on the record that indicates if the bill payment has been recieved (or not) is a checkbox. I want to display in a report (or in a form) only the pending payments, showing in a list the client name and the bill number. I have this code, but it works on the contrary I want (it shows the payed bills and hides the unpayed ones):

Dim sFil As String
sFil = "Payment_recieved"
Me.Filter = sFil
Me.FilterOn = False 

I know that checkboxes have 'True' or 'False'. In this case, I only want to display the records which "Payment_recieved" value is "False". Is this possible?

Upvotes: 0

Views: 6385

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123839

I have this code, but it works on the contrary I want (it shows the payed bills and hides the unpayed ones)

In that case you can use the Not operator to simply invert the effect of the filter string:

sFil = "Not [Payment_recieved]"

Upvotes: 2

Related Questions