Record Navigation

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hi,

I've created a subform that shows comments for the current
record. I have set the subform to be single and I have
added my own forward and back buttons to scroll through
each of the comments for that record.

this works fine, what I would like to know is how do I
display the number of comments.

Records can have multiple comments. So when I go to a
record I would like it to display the number of comments
available, say "1 of 10" or "1 of 1" this way I know if
there is more than one entry and I can scroll to see them.

Or I suppose if there is only 1 entry hide the scroll
buttons and if more entrys exits display the scroll buttons
though I would like to know how many records there are.

Hope that makes sense.

Thanks
 
Tim, I have done the same thing as you are doing and here
is what I used to display the number of records. I created
a txtbox and called it txtRecordNumber. The line starting
Me.txtRecordNumber = ... I added several items to this
line that gave me a more info beyond the 1 of 10, which
you can see from the info called clientcode. I have this
in the Contacts form, and it would say "Contact 1 of 10
for ABC01". You can "experiment" with the line to suit
what you want it to say. Place this code in the forms
OnCurrent event. Whenever the form changes info, so does
the txtRecordNumber info.
Hope this helps.
*** 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 = "Contact " &
Me.CurrentRecord & " of " & lngCount & " for " &
[Clientcode]

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

End If

End Sub
 
Thanks John,

I'm pretty green when it comes to Access programming.

I'm only having one problem and thats with the line
Me.txtRecordNumber = "Contact " & Me.CurrentRecord & "
of " & lngCount & " for " & [Clientcode]

the lngCount is giving me an error. If I remove that part
of the line I can get the textbox19 to display "Contact 1 of"

Is there somthing I'm missing?

Thanks



-----Original Message-----
Tim, I have done the same thing as you are doing and here
is what I used to display the number of records. I created
a txtbox and called it txtRecordNumber. The line starting
Me.txtRecordNumber = ... I added several items to this
line that gave me a more info beyond the 1 of 10, which
you can see from the info called clientcode. I have this
in the Contacts form, and it would say "Contact 1 of 10
for ABC01". You can "experiment" with the line to suit
what you want it to say. Place this code in the forms
OnCurrent event. Whenever the form changes info, so does
the txtRecordNumber info.
Hope this helps.
*** 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 = "Contact " &
Me.CurrentRecord & " of " & lngCount & " for " &
[Clientcode]

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

End If

End Sub


-----Original Message-----
Hi,

I've created a subform that shows comments for the current
record. I have set the subform to be single and I have
added my own forward and back buttons to scroll through
each of the comments for that record.

this works fine, what I would like to know is how do I
display the number of comments.

Records can have multiple comments. So when I go to a
record I would like it to display the number of comments
available, say "1 of 10" or "1 of 1" this way I know if
there is more than one entry and I can scroll to see them.

Or I suppose if there is only 1 entry hide the scroll
buttons and if more entrys exits display the scroll buttons
though I would like to know how many records there are.

Hope that makes sense.

Thanks

.
.
 
Got it working

Thanks...

-----Original Message-----
Thanks John,

I'm pretty green when it comes to Access programming.

I'm only having one problem and thats with the line
Me.txtRecordNumber = "Contact " & Me.CurrentRecord & "
of " & lngCount & " for " & [Clientcode]

the lngCount is giving me an error. If I remove that part
of the line I can get the textbox19 to display "Contact 1 of"

Is there somthing I'm missing?

Thanks



-----Original Message-----
Tim, I have done the same thing as you are doing and here
is what I used to display the number of records. I created
a txtbox and called it txtRecordNumber. The line starting
Me.txtRecordNumber = ... I added several items to this
line that gave me a more info beyond the 1 of 10, which
you can see from the info called clientcode. I have this
in the Contacts form, and it would say "Contact 1 of 10
for ABC01". You can "experiment" with the line to suit
what you want it to say. Place this code in the forms
OnCurrent event. Whenever the form changes info, so does
the txtRecordNumber info.
Hope this helps.
*** 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 = "Contact " &
Me.CurrentRecord & " of " & lngCount & " for " &
[Clientcode]

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

End If

End Sub


-----Original Message-----
Hi,

I've created a subform that shows comments for the current
record. I have set the subform to be single and I have
added my own forward and back buttons to scroll through
each of the comments for that record.

this works fine, what I would like to know is how do I
display the number of comments.

Records can have multiple comments. So when I go to a
record I would like it to display the number of comments
available, say "1 of 10" or "1 of 1" this way I know if
there is more than one entry and I can scroll to see them.

Or I suppose if there is only 1 entry hide the scroll
buttons and if more entrys exits display the scroll buttons
though I would like to know how many records there are.

Hope that makes sense.

Thanks

.
.
.
 
Thanks John this worked great.

Have a question, about it... when showing the records ie:
"Rec 1 of 10" using the next button allows me to
eventually end at record "Rec 10 of 10" but If I click it
one more time It will show "Rec 11 of 10" is there a way of
stopping it at the last actual record. Is this because Im
accessing the table direcly and not a query?

Just wondering.

Thanks


-----Original Message-----
Tim, I have done the same thing as you are doing and here
is what I used to display the number of records. I created
a txtbox and called it txtRecordNumber. The line starting
Me.txtRecordNumber = ... I added several items to this
line that gave me a more info beyond the 1 of 10, which
you can see from the info called clientcode. I have this
in the Contacts form, and it would say "Contact 1 of 10
for ABC01". You can "experiment" with the line to suit
what you want it to say. Place this code in the forms
OnCurrent event. Whenever the form changes info, so does
the txtRecordNumber info.
Hope this helps.
*** 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 = "Contact " &
Me.CurrentRecord & " of " & lngCount & " for " &
[Clientcode]

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

End If

End Sub


-----Original Message-----
Hi,

I've created a subform that shows comments for the current
record. I have set the subform to be single and I have
added my own forward and back buttons to scroll through
each of the comments for that record.

this works fine, what I would like to know is how do I
display the number of comments.

Records can have multiple comments. So when I go to a
record I would like it to display the number of comments
available, say "1 of 10" or "1 of 1" this way I know if
there is more than one entry and I can scroll to see them.

Or I suppose if there is only 1 entry hide the scroll
buttons and if more entrys exits display the scroll buttons
though I would like to know how many records there are.

Hope that makes sense.

Thanks

.
.
 
Back
Top