Setting the filter through VBA

Jak82

Registered User.
Local time
Today, 11:54
Joined
Jun 6, 2007
Messages
19
Hi There,

I am having a strange problem with regards to when I set my filter I want to grab the fields which are greater than the value set in a drop down box.

here is my code

If IsNull(Me.indEndDate.Value) = False Then
If count > 0 Then
filterString = filterString + " AND sessionDate < = #" + Me.indBeginDate.Value + "#"
count = count + 1
Else
filterString = filterString + " sessionDate < = #" + Me.indBeginDate.Value + "#"
count = count + 1
End If
End If

Me.indFirstName.Value = filterString


The string I get is sessionDate >= #Date#

Is this wrong, because it does not reutnr anything.


Many Thanks

Chris
 
filterString = filterString + " AND sessionDate < = #" + Me.indBeginDate.Value + "#"

Where are you setting filterString first and how is it declared and where?

Also, for the form, when you do get the filter worked out, you can use:

Me.Filter = filterString
Me.FilterOn = True
 
you might be better with & rather than +

do yuo actually get date as a word in your string?

and somehow you are getting (sic) ">=" greater than in your filterstrg, when you really mean (presumably) "<=" less than so perhaps your filterstrg statement has a typo
as no doubt you dont have any future dates.
 
Thanks

Thanks Guys,

It seemed the space in between the > and the = was causing the problems

Cheers :)
 

Users who are viewing this thread

Back
Top Bottom