468,301 Members | 1,462 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

Stop a macro when an Append query will append zero records

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
1 1719
Tanis
143 100+
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.

Similar topics

reply views Thread by MHenry | last post: by
5 posts views Thread by Michael C via AccessMonster.com | last post: by
5 posts views Thread by solar | last post: by
6 posts views Thread by Takeadoe | last post: by
4 posts views Thread by pmacdiddie | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.