david nunn
09-23-2000, 04:13 AM
I have built a database to store sets of Memos under a kind of tree hierarchy (Categories, Subcategories and Topics). The idea is that they can be quickly retrieved on a form that has drop down lists for Categories, Subcategories, and Topics drilling down to just those memos that match the current selected topic. The memos are then displayed in an embedded sub form.
That bit is OK. But there is another level of info below the Memos. Some records require related contacts, hyperlinks etc, which are stored in separate tables, and viewed by opening sub sub forms with a button. I want to build a record counter that will show whether there is info in these tables for the selected Topic.
I am pretty new to all this, and I haven't a clue how to do it. Any helpful person care to give me a helping hand??
Jack Cowley
09-23-2000, 01:45 PM
A little difficult to give you a specific answer as it depends a bit on your table structure and how your form is set up, but maybe using the DCount Function would work in your case. Something along the lines of:
NumOfRec = DCount("Topics","TableName", "[Topic] = '" & Me![Topic] & "'")
HTH,
Jack
david nunn
09-24-2000, 10:51 AM
When I said I hadn't a clue I wasn't exaggerating. I've struggled through the Access manuals but I'm afraid with these kinds of functions the penny hasn't dropped at all. Could you tell me what info I need to put into the parts of this code?
NumOfRec = DCount("Topics","TableName", "[Topic] = '" & Me![Topic] & "'")
Starting at the beginning I assume "Topics" refers to the field holding the topic information; "TableName" is the obviously table in which the field is found. But what about the [Topic] and &"" sections? Here I am confused!
As for the way my form is set up, my categories and subcategories are stored in separate tables,
I have two tables that do the brunt of the work - a Topics table, which includes the unique topic name and category and subcategory it is filed under; and a Memo table, which includes Topic Name and as many Memos as I want to store under it. My find form uses queries to show the categories, subcategories and topics available. The current value in the topic list is used to drive the subform that displays the Memos. (It also drives the others subforms for contacts and hyperlinks that I want to display.
Really appreciate your help!
Jack Cowley
09-24-2000, 02:18 PM
You have the code right as far as you have taken it. The bit you are confused about is the WHERE clause. What the code says is give me a count of the Topics Fields in the Table named TableName WHERE the Topic is "your criteria". And "your criteria" is, in my example, a field on your form with the criteria in that field. A lot of time it is a unique ID number, but it can be anything. The code I sent expects a Text string in the criteria, not a number.
Here is a simple 'text' example of what the code is saying.... Give me a count of all my Topics in My Table where the Topic is Birds.
At this point I do not know what more I can tell you, but maybe someone else out there has a good idea....
HTH,
Jack