No rows returned. Help!

B

Brian

I'm having a problem with the following code. I'm trying
to create a recordset using a query. I run the query
earlier in the code and it returns multiple records but
when I run it with the following code it doesn't return
any records. The rs.MoveFirst fails with no current
record. Am I not resolving the parameters correctly or is
there some other problem? Thanks.


Set MyDb = CurrentDb
Set qdf = MyDb.QueryDefs("QueryBlockAv")
For Each prmBB In qdf.Parameters
prmBB.Value = Eval(prmBB.Name)
Next prmBB
Set rs = qdf.OpenRecordset(dbOpenDynaset)
rs.MoveFirst
' process each record in the recordset,
Do Until rs.EOF
rs.Edit
rs![Booking ID] = lngNext
rs.Update
rs.MoveNext
Loop
rs.Close
Set rs = Nothing

Where QueryBlockAv is:

SELECT AVAILABILITY.BookingDate, AVAILABILITY.Period,
AVAILABILITY.Room, AVAILABILITY.[Day Number],
AVAILABILITY.[Booking ID]
FROM AVAILABILITY
WHERE ((AVAILABILITY.BookingDate)>=Forms![BLOCK BOOKING
AVAILABILITY]![Start Date]) And
((AVAILABILITY.BookingDate)<=Forms![BLOCK BOOKING
AVAILABILITY]![End Date]) And ((AVAILABILITY.[Day Number])
=Forms![BLOCK BOOKING AVAILABILITY]!Combo4) And
((AVAILABILITY.Period)=Forms![BLOCK BOOKING AVAILABILITY]!
Combo8) And ((AVAILABILITY.Room)=Forms![BLOCK BOOKING
AVAILABILITY]!Combo10) And ((AVAILABILITY.[Booking ID])
<>1);
 
K

Ken Snell

Just a wild guess, but I'm guessing that no records match whatever value is
being evaluated for prmBB?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top