Main Topics
Browse All TopicsHi,
I have an Access 2007 form that displays a single record from a table that has a number of subordinate tables. I want to display the number of associated records from each of these tables on the form to alert the user to their presence. Although familiatr with Excel VBA I can't figure out how to get this working. I have searched this forum and it looks like there is a "recordset" object that has a "count" property but that's as far as I've got.
Many thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
There are several ways to get a record count of a table.
IF ... your tables are local and not linked (?) ... then the simplest and fastest way is:
CurrentDb.TableDefs("YourT
So, maybe:
Dim lCnt as Long
lCnt= CurrentDb.TableDefs("YourT
Me.SomeTextBoxNameForDispl
or just
Me.SomeTextBoxNameForDispl
Lets start with this and go from here ...
mx
IF ... you need to use a 'recordset' object ... then:
Dim rst as DAO.Recordset
Set rst = CurrentDb.OpenRecordset("S
With rst
If .Recordcount = 0 Then ' test for zero records FIRST
' no records
Else
.MoveLast ' Move to the end of the record set to get the correct count
MsgBox "There are " & .RecordCount & " records in the table"
End If
.Close
End With
Set rst = Nothing
mx
Interesting, however you could introduce a tab control and on each tab place a subform. The records would still be related via the Master/Child properties between the subforms and the main form, the tab control will allow you to "hide" all but the top tab so the form doesn't look so busy, and your data is still available to your user and integrity will be enforced by the form relationships. Just a thought.
J
Business Accounts
Answer for Membership
by: itkamarajPosted on 2009-09-23 at 08:15:15ID: 25404099
http://www.fontstuff.com/m ailbag/qac cess04.htm