Don't run append query with no data

jon98548

Registered User.
Local time
, 20:34
Joined
Feb 14, 2003
Messages
141
I have a form that when it opens runs an append query. I would like it to skip this step if the query is empty, which it will be most of the time. What do I key on? Search hints? Taunts?
 
Open the query as a recordset, then check the record count. Skip the append query if record count is 0. Just be careful in DAO as the recordcount isn't truly a "record count" unless you load all records in the recordset. You can probably do a search on "record count" to find out more.

You can use the following code in either DAO or ADO to test for a non-empty recordset:

If Not rst.BOF And Not rst.EOF Then
  'your recordset is not empty
End If
 
Last edited:
Thanks, pal. I'll give at a whirl.
 

Users who are viewing this thread

Back
Top Bottom