show number of filtered files

  • Thread starter Thread starter Johnathan
  • Start date Start date
J

Johnathan

I removed the navigation buttons from my form so I could
use some custom buttons. I like the feature that came with
the default buttons, such as "1 of 4 filtered" as it
shows. Is there a way to display this with custom buttons?

TIA
Johnathan
 
Make a new module and paste this into it:

Function GetXofY(F As Form)
Dim rs As Recordset
On Error Resume Next
Set rs = F.RecordsetClone
rs.MoveLast
rs.Bookmark = F.Bookmark
If (Err <> 0) Then
GetXofY = rs.RecordCount + 1 & " of " & rs.RecordCount + 1
Else
GetXofY = rs.AbsolutePosition + 1 & " of " &
rs.RecordCount
End If
End Function

then on your form, create a new text field that has this
in the control source =getxofy([Forms]![your form name])

rock on!
 
Berk, I did exactly as you said, but nothing happened.
All I see in the text box is #Name?

-----Original Message-----
Make a new module and paste this into it:

Function GetXofY(F As Form)
Dim rs As Recordset
On Error Resume Next
Set rs = F.RecordsetClone
rs.MoveLast
rs.Bookmark = F.Bookmark
If (Err <> 0) Then
GetXofY = rs.RecordCount + 1 & " of " & rs.RecordCount + 1
Else
GetXofY = rs.AbsolutePosition + 1 & " of " &
rs.RecordCount
End If
End Function

then on your form, create a new text field that has this
in the control source =getxofy([Forms]![your form name])

rock on!
-----Original Message-----
I removed the navigation buttons from my form so I could
use some custom buttons. I like the feature that came with
the default buttons, such as "1 of 4 filtered" as it
shows. Is there a way to display this with custom buttons?

TIA
Johnathan
.
.
 
the function is exactly right. You must be having a
problem with the field on your form. Put the function in a
new module. The in the text box it should look like what I
showed you. I know it works, keep trying.
-----Original Message-----
Berk, I did exactly as you said, but nothing happened.
All I see in the text box is #Name?

-----Original Message-----
Make a new module and paste this into it:

Function GetXofY(F As Form)
Dim rs As Recordset
On Error Resume Next
Set rs = F.RecordsetClone
rs.MoveLast
rs.Bookmark = F.Bookmark
If (Err <> 0) Then
GetXofY = rs.RecordCount + 1 & " of " & rs.RecordCount + 1
Else
GetXofY = rs.AbsolutePosition + 1 & " of " &
rs.RecordCount
End If
End Function

then on your form, create a new text field that has this
in the control source =getxofy([Forms]![your form name])

rock on!
-----Original Message-----
I removed the navigation buttons from my form so I could
use some custom buttons. I like the feature that came with
the default buttons, such as "1 of 4 filtered" as it
shows. Is there a way to display this with custom buttons?

TIA
Johnathan
.
.
.
 
I tried it again to no avail. I named the module getxofy
and entered =getxofy([Forms]![frmMain]) in the control
source of the text box and I still get #Name? in the text
box. Do you have an example I could see?

Thanks,

Johnathan
-----Original Message-----
the function is exactly right. You must be having a
problem with the field on your form. Put the function in a
new module. The in the text box it should look like what I
showed you. I know it works, keep trying.
-----Original Message-----
Berk, I did exactly as you said, but nothing happened.
All I see in the text box is #Name?

-----Original Message-----
Make a new module and paste this into it:

Function GetXofY(F As Form)
Dim rs As Recordset
On Error Resume Next
Set rs = F.RecordsetClone
rs.MoveLast
rs.Bookmark = F.Bookmark
If (Err <> 0) Then
GetXofY = rs.RecordCount + 1 & " of " & rs.RecordCount
+
1
Else
GetXofY = rs.AbsolutePosition + 1 & " of " &
rs.RecordCount
End If
End Function

then on your form, create a new text field that has this
in the control source =getxofy([Forms]![your form name])

rock on!
-----Original Message-----
I removed the navigation buttons from my form so I could
use some custom buttons. I like the feature that came
with
the default buttons, such as "1 of 4 filtered" as it
shows. Is there a way to display this with custom
buttons?

TIA
Johnathan
.

.
.
.
 
Johnathan said:
I tried it again to no avail. I named the module getxofy
and entered =getxofy([Forms]![frmMain]) in the control
source of the text box and I still get #Name? in the text
box. Do you have an example I could see?


Not sure if this is the only issue, but the name of a module
can not be the same as the name of a procedure. Most people
name their modules somthing like modGetXofY or basGetXofY
just to be sure there are no name conflicts.

As for your original qiestion, you might want to take a look
at: http://www.mvps.org/access/forms/frm0026.htm
--
Marsh
MVP [MS Access]


-----Original Message-----
the function is exactly right. You must be having a
problem with the field on your form. Put the function in a
new module. The in the text box it should look like what I
showed you. I know it works, keep trying.
-----Original Message-----
Berk, I did exactly as you said, but nothing happened.
All I see in the text box is #Name?


-----Original Message-----
Make a new module and paste this into it:

Function GetXofY(F As Form)
Dim rs As Recordset
On Error Resume Next
Set rs = F.RecordsetClone
rs.MoveLast
rs.Bookmark = F.Bookmark
If (Err <> 0) Then
GetXofY = rs.RecordCount + 1 & " of " & rs.RecordCount +
1
Else
GetXofY = rs.AbsolutePosition + 1 & " of " &
rs.RecordCount
End If
End Function

then on your form, create a new text field that has this
in the control source =getxofy([Forms]![your form name])

rock on!
-----Original Message-----
I removed the navigation buttons from my form so I
could
use some custom buttons. I like the feature that came
with
the default buttons, such as "1 of 4 filtered" as it
shows. Is there a way to display this with custom
buttons?

TIA
Johnathan
.

.

.
.
 
CRAP! I've tried that too but I get the error "Object
doesn't support this property or method". What the hell
am I doing wrong?

And if I change the name of the module how will the form
call it?
-----Original Message-----
Johnathan said:
I tried it again to no avail. I named the module getxofy
and entered =getxofy([Forms]![frmMain]) in the control
source of the text box and I still get #Name? in the text
box. Do you have an example I could see?


Not sure if this is the only issue, but the name of a module
can not be the same as the name of a procedure. Most people
name their modules somthing like modGetXofY or basGetXofY
just to be sure there are no name conflicts.

As for your original qiestion, you might want to take a look
at: http://www.mvps.org/access/forms/frm0026.htm
--
Marsh
MVP [MS Access]


-----Original Message-----
the function is exactly right. You must be having a
problem with the field on your form. Put the function
in
a
new module. The in the text box it should look like
what
I
showed you. I know it works, keep trying.
-----Original Message-----
Berk, I did exactly as you said, but nothing happened.
All I see in the text box is #Name?


-----Original Message-----
Make a new module and paste this into it:

Function GetXofY(F As Form)
Dim rs As Recordset
On Error Resume Next
Set rs = F.RecordsetClone
rs.MoveLast
rs.Bookmark = F.Bookmark
If (Err <> 0) Then
GetXofY = rs.RecordCount + 1 & " of " &
rs.RecordCount
+
1
Else
GetXofY = rs.AbsolutePosition + 1 & " of " &
rs.RecordCount
End If
End Function

then on your form, create a new text field that has this
in the control source =getxofy([Forms]![your form name])

rock on!
-----Original Message-----
I removed the navigation buttons from my form so I
could
use some custom buttons. I like the feature that came
with
the default buttons, such as "1 of 4 filtered" as it
shows. Is there a way to display this with custom
buttons?

TIA
Johnathan
.

.

.

.

.
 
Johnathan, I have done the same as what you are attempting
to do. What I did was place a text box on the form and
call it txtRecordNumber. Then I place the following in
the OnCurrent event of the form. This works fine for me.
Good luck...John

Private Sub Form_Current()
Dim lngCount As Long
Set rst = Me.Recordset.Clone

If rst.EOF = False Then
With rst
.MoveFirst
.MoveLast
lngCount = .RecordCount
End With

Me.txtRecordNumber =
"Me.CurrentRecord & " of " & lngCount

Else
Me.txtRecordNumber = "0" & " of 0"

End If

End Sub
 
Johnathan said:
CRAP! I've tried that too but I get the error "Object
doesn't support this property or method". What the hell
am I doing wrong?

I have no idea. What code are you using now?

And if I change the name of the module how will the form
call it?

You call the procedure, not the module. A module is just a
container for a bunch of procedures.
--
Marsh
MVP [MS Access]


-----Original Message-----
Johnathan said:
I tried it again to no avail. I named the module getxofy
and entered =getxofy([Forms]![frmMain]) in the control
source of the text box and I still get #Name? in the text
box. Do you have an example I could see?


Not sure if this is the only issue, but the name of a module
can not be the same as the name of a procedure. Most people
name their modules somthing like modGetXofY or basGetXofY
just to be sure there are no name conflicts.

As for your original qiestion, you might want to take a look
at: http://www.mvps.org/access/forms/frm0026.htm
--
Marsh
MVP [MS Access]


-----Original Message-----
the function is exactly right. You must be having a
problem with the field on your form. Put the function in
a
new module. The in the text box it should look like what
I
showed you. I know it works, keep trying.
-----Original Message-----
Berk, I did exactly as you said, but nothing happened.
All I see in the text box is #Name?


-----Original Message-----
Make a new module and paste this into it:

Function GetXofY(F As Form)
Dim rs As Recordset
On Error Resume Next
Set rs = F.RecordsetClone
rs.MoveLast
rs.Bookmark = F.Bookmark
If (Err <> 0) Then
GetXofY = rs.RecordCount + 1 & " of " & rs.RecordCount
+
1
Else
GetXofY = rs.AbsolutePosition + 1 & " of " &
rs.RecordCount
End If
End Function

then on your form, create a new text field that has
this
in the control source =getxofy([Forms]![your form
name])

rock on!
-----Original Message-----
I removed the navigation buttons from my form so I
could
use some custom buttons. I like the feature that came
with
the default buttons, such as "1 of 4 filtered" as it
shows. Is there a way to display this with custom
buttons?

TIA
Johnathan
.

.

.

.

.
 
Back
Top