Query error

  • Thread starter Thread starter Angelina
  • Start date Start date
A

Angelina

Hi,

i am using the OLEDataAdapter query builder wizard to
creat my select statment. I have entered the following
query:

SELECT
c.Caravan_Inv_No,
d.Caravan_Model,
d.Length,
d.Beds,
d.[Cost/day]
FROM
Booking_Details a INNER JOIN Caravan_booking b ON
a.BookingNo = b.BookingNo INNER JOIN Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER JOIN
Caravan_details d ON
c.Length = d.Length AND c.Caravan_Model =
d.Caravan_Model
WHERE
(a.Dt_of_arrival NOT BETWEEN ? AND ?)
AND
(b.Dt_of_depature NOT BETWEEN ? AND ?)


but i keep getting an error message stating:

Syntax error (missing operator) in query
expression 'a.BookingNo = b.BookingNo INNER JOIN
Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER JOIN
Caravan_details d ON
c.Length = d.Length'.


can anyone plz help me solve this.

thx in adavance
 
Angelina,

One possibility could be a missing 'AS' statement on a few
of the lines. Shouldn't this line...

INNER JOIN
Caravan_Inv c ON

be...

INNER JOIN
Caravan_Inv AS c ON

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Hi Gary

I tried using 'AS' like u sugeested but i still get the
same error message :o(
Do u have any other suggestions in how to resolve this
error?

thanks in advance
 
Did you add the AS to a, b, c and d? Are the '?'s in the
WHERE really part of the query? Don't believe they should
be.

I am not familiar with the OLEDataAdapter query builder
wizard. Does this allow you to preview the results as you
build it. How and where are you trying to run the query?

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
Angelina said:
Hi Gary

I tried using 'AS' like u sugeested but i still get the
same error message :o(
Do u have any other suggestions in how to resolve this
error?

thanks in advance

-----Original Message-----
Hi,

i am using the OLEDataAdapter query builder wizard to
creat my select statment. I have entered the following
query:

SELECT
c.Caravan_Inv_No,
d.Caravan_Model,
d.Length,
d.Beds,
d.[Cost/day]
FROM
Booking_Details a INNER JOIN Caravan_booking b ON
a.BookingNo = b.BookingNo INNER JOIN Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER JOIN
Caravan_details d ON
c.Length = d.Length AND c.Caravan_Model =
d.Caravan_Model
WHERE
(a.Dt_of_arrival NOT BETWEEN ? AND ?)
AND
(b.Dt_of_depature NOT BETWEEN ? AND ?)


but i keep getting an error message stating:

Syntax error (missing operator) in query
expression 'a.BookingNo = b.BookingNo INNER JOIN
Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER JOIN
Caravan_details d ON
c.Length = d.Length'.


can anyone plz help me solve this.

thx in adavance
.
 
Hi Gary,

Yes i did add the 'AS' to a, b, c and d. Still no joy :o(
The ? is supposed to represent a value that needs to be
put into the query that is obtained from the UI from a
dateTimePicker. Im not sure if this is correct. I dont
know how else to pass these values to the query. Can i
just write the name of the variable these values are
stored in into the query?
Unfortunatly i cannot view the results as i write the
query......or at least i dont know how to!!

I am trying to run this query every time the user changes
the value of the datetimepicker so that i can obtain all
the caravans that are available for booking for the date
period specified by the user.

-----Original Message-----
Did you add the AS to a, b, c and d? Are the '?'s in the
WHERE really part of the query? Don't believe they should
be.

I am not familiar with the OLEDataAdapter query builder
wizard. Does this allow you to preview the results as you
build it. How and where are you trying to run the query?

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
Angelina said:
Hi Gary

I tried using 'AS' like u sugeested but i still get the
same error message :o(
Do u have any other suggestions in how to resolve this
error?

thanks in advance

-----Original Message-----
Hi,

i am using the OLEDataAdapter query builder wizard to
creat my select statment. I have entered the following
query:

SELECT
c.Caravan_Inv_No,
d.Caravan_Model,
d.Length,
d.Beds,
d.[Cost/day]
FROM
Booking_Details a INNER JOIN Caravan_booking b ON
a.BookingNo = b.BookingNo INNER JOIN Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER JOIN
Caravan_details d ON
c.Length = d.Length AND c.Caravan_Model =
d.Caravan_Model
WHERE
(a.Dt_of_arrival NOT BETWEEN ? AND ?)
AND
(b.Dt_of_depature NOT BETWEEN ? AND ?)


but i keep getting an error message stating:

Syntax error (missing operator) in query
expression 'a.BookingNo = b.BookingNo INNER JOIN
Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER JOIN
Caravan_details d ON
c.Length = d.Length'.


can anyone plz help me solve this.

thx in adavance
.


.
 
Hmm. I just learned something. Did some tests and the AS is
not required as I thought it was so that is not the problem.
My next suggestion would be to put in the variable
references to the datepicker and see what you get. I suppose
the error line could be truncating. Something like this with
your names.

WHERE
(a.Dt_of_arrival NOT BETWEEN
Forms!frmYourForm!YourDatePickerControlName1.Value
ANDForms!frmYourForm!YourDatePickerControlName2.Value )

The other thought that comes to mind is you could have a
line break problem of some type if you have this in a code
window.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
Angelina said:
Hi Gary,

Yes i did add the 'AS' to a, b, c and d. Still no joy :o(
The ? is supposed to represent a value that needs to be
put into the query that is obtained from the UI from a
dateTimePicker. Im not sure if this is correct. I dont
know how else to pass these values to the query. Can i
just write the name of the variable these values are
stored in into the query?
Unfortunatly i cannot view the results as i write the
query......or at least i dont know how to!!

I am trying to run this query every time the user changes
the value of the datetimepicker so that i can obtain all
the caravans that are available for booking for the date
period specified by the user.

-----Original Message-----
Did you add the AS to a, b, c and d? Are the '?'s in the
WHERE really part of the query? Don't believe they should
be.

I am not familiar with the OLEDataAdapter query builder
wizard. Does this allow you to preview the results as you
build it. How and where are you trying to run the query?

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
Angelina said:
Hi Gary

I tried using 'AS' like u sugeested but i still get the
same error message :o(
Do u have any other suggestions in how to resolve this
error?

thanks in advance


-----Original Message-----
Hi,

i am using the OLEDataAdapter query builder wizard to
creat my select statment. I have entered the following
query:

SELECT
c.Caravan_Inv_No,
d.Caravan_Model,
d.Length,
d.Beds,
d.[Cost/day]
FROM
Booking_Details a INNER JOIN Caravan_booking b ON
a.BookingNo = b.BookingNo INNER JOIN Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER
JOIN
Caravan_details d ON
c.Length = d.Length AND c.Caravan_Model =
d.Caravan_Model
WHERE
(a.Dt_of_arrival NOT BETWEEN ? AND ?)
AND
(b.Dt_of_depature NOT BETWEEN ? AND ?)


but i keep getting an error message stating:

Syntax error (missing operator) in query
expression 'a.BookingNo = b.BookingNo INNER JOIN
Caravan_Inv c ON
b.Caravan_Inv_No = c.Caravan_Inv_No INNER JOIN
Caravan_details d ON
c.Length = d.Length'.


can anyone plz help me solve this.

thx in adavance
.


.
 
Back
Top