A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

No rows returned. Help!



 
 
Thread Tools Display Modes
  #1  
Old May 13th, 2004, 07:55 PM
Brian
external usenet poster
 
Posts: n/a
Default 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  
Old May 14th, 2004, 03:34 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.