|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Empty Recordset Problem
Hi every one ! I am new to the VBA and wondering if some one can hlep me, I am trying to run a simple Select statement by using the CurrentDb.OpenRecordset function which works fine if there are more than zero records but if Select statement does not return any thing it displays an error message. Can any one tell how can I check if there are more than zero records before I use CurrentDb.OpenRecordset function. Follwoing is the Code I am using
Dim memberDetailsREc As DAO.Recordset If Len(memberDetailsREc!memberClubId) > 0 Then Set memberClubREc = CurrentDb.OpenRecordset("SELECT tblClubDetails.*, tblRefClubResources.* FROM `tblClubDetails`, `tblRefClubResources` WHERE CInt( tblClubDetails.clubProfileId) = tblRefClubResources.courseDetailId AND tblClubDetails.clubId = " & memberDetailsREc!memberClubId & ";") End If |
|
#2
|
|||
|
|||
|
I don't use DAO, but it's probably similar to how you test an ADO recordset for emptiness.
Code:
if rs.bof and rs.eof then 'rs is empty else 'there is something in the recordset end if
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Empty Recordset Problem
Doug G
My Problem is still there, I am thinking of way where I can Check The SQL select statement if it returns any records or not, before I call the OpenRecordset method on my SQL select statement. Whereas in your technique I have to open the record set |
|
#4
|
||||
|
||||
|
My suggestion would be to not use DAO, since it an outdated technology and no longer supported. I would recommend using ADO or ADO.NET.
|
|
#5
|
|||
|
|||
|
Quote:
How in the world could you tell if a recordset is empty before you create the recordset? That would take some kind of prescience. |
|
#6
|
|||
|
|||
|
try enclosing the error inside a error handler
Ex: On error go to err_handler ... Your stuff exit sub Err_handler: err.description (err is the error handler object) err.clear end sub |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Empty Recordset Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|