If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
No rows returned. Help!
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); |
#2
|
|||
|
|||
No rows returned. Help!
Just a wild guess, but I'm guessing that no records match whatever value is
being evaluated for prmBB? -- Ken Snell MS ACCESS MVP "Brian" wrote in message ... 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); |
Thread Tools | |
Display Modes | |
|
|