Re: Please help ~ Syntax Error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Perhaps if you were to supply sufficient information someone would be able
to help. Information such as what strSql is before that assignment
statement, what it is after the assignment and what instruction is actually
getting the error.

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.


"Gina Whipp" <NotInterested@xxxxxxxxxxxxx> wrote in message
news:ejmQM31MGHA.3196@xxxxxxxxxxxxxxxxxxxxxxx
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














.


Quantcast