Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 27th, 2007, 10:18 AM
Authorized User
Join Date: Apr 2007
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old April 27th, 2007, 10:36 AM
Registered User
Join Date: Oct 2006
Location: Leigh, Lancashire, United Kingdom.
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

Reply With Quote
  #3 (permalink)  
Old April 27th, 2007, 04:09 PM
Authorized User
Join Date: Apr 2007
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks, that did the trick.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 06:36 AM.

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