By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

Syntax Error

lotus18
100+
P: 866
Can you spot the syntax error? When I try to use this it says "Syntax error (missing operator) in query expression"

Expand|Select|Wrap|Line Numbers
  1. Dim strSQL$
  2. strSQL = "SELECT * FROM LoadSchedule WHERE " & _
  3.                     "(DayA = '" & Day1 & _
  4.                      "' AND Rooms.Title = '" & Room & _
  5.                      "' AND Courses.Title = '" & Course & _
  6.                      "' AND Sections.Title = '" & Section & _
  7.                      "' AND Semester = '" & Semester & _
  8.                      "' AND ((TimeStarted <= #" & TimeStarted & "#" & _
  9.                      "  AND TimeFinished => #" & TimeStarted & "#)" & _
  10.                      "  OR (TimeStarted => #" & TimeStarted & "#" & _
  11.                      "  AND TimeSTARTED =< #" & TimeFinished & "#)))" & _
  12.                      " OR " & _
  13.                      "(DayB = '" & Day2 & _
  14.                      "' AND Rooms.Title = '" & Room & _
  15.                      "' AND Courses.Title = '" & Course & _
  16.                      "' AND Sections.Title = '" & Section & _
  17.                      "' AND Semester = '" & Semester & _
  18.                      "' AND ((TimeStarted <= #" & TimeStarted & "#" & _
  19.                      "  AND TimeFinished => #" & TimeStarted & "#)" & _
  20.                      "  OR (TimeStarted => #" & TimeStarted & "#" & _
  21.                      "  AND Timestarted =< #" & TimeFinished & "#)))"
  22.  
  23.         adRecordset.Open strSQL, dbConnection, 1, 1
Dec 8 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,434
Is it possible that it doesn't like the operator "=>"? I've always used ">=" but don't know whether it matters.

In any case, I'd recommend you print out the actual value of strSQL and paste it here for us to see.
Dec 10 '07 #2

Expert 100+
P: 487
Killer is correct the query string will not validate => (equal or greater), It should be >= (Greater or equal) and as well =<.
Dec 10 '07 #3

lotus18
100+
P: 866
Hi

I think you're right. Thanks. LOL

Rey Sean
Dec 10 '07 #4

Expert 5K+
P: 8,434
Let us know how it turns out.
Dec 10 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.