Filter datasheet in split form selecting items in combobox

I'm afraid I agree with Static - I've used single quote with * for years, it definitely works.
 
OK I agree that using single quotes does work if I switch off SQL Server compatible syntax.

I've used that as the default for so long that I didn't consider the alternative.
As most of my databases work with SQL Server BEs that seems logical to me

Apologies for doubting you. :eek:

Having said that my code works whichever syntax is used for the database, so I'll continue to use SQL Server compatible syntax :)

I would be interested to know which the majority of experienced developers use
 
But then wouldn't the code be...
Code:
Private Sub ComboWSIB_After_Update()
   Select Case Me.ComboWSIB
      Case "Yes", "No"
         Me.Filter = "[WSIB Employer Declaration Complete?] = '" & Me.ComboWSIB & "'"
         Me.FilterOn = True
      Case Else
         Me.FilterOn = False
   End Select
End Sub
Mark

This worked beautifully. Thank you everyone!
 
What about your 'weird' records like that you described in post #3?
Did you just change it to Yes?
 
Hmmmmm...well, I have implemented the code (thanks to MarkK). The datasheet does filter based on yes,no or all. However when I clicked "Yes" the record with (Jan 18/17) is absent. I will continue to play around with it. But this is closer than what I had before. Thank you.
 
See my solution in post 10 which will work for ALL cases
 
See my solution in post 10 which will work for ALL cases

I appreciate all the work you put into this. However, when I went to try your code, I was prompted with the Complete dialog box. I typed "Yes" and got some results back. When I clicked on "No" or "All", in the dropdown, nothing came at all. Again I know this is a complicated task. Believe me I wish whoever constructed database didn't include such odd records. Worst case scenario, I will include a text box or some kind of instructions for right clicking and using the datasheet's own text filtering capabilities. But as usual I will fiddle around with it and thank you all for your guidance and insight!
 
Last edited:
Wait a sec, I think I know what I did wrong
 
It works, I made the silly mistake of not changing [Complete] to [WSIB Employer Declaration Complete?]. It works perfectly now. Thank you Ridders and everyone else!
 
Its a pleasure ... but the best bit of this thread was where we all got sidetracked

Mind you - if I were you I'd now change it to a boolean field in which case Mark's code is the neatest
 

Users who are viewing this thread

Back
Top Bottom