Re: using the .filter command
- From: "Chris Anderson [MVP-VB]" <tg-nospam@tannagh-dawt-com>
- Date: Wed, 16 Jan 2008 02:20:54 -0600
Bob Barrows [MVP] wrote:
Chris wrote:Well, I think it *should* be safe to assume that EntryDate is just that.... and needs to be enclosed as such. Even if it isn't a date and it's a string (tisk, tisk), it still needs delimiters on it.Hi everyone, i am have a problem, can anybody please help?
My problem is, I am using a DataGrid that is populated with data,
and I am trying to "filter" it with 2 different criteria's,
EmployeeNumber and date.
Below is the code that I have, but does not work as it comes up with
an error.
How can we help if you don't tell us what the error is?With Adodc1.Recordset
.Filter = ("EmployeeNumber = " & Val(Text2) And ("EntryDate < " &
DateValue(Text4)))
Was this a copy/paste from your code? or did you introduce a type when retyping it here?
It should be more like this (I suggest assigning the filter string to a variable to make it easier for you to look at the result of your concatenation - is this VB? If so, you can use debug to look at it):
flt_txt = "EmployeeNumber = " & Val(Text2) & _
"And EntryDate < " & DateValue(Text4)
.Filter = flt_txt
However, this may not be the exact string needed because we don't know the data types of the fields involved.
Please anybody able to shed any light on my problem?
The ADO documentation can be read online here: http://msdn2.microsoft.com/en-us/library/ms675532.aspx
Make sure you go read what it says about the Filter property:
flt_txt = "EmployeeNumber = " & Text2.Text & _
"AND EntryDate < #" & DateValue(Text4.Text) & "#"
If it's a string, or the source was SQL Server, then replace the # with '
-ca
.
- Follow-Ups:
- Re: using the .filter command
- From: Bob Barrows [MVP]
- Re: using the .filter command
- References:
- Re: using the .filter command
- From: Bob Barrows [MVP]
- Re: using the .filter command
- Prev by Date: Re: MS Access AutoNumber data type
- Next by Date: Re: using the .filter command
- Previous by thread: Re: using the .filter command
- Next by thread: Re: using the .filter command
- Index(es):
Relevant Pages
|
|