B
Bill - ESAI
Grrr...
I'm having a time building an SQL statement to run on the Me.Filter command
I'm sure it's the format approach I'm trying to use so here's what I have
I already have the SELECT part working, it's qualifying the select statement
that I'm struggling with.
I'm using two form combo boxes with nothing but the 4 digits (set as string)
for the year. e.g.. 2007
the format of the date in the database is Date/Time
strFilter = strFilter & "Status = 'complete'" & " OR " & strManager
& " and Status = 'closed'"
strFilter = strFilter & " AND " & Year([ActualCompDate]) & " >= " &
Forms!frmMainMenu!txtYearLow & ""
strFilter = strFilter & " AND " & Year([ActualCompDate]) & " <= " &
Forms!frmMainMenu!txtYearHigh & ""
When this string hits the filter command I need it to read
Status = 'complete' OR Status = 'closed' AND ActualCompDate >= 2007 AND
ActualCompDate <= 2008
that would be assuming that 2007 & 2008 were the selected values from the
form
Me.Filter = True
Me.Filter = strFilter
My database table name is Projects, so when I tried to use
[Projects].[ActualCompDate] I get an error at run time saying something
about using the | in my statement. Which I haven't used.
If I try to use Format([ActualCompDate], 'yyyy') it won't compile because it
doesn't like the single quotes and double quotes gets me the same error as
above.
If I try to just use [ActualCompDate] I get an error at runtime saying that
[ActualCompDate] doesn't exist.
I can't seem to figure out how to format this query so I can compare a 4
digit year to the completed project date that is stored as a date/time data
type.
Bill
I'm having a time building an SQL statement to run on the Me.Filter command
I'm sure it's the format approach I'm trying to use so here's what I have
I already have the SELECT part working, it's qualifying the select statement
that I'm struggling with.
I'm using two form combo boxes with nothing but the 4 digits (set as string)
for the year. e.g.. 2007
the format of the date in the database is Date/Time
strFilter = strFilter & "Status = 'complete'" & " OR " & strManager
& " and Status = 'closed'"
strFilter = strFilter & " AND " & Year([ActualCompDate]) & " >= " &
Forms!frmMainMenu!txtYearLow & ""
strFilter = strFilter & " AND " & Year([ActualCompDate]) & " <= " &
Forms!frmMainMenu!txtYearHigh & ""
When this string hits the filter command I need it to read
Status = 'complete' OR Status = 'closed' AND ActualCompDate >= 2007 AND
ActualCompDate <= 2008
that would be assuming that 2007 & 2008 were the selected values from the
form
Me.Filter = True
Me.Filter = strFilter
My database table name is Projects, so when I tried to use
[Projects].[ActualCompDate] I get an error at run time saying something
about using the | in my statement. Which I haven't used.
If I try to use Format([ActualCompDate], 'yyyy') it won't compile because it
doesn't like the single quotes and double quotes gets me the same error as
above.
If I try to just use [ActualCompDate] I get an error at runtime saying that
[ActualCompDate] doesn't exist.
I can't seem to figure out how to format this query so I can compare a 4
digit year to the completed project date that is stored as a date/time data
type.
Bill