Heita
12-15-2003, 08:13 AM
hello, this has to be said again, this is a great forum, although my search has not given me an answer to my problem so I have to post it.
I have a Inner Joing on an Access 2000 db through VB6. Using ADODB.MS JET.
It all works fine until I add a statement to the where clause:
This is OK
SQL = "SELECT Equipment.ComputerID, Equipment.Type, Equipment.Model, Reservation.ComputerID, Reservation.From_date, Reservation.To_date" _
& " FROM Equipment INNER JOIN Reservation ON (Equipment.ComputerID = Reservation.ComputerID)" _
& " WHERE ((Reservation.From_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "#) AND (Reservation.To_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "# ))OR Reservation.From_date Is Null
'But this:
SQL = "SELECT Equipment.ComputerID, Equipment.Type, Equipment.Model, Reservation.ComputerID, Reservation.From_date, Reservation.To_date" _
& " FROM Equipment INNER JOIN Reservation ON (Equipment.ComputerID = Reservation.ComputerID)" _
& " WHERE Equipment.Type=" & Eq & " AND ((Reservation.From_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "#) AND (Reservation.To_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "# ))OR Reservation.From_date Is Null "
->receives the error "No value given for one or more required parameters" I Assume it has to do with not finding the Equipment.Type but it is in the SELECT statement? So, anyone has an idea?
-----------
is the same for both Q
MsgBox SQL
Set Rs1 = conn.Execute(SQL)
' Rs1 refers to the Equipment table.
While Not Rs1.EOF
lslResults.AddItem Rs1.Fields("Equipment.ComputerID") & "--" & Rs1!Model
Rs1.MoveNext
Wend
Rs1.Close
----------------------------------
I have a Inner Joing on an Access 2000 db through VB6. Using ADODB.MS JET.
It all works fine until I add a statement to the where clause:
This is OK
SQL = "SELECT Equipment.ComputerID, Equipment.Type, Equipment.Model, Reservation.ComputerID, Reservation.From_date, Reservation.To_date" _
& " FROM Equipment INNER JOIN Reservation ON (Equipment.ComputerID = Reservation.ComputerID)" _
& " WHERE ((Reservation.From_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "#) AND (Reservation.To_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "# ))OR Reservation.From_date Is Null
'But this:
SQL = "SELECT Equipment.ComputerID, Equipment.Type, Equipment.Model, Reservation.ComputerID, Reservation.From_date, Reservation.To_date" _
& " FROM Equipment INNER JOIN Reservation ON (Equipment.ComputerID = Reservation.ComputerID)" _
& " WHERE Equipment.Type=" & Eq & " AND ((Reservation.From_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "#) AND (Reservation.To_date NOT BETWEEN #" & startdate & "# AND #" & enddate & "# ))OR Reservation.From_date Is Null "
->receives the error "No value given for one or more required parameters" I Assume it has to do with not finding the Equipment.Type but it is in the SELECT statement? So, anyone has an idea?
-----------
is the same for both Q
MsgBox SQL
Set Rs1 = conn.Execute(SQL)
' Rs1 refers to the Equipment table.
While Not Rs1.EOF
lslResults.AddItem Rs1.Fields("Equipment.ComputerID") & "--" & Rs1!Model
Rs1.MoveNext
Wend
Rs1.Close
----------------------------------