|
-
Dec 2nd, 2002, 10:40 PM
#1
Thread Starter
Fanatic Member
Access form record count
How do I get the query count to display on an Access form?
I have a form in MS Access and want to simulate the navigation controls. So it says "This is record X of Y". X = Me.CurrentRecord. But what is Y? I tried Me.Count but it doesnt give the right number. The form sources a query, and I want to display the number of records in the query. Sorry, not real handy at Access forms. Any help would be appreciated. Thanks.
-
Dec 2nd, 2002, 11:31 PM
#2
Member
Hi !
Testing I found that TextBoxes in a Form with the values :
1.- "=CurrentRecord" gives me the same that you say AND
2.- "=Count(*)" gives me the total number of records in the source Query.
Hope it works for you.
-
Dec 3rd, 2002, 04:15 AM
#3
-
Dec 16th, 2010, 05:07 PM
#4
New Member
Re: Access form record count
This was really annoying or me to figure out from a subform (it doesn't work if your main form has more than one subform). The workaround for a subform referencing a parent's recordcount is the following line of code:
Code:
Set sqlrs = CurrentDb.OpenRecordset("Select Count(*) AS My_Count FROM [" & frm.Parent.RecordSource & "]", dbOpenSnapshot, dbReadOnly)
varRecordCount = Nz(sqlrs![My_Count], 0)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|