Results 1 to 4 of 4

Thread: Access SQL Issue...

  1. #1
    Sublime HEXUS.net
    Join Date
    Jul 2003
    Location
    The Void.. Floating
    Posts
    11,819
    Thanks
    213
    Thanked
    233 times in 160 posts
    • Stoo's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2*Xeon 5450 @ 2.8GHz, 12MB Cache
      • Memory:
      • 32GB 1600MHz FBDIMM
      • Storage:
      • ~ 2.5TB + 4TB external array
      • Graphics card(s):
      • ATI Radeon HD 4870
      • Case:
      • Mac Pro
      • Operating System:
      • OS X 10.7
      • Monitor(s):
      • 24" Samsung 244T Black
      • Internet:
      • Zen Max Pro

    Question Access SQL Issue...

    Code:
    	Select Case strOfferMonth
    		case "1"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 1 AND DatePart('m',OfferEnds) => 1 ORDER BY SiteCode ASC;"
    		case "2"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 2 AND DatePart('m',OfferEnds) => 2 ORDER BY SiteCode ASC;"
    		case "3"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 3 AND DatePart('m',OfferEnds) => 3 ORDER BY SiteCode ASC;"
    		case "4"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 4 AND DatePart('m',OfferEnds) => 4 ORDER BY SiteCode ASC;"
    		case "5"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 5 AND DatePart('m',OfferEnds) => 5 ORDER BY SiteCode ASC;"
    		case "6"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 6 AND DatePart('m',OfferEnds) => 6 ORDER BY SiteCode ASC;"
    		case "7"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 7 AND DatePart('m',OfferEnds) => 7 ORDER BY SiteCode ASC;"
    		case "8"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 8 AND DatePart('m',OfferEnds) => 8 ORDER BY SiteCode ASC;"
    		case "9"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 9 AND DatePart('m',OfferEnds) => 9 ORDER BY SiteCode ASC;"
    		case "10"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 10 AND DatePart('m',OfferEnds) => 10 ORDER BY SiteCode ASC;"
    		case "11"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 11 AND DatePart('m',OfferEnds) => 11 ORDER BY SiteCode ASC;"
    		case "12"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 12 AND DatePart('m',OfferEnds) => 12 ORDER BY SiteCode ASC;"
    		case Else
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= DatePart('m',Now) AND DatePart('m',OfferEnds) => DatePart('m',Now) ORDER BY SiteCode ASC;"
    	End Select
    Produces the error:

    Microsoft JET Database Engine error '80040e14'

    Syntax error (missing operator) in query expression 'DatePart('m',OfferBegins) <= 1 AND WHERE DatePart('m',OfferEnds) => 1'.
    Where as

    Code:
    	Select Case strOfferMonth
    		case "1"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 1 ORDER BY SiteCode ASC;"
    		case "2"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 2 ORDER BY SiteCode ASC;"
    		case "3"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 3 ORDER BY SiteCode ASC;"
    		case "4"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 4 ORDER BY SiteCode ASC;"
    		case "5"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 5 ORDER BY SiteCode ASC;"
    		case "6"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 6 ORDER BY SiteCode ASC;"
    		case "7"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 7 ORDER BY SiteCode ASC;"
    		case "8"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 8 ORDER BY SiteCode ASC;"
    		case "9"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 9 ORDER BY SiteCode ASC;"
    		case "10"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 10 ORDER BY SiteCode ASC;"
    		case "11"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 11 ORDER BY SiteCode ASC;"
    		case "12"
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= 12 ORDER BY SiteCode ASC;"
    		case Else
    			strSQL = "SELECT * from Offers WHERE DatePart('m',OfferBegins) <= DatePart('m',Now) ORDER BY SiteCode ASC;"
    	End Select
    Is absolutely fine!



    Any ideas peeps?
    (\__/)
    (='.'=)
    (")_(")

  2. #2
    Pixel Abuser Spunkey's Avatar
    Join Date
    Nov 2003
    Location
    Milton Keynes
    Posts
    1,523
    Thanks
    0
    Thanked
    0 times in 0 posts
    you're gonna kick yourself

    its >= not =>

  3. #3
    Sublime HEXUS.net
    Join Date
    Jul 2003
    Location
    The Void.. Floating
    Posts
    11,819
    Thanks
    213
    Thanked
    233 times in 160 posts
    • Stoo's system
      • Motherboard:
      • Mac Pro
      • CPU:
      • 2*Xeon 5450 @ 2.8GHz, 12MB Cache
      • Memory:
      • 32GB 1600MHz FBDIMM
      • Storage:
      • ~ 2.5TB + 4TB external array
      • Graphics card(s):
      • ATI Radeon HD 4870
      • Case:
      • Mac Pro
      • Operating System:
      • OS X 10.7
      • Monitor(s):
      • 24" Samsung 244T Black
      • Internet:
      • Zen Max Pro
    oh that's just stupid lol
    (\__/)
    (='.'=)
    (")_(")

  4. #4
    Pixel Abuser Spunkey's Avatar
    Join Date
    Nov 2003
    Location
    Milton Keynes
    Posts
    1,523
    Thanks
    0
    Thanked
    0 times in 0 posts
    lol i said you'd kick yourself

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Microsoft Support....
    By Devilbod in forum General Discussion
    Replies: 14
    Last Post: 09-04-2007, 02:42 AM
  2. Replies: 7
    Last Post: 05-02-2005, 03:53 PM
  3. Help! Is this a security issue?
    By Rob in forum Software
    Replies: 1
    Last Post: 04-06-2004, 06:09 PM
  4. Access Reports - help....
    By Lead_Head in forum Software
    Replies: 5
    Last Post: 22-10-2003, 12:19 PM
  5. NT4 Domain - A: drive access
    By joshwa in forum Software
    Replies: 1
    Last Post: 27-08-2003, 09:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •