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

Checking if SourceObject has no records

Breezwell
P: 33
First off, let me say that this forum has provided me with numerous guidance to Access programming challenges I have faced while learning, and I am grateful to all those who share thier knowledge with others.

My current question involves SourceObjects. I have a form that has three SourceObjects, each of which displays the results of a query designed just for that particular SourceObject. Each SourceObject will reaveal information from a table that also supports just that particular SourceObject.

For example....

Table1 = SourceObject1
Table2 = SourceObject2
Table3 = Source Object3

After the queries run, each SourceObject is revealed on a form with the visible property set to True. Basically, I would like to only show SourceObjects that have actual data in them based on the current query. So, if only Table1 data is returned, I only want to show SourceObject1.

Is there a way to check if a SourceObject is empty and only include it on the form if it holds data?

Thanks for any replies and I can try to clarify further if need be.
Sep 19 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,627
After the queries run, each SourceObject is revealed on a form with the visible property set to True.
I'm a little confused on exactly what you mean by this, please clarify the above statement, and also explain exactly what you mean by 'SourceObject'.
Sep 19 '08 #2

Breezwell
P: 33
I'm a little confused on exactly what you mean by this, please clarify the above statement, and also explain exactly what you mean by 'SourceObject'.
Thanks for the reply ADezzi.
I am a little confused as well, so I guess it is showing in my descriptions.

Basically I have a single form with three subforms attached in a hidden state. Each subform has its SourceObject property set to a unique query.

For example, Me.AuditQueryNA.SourceObject = "query.AuditQuery"

All three queries run when a single button is clicked. I would like to somehow reveal, or include on the page ideally, only those subforms that have data in the SourceObjects query result set.

I am thinking this would require some conditional checking on the query result set or SourceObject property?

Hope this makes more sense.

Thanks
Sep 19 '08 #3

Breezwell
P: 33
Okay, with a little digging, and this site nonetheless, I found a solution posted by Trevor Best that I modified slightly.

Basically the solution involves putting the subform reference in a conditional that utilizes the DCount funtion to inspect the queries results:

I first assinged the query to the subforms SourceObject and then checked the queries resultset. Works perfectly.

Me.AuditQueryFTOSubform.SourceObject = "query.AuditQuery3"
If DCount("*", "AuditQuery3") = 0 Then
Me.AuditQueryFTOSubform.Visible = False
Else
Me.AuditQueryFTOSubform.Visible = True
End If

Hope this helps someone else down the road.
Sep 19 '08 #4

Post your reply

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