Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2005

Tip: Looking for answers? Try searching our database.

No Current Record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Reed - 05 May 2005 12:13 GMT
I'm trying to test for No Current Record in a DAO recordset. It happens
when my strSQL returns a blank recordset from the db. I was trying to use
IsNull(rs(0)) or IsNull(rs.Fields(0)) but they don't work. Any suggestions?
Alex Dybenko - 05 May 2005 15:06 GMT
try to check for EOF property:

if not rs.EOF then
...

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

> I'm trying to test for No Current Record in a DAO recordset. It happens
> when my strSQL returns a blank recordset from the db. I was trying to use
> IsNull(rs(0)) or IsNull(rs.Fields(0)) but they don't work. Any
> suggestions?
Rob - 05 May 2005 15:11 GMT
Bill

If I may suggest the following:

dim dbs as DAO.Database
dim rst as DAO.Database

Set dbs = CurrentDB()
Set rst = dbs.OpenRecordSet("Select FirstName From Table1")

' Here's the keypoint....
If not (rst.bof and rst.eof) Then
   ' There is data in the recordset
Else
   ' There is no data in the recordset
End If

Set rst = nothing
Set dbs = nothing

HTH
Rob

Signature

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

FMS Advanced Systems Group
http://www.fmsasg.com/

> I'm trying to test for No Current Record in a DAO recordset. It happens
> when my strSQL returns a blank recordset from the db. I was trying to use
> IsNull(rs(0)) or IsNull(rs.Fields(0)) but they don't work. Any
> suggestions?
Jim C. - 05 May 2005 19:31 GMT
Hi,

One other alternative is to check that rst.RecordCount > 0.

Jim

> I'm trying to test for No Current Record in a DAO recordset. It happens
> when my strSQL returns a blank recordset from the db. I was trying to use
> IsNull(rs(0)) or IsNull(rs.Fields(0)) but they don't work. Any suggestions?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.