SQL first time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Have A stament that looks like below I keep geting a missing operater Error
with or without the Quotes around the number does anyone know what I am doing
wrong?

SELECT Hubnumber, dbo_gen_Hubs.City, dbo_gen_Hubs.State,zip

FROM dbo_gen_Hubs

Where ( Zip =>'02000' AND Zip <= '09999')

OR City = 'Boston' ;
Thanks
Octet
 
Access is picky about >= and <= . You need to use those exact strings as
your operator, and you used "=>". Try replacing the => with >= and see if
things work for yo=u.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Is this the SQL from the query itself, or are you setting the record source
using VBA code? If the former, try something like:

WHERE (((dbo_gen_Hubs.Zip) Between "02000" And "09999"))
OR (((dbo_gen_Hubs.City) = "Boston"))

I think Between is easier to use, but this should work if you prefer:
WHERE (((dbo_gen_Hubs.Zip)>="02000" And (dbo_gen_Hubs.Zip)<"09999"))

Why have you identified the table for two of the fields, but not for the
other two? Is there more than one table?

If Zip is a text field, I think Access treats it like a number for purposes
of finding a range such as you are doing, but I don't know if there could be
unexpected results in certain cases. I don't think so, but I have to say
I'm not exactly sure how that works with a text field.
 
Back
Top