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

Determine last record in a query and selection filter

P: n/a
TTD
Hi,

I have a query which is based on a tabel and when I filter on a particular
field, Access shows at the bottom

'Field 1 from 20 (filtered)'

How can I get this value of the last filtered recordnr., in this example
'20'?

Thanks in advance
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
TTD, I assume you have a main form and a subform and you want to get the
count of the records in the subform and show that in a textbox on your main
form. If so, place a textbox on your main form and say you name it
txtRecCount. Select your subform then click in the little square box in the
upper left hand side of the subform (a black smaller box should
appear)(alternately you could simply open the subform in design view by
itself). Click View/Properties from the main menu. Select the Event tab in
the properties sheet. Click the ellipsis(...) to the right of the OnCurrent
event to launch the code window. Type in something like this replacing the
control names with the names of your controls.

Private Sub Form_Current()
Me.RecordsetClone.MoveLast
Forms!MyMainForm.txtRecCount = Me.RecordsetClone.RecordCount
End Sub
--
Reggie

www.smittysinet.com
----------
"TTD" <tt*@hotmail.com> wrote in message news:c8**********@beast.euro.net...
Hi,

I have a query which is based on a tabel and when I filter on a particular
field, Access shows at the bottom

'Field 1 from 20 (filtered)'

How can I get this value of the last filtered recordnr., in this example
'20'?

Thanks in advance

Nov 12 '05 #2

P: n/a
TTD
Thanks Reggie,

though it wasn't quit I was looking for. I got the answer from someone else

MyVar = Me.Recordset.RecordCount

Anyway, your explanation is useful to me and is appreciated.


"Reggie" <no**********@smittysinet.com> schreef in bericht
news:1K********************@comcast.com...
TTD, I assume you have a main form and a subform and you want to get the
count of the records in the subform and show that in a textbox on your main form. If so, place a textbox on your main form and say you name it
txtRecCount. Select your subform then click in the little square box in the upper left hand side of the subform (a black smaller box should
appear)(alternately you could simply open the subform in design view by
itself). Click View/Properties from the main menu. Select the Event tab in the properties sheet. Click the ellipsis(...) to the right of the OnCurrent event to launch the code window. Type in something like this replacing the control names with the names of your controls.

Private Sub Form_Current()
Me.RecordsetClone.MoveLast
Forms!MyMainForm.txtRecCount = Me.RecordsetClone.RecordCount
End Sub
--
Reggie

www.smittysinet.com
----------
"TTD" <tt*@hotmail.com> wrote in message

news:c8**********@beast.euro.net...
Hi,

I have a query which is based on a tabel and when I filter on a particular field, Access shows at the bottom

'Field 1 from 20 (filtered)'

How can I get this value of the last filtered recordnr., in this example
'20'?

Thanks in advance


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.