By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

Stop a macro when an Append query will append zero records

P: 1
I have written a macro that I want to repeat until there are no more records to append (i.e., append zero rows). Is there a way for a condition to be applied to the macro that can detect if no records will be appended to the target table?

I do not know VB and need to do this with macros, queries, tables, and other objects (though I a reasonably familiar with properties and very familiar with expressions)

Thanks!
Oct 9 '06 #1
Share this Question
Share on Google+
1 Reply


100+
P: 143
try this.

Dim Msg As String
DoCmd.OpenQuery "qryYourQuery", acNormal, acEdit

If IsNull(DLookup("SomeField", "qryYourQuery")) Then
Msg = "No data. "
MsgBox Msg
DoCmd.Close
Exit Sub

End If
Oct 10 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.