Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rs.MoveLast Error

Status
Not open for further replies.

mdmarney

IS-IT--Management
Jan 16, 2003
68
US
The following code gives a "No Current Record" error on the MoveLast function. We have tried messing around with the SQL string. It functions well in separate parts, but not as one string. Any thoughts?

strSQL = "Select * from tbl_Attendants Where Parish_Group_ID = " & Forms!frm_Check_In_Attendants_by_Group!frm_Check_In_Attendants_by_Group_Subform.Form![Parish_Group_ID] & " AND Arrival_Verification = TRUE"

Set rs2 = CurrentDb.OpenRecordset(strSQL)

rs2.MoveLast

*************
M. MARNEY
 
My gut feeling is that there is no records being returned therefor you can not do a move last because the record does not exist. To reslove this and many other prblems ALWAYS use the following to test your results before moving on.

if rs2.EOF and rs2.BOF then
'What to do when no records returned
ELSE
"What to do when records are returned
End if

What the first line is doing is testing to criteria of the return recordset. It is testing to see if it is on the Last record (EOF) if it is it returns a TRUE. It also checks to see if it is on the first record (BOF) if this also returns a TRUE then the resultant record set is empty. You can not bo on the first and last record of a recordset at the same time unless it is empty.

Good Luck
ssecca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top