Filter only returning 1 record

Q

QB

I am trying to apply a filter to my form, code that I have used in the past
is not working. No matter the variations I have tried it always returns only
one record?!

Me.FilterOn = False 'Remove any existing filters
Me.Filter = "type_contact Like " & Chr(34) & "*" & Trim(Me.cbo_fltrby_type)
& "*" & Chr(34) & "" 'Build our filter
Me.FilterOn = True 'Apply our filter

I have also tried,
Me.Filter = "type_contact = '" Trim(Me.cbo_fltrby_type) & "'"
Me.Filter = "type_contact Like '*" Trim(Me.cbo_fltrby_type) & "*'"

Me.cbo_fltrby_type returns a string value and should be exactly = to the
field value type_contact.

Thank you for helping me out!

QB
 
Q

QB

Solved!

It had nothing to do with the Filter, but rather with a custom navigation
buttons. The Me.RecordsetClone.RecordCount was not getting the proper count.
Had to add a move to the last record first before getting the count.
Hopefully MS solved this is the next release of Access.

QB
 
V

vanderghast

It won't, quite probably, since it is a matter of being able to present SOME
data asap (while having an incorrect count while the recordset is filling
up) in an asynchronous way, so the end user 'can' do something before the
end of the recordset filling operation. If you need to have the end of that
asynchronous operation, you do as you did, you move to the last record, but
then, HAVE TO wait the end of the operation. In summary, as it is now: you
have the OPTION to do the way you want; while unconditionally waiting the
end of operation may be just a lost of time for some other operations. So,
as you see, it won't probably be modified at all. Sure, that means that the
developer should be aware of the 'incorrect' count when reading it before a
move last, but that is what being an expert is about. (And it is probably
documented).


Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top