Check Box Help PLEASE

johnbird1988

Board Regular
Joined
Oct 6, 2009
Messages
199
Hello

I would like some help with a “check box” within a form. I have a form with some unbound combo boxes and text boxes. I use this to filter down my form. Eg one combo box is for a employee to filter all records per employee selected in the combo box.
However I would like to give the user the option to filter out all the close records. This can be determined by a status filed and equals “closed”. I want to use a check box and have it defaulted on true and for the user to deselect it if they wish to see all records.
I have tryed to add this in the Query builder within the for properties but not use of my criteria is correct. I am using “IIf([forms]![Vacancy_frm].[checkbox1]=True,"Closed","*")”.
Any ideas would help please.
Thank you, John
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
One solutions would be to revise the form's record source based on the chkbox.
1) create a query filtering out 'closed' records
2) add code the checkbox's after_update event
Code:
Private Sub chkIgnoreClosed_AfterUpdate()
'checkbox sets form's record source
'to one of two possible queries

If Me.chkIgnoreClosed = -1 Then 'use filter query

    Debug.Print Time(); " check is on"
    
    Me.RecordSource = "qrySKV_B"

Else    'use unfilter / all query

    Debug.Print Time(); " check is off"
    
    Me.RecordSource = "qrySKVall"

End If

End Sub
 
Upvote 0
Youre expression involving "*" won't work, because "*" should be used with the LIKE operator: xxx LIKE "*" means all, but xxx = "*" means matches a literal asterisk.

I think you should have a filter with the <> operator (not equal) that uses a ridiculous string you wouldn't normally find in the Status field (the one that says "Closed" for closed records):

Status <> IIf([forms]![Vacancy_frm].[checkbox1], "Closed", "Kookamonga")”.
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,700
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top