Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 27th, 2007, 10:18 AM
Authorized User
Join Date: Apr 2007
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default Recordset Empty Check

Is there a way to check if a recordset has no data?
I get a "no current record" error because ther is none.
I simply want to use an if statement to check for data first.
Any Ideas would be appreciated?

'Empty the TempTable of all Old Work
    Set rstTempWip = dbs.OpenRecordset("TempWipBatch", dbOpenTable)
    If rstTempWip. 'I am trying to check if the recordset is empty here "" Then
    End If

Old April 27th, 2007, 10:36 AM
Registered User
Join Date: Oct 2006
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Coby

This is what I use to check. if no records, then it exits the function. Obviously if you want it to do other things, just put the else statement in there

If rstTempWIP.RecordCount <= 0 Then Exit Function

Hope this helps

Old April 27th, 2007, 04:09 PM
Authorized User
Join Date: Apr 2007
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks, that did the trick.


Similar Threads
Thread Thread Starter Forum Replies Last Post
best way to check for variable being empty crmpicco Classic ASP Basics 3 March 28th, 2006 12:11 PM
Empty recordset = redirect frankriedel PHP How-To 2 November 12th, 2005 04:49 AM
How to check if you have an empty array Ciarano VB How-To 9 March 31st, 2004 09:17 AM
check if empty hosefo81 Javascript How-To 12 March 9th, 2004 08:43 AM
How to check if collection is empty Ciarano Beginning VB 6 2 March 5th, 2004 08:11 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.