Form!SubForm - No records

craigachan

Registered User.
Local time
Today, 07:35
Joined
Nov 9, 2007
Messages
285
I have a mainform and a subform. I want to run code when there are no records in the subform. How can I initiate this code? I've tried:

Code:
If Not IsNull(Me(Form!Subform.Form!ID)) Then
msgbox "Do Something"
Else
msgbox "Do Something Else"
end If

Somehow I cant get my code to acknowledge when there is no record in the subform?

Any ideas?
 
Code:
 dim rs as dao.recordset

Set rs = me.subformctlname.form.recordsetclone

If rs.recordcount = 0 then
 
Bob,

Thanks so much, it worked great. As an amature, I have shyed away from all of the 'dao.recordset' sytax because I don't quite understand it very much. Can you direct me to where I can learn more about it?

Thanks again. You always make it look so easy.
 
Hey Craig,

I'm also a noob to VBA, but after reading your post I was able to find this page with a helpful introduction to DAO.. However, I can't post links until 10 posts so I'll type it out below:

allenbrowne(dot)com/func-DAO(dot)html
 

Users who are viewing this thread

Back
Top Bottom