Re: Please help ~ Syntax Error
- From: "Gina Whipp" <NotInterested@xxxxxxxxxxxxx>
- Date: Thu, 16 Feb 2006 20:08:27 -0500
Still getting Syntax error :o(
"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9ABF592F-F07A-423D-BF71-59FAB99AC214@xxxxxxxxxxxxxxxx
hhhhhhhhhhhhmmmmmmmmmmmmmm?????????
Since you used the variable name strsql, my assumption was you were
building
an sql string to use as a query. Between isn an SQL word, but not an
Access
or VBA word. Sometimes it is hard to remember what language we are
working
in. If this is not for a query, then you will need to change it to use
something like
= to .... and <= ....
"Gina Whipp" wrote:
DId that, same error...
Even changed them all to Date/Time fields and put back the #'s, same
error.
The only time the error stops, see below, but then the report doesn't
filter.
Perhaps my problem is my approach? I have an unbound form that when
opened
the report opens showing all of it's records. The you make a selection
on
the form press the Filter button and it's suppose to requery the report
and
show the the new results. This silly form works on ALL my other reports
that don't use Between. It was when I wanted to say Between these 2
dates
that I can't seem to get it right.
So perhaps I should try another approach, maybe my unbound form wasn't
meant
to handle Between?
"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4250DA5C-B110-44DC-91AB-AF921E4B8BCA@xxxxxxxxxxxxxxxx
Take out the #. It is only for date/time fields. For text fields you
need
the "
"Gina Whipp" wrote:
Now not getting error but report is not filtering either. I changed
the
code to
If Me("Filter1") <> "" Then
strSql = strSql & """Between #" & Me("Filter1") & "# And #" &
Me("Filter2") & "#"""
End If
It seems like it wants to be enclosed in something (to get rid of the
Syntax
error issue) but what???
"Gina Whipp" <no@xxxxxxxxxxx> wrote in message
news:u73nDKzMGHA.1488@xxxxxxxxxxxxxxxxxxxxxxx
Nope that didn't work either, didn't think it would because date
field
is
actually formated as text. Now error reads:
Syntax error (missing operator) in query expression '(Between
#9/8/2004#
And #9/9/2005#)'.
"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DCCA6F27-F87C-4A6E-BFD4-65803F38B128@xxxxxxxxxxxxxxxx
Dates need to be enclosed in #, Without being able to test this, I
can't
guarantee it, but try this:
If Me("Filter1") <> "" Then
strSql = strSql & "Between #" & Me("Filter1") & "# And #"
&
_
Me("Filter2") & "# And "
End If
"Gina Whipp" wrote:
Hi All,
Thanks in advance...
Here's my line:
If Me("Filter1") <> "" Then
strSql = strSql & "Between " & Me("Filter1") & " And " &
Me("Filter2") & Chr(34) & " And "
End If
Here's my error:
Syntax error (missing operator) in query expression '(Between
9/8/2004
And
9/9/2005")'.
What am I missing?
Thanks,
Gina
.
- Follow-Ups:
- Re: Please help ~ Syntax Error
- From: Randy Harris
- Re: Please help ~ Syntax Error
- References:
- Please help ~ Syntax Error
- From: Gina Whipp
- Re: Please help ~ Syntax Error
- From: Gina Whipp
- Re: Please help ~ Syntax Error
- From: Gina Whipp
- Re: Please help ~ Syntax Error
- From: Klatuu
- Re: Please help ~ Syntax Error
- From: Gina Whipp
- Re: Please help ~ Syntax Error
- From: Klatuu
- Please help ~ Syntax Error
- Prev by Date: Re: Run VBScript file from within Access
- Next by Date: Re: Please help ~ Syntax Error
- Previous by thread: Re: Please help ~ Syntax Error
- Next by thread: Re: Please help ~ Syntax Error
- Index(es):