show number of records

JonatABS

Registered User.
Local time
Today, 01:23
Joined
Dec 16, 2002
Messages
114
You know how at the bottom of a form that you fill out you CAN have the record navigation bar so you can go back and forth between records?

Well I got rid of that to make it look more professional.

I have a subform that I use to keep track of calls that come in for each employee. I can ad any number of notes per person.

I do how ever want to show what record they are on out of the total number of records there are.

like Tech note 1 of 10 or something


I also have the date and time being stamped at the end of the note. I however want this to be stamped at the beginning of the note instead of the end what do I do?

Jon
 
Jon,

As far as letting the user know where they are
on the form ... I don't know. If they look over
to the right-hand margin and the scroll bar is
the size of a ball bearing ... well you know.
I think that with a bookmark or a recordset count
you could tell them, but I don't know.

The date/time stamp is easy however.

Me.MyMemo = Now() & " " & Me.MyMemo & Me.New & vbCrLF

hth,
Wayne
 
Hi, I am newbie and I collected a lot of codes from all over the internet but I can't remember where I got this one from which I hope will help you answer your question.
---


Option Compare Database
Option Explicit

'***********************************************************
'This code builds a set of Navigation Buttons consisting of:
'First, Next, Previous, Last, and New
'***********************************************************

Private Sub cmdFirst_Click()
On Error GoTo Err_cmdFirst_Click

DoCmd.GoToRecord , , acFirst

Exit_cmdFirst_Click:
Exit Sub

Err_cmdFirst_Click:
MsgBox Err.Description
Resume Exit_cmdFirst_Click

End Sub

Private Sub cmdLast_Click()
On Error GoTo Err_cmdLast_Click

DoCmd.GoToRecord , , acLast

Exit_cmdLast_Click:
Exit Sub

Err_cmdLast_Click:
MsgBox Err.Description
Resume Exit_cmdLast_Click

End Sub

Private Sub cmdNew_Click()
On Error GoTo Err_cmdNew_Click

DoCmd.GoToRecord , , acNewRec

Exit_cmdNew_Click:
Exit Sub

Err_cmdNew_Click:
MsgBox Err.Description
Resume Exit_cmdNew_Click

End Sub

Private Sub cmdNext_Click()
On Error GoTo Err_cmdNext_Click

DoCmd.GoToRecord , , acNext

Exit_cmdNext_Click:
Exit Sub

Err_cmdNext_Click:
MsgBox Err.Description
Resume Exit_cmdNext_Click

End Sub

Private Sub cmdPrevious_Click()
On Error GoTo Err_cmdPrevious_Click

DoCmd.GoToRecord , , acPrevious

Exit_cmdPrevious_Click:
Exit Sub

Err_cmdPrevious_Click:
MsgBox Err.Description
Resume Exit_cmdPrevious_Click

End Sub

Private Sub Form_Current()
On Error GoTo Err_Form_Current
Dim recClone As Recordset
Dim intNewRecord As Integer

' If this is a "New Record" then
' Disable the <Next>, <New>, <Last> buttons
' Enable the <First> and <Next> buttons
' Then Exit the procedure.
intNewRecord = IsNull(Me![RecID])
If intNewRecord Then
cmdFirst.Enabled = True
cmdNext.Enabled = False
cmdPrevious.Enabled = True
cmdLast.Enabled = False
cmdNew.Enabled = False
Me![RecordCount] = "New Record"
Me.txtPlantID_Code.SetFocus ' Set focus to the Plant ID if a "New Record"
Exit Sub
Else
' Else if this is not a new record
' Enable <New> and <Last> buttons
cmdNew.Enabled = True
cmdLast.Enabled = True
End If

' Make a clone of the recordset underlying the form so
' we can move around without affecting the form's recordset
Set recClone = Me.RecordsetClone()

' Check to see if there are no records
' If so disable all buttons except for the <New> button
If recClone.RecordCount = 0 Then
cmdNext.Enabled = False
cmdPrevious.Enabled = False
cmdFirst.Enabled = False
cmdLast.Enabled = False
Else
' Synchronise the current pointer in the two recordsets
recClone.Bookmark = Me.Bookmark
' If there are records, see if recordset is on the first record
' If so, disable the <First> and <Previous> buttons
recClone.MovePrevious
cmdFirst.Enabled = Not (recClone.BOF)
cmdPrevious.Enabled = Not (recClone.BOF)
recClone.MoveNext
' And then check whether recordset is on the last record
' If so, disable the <Last> and <Next> buttons
recClone.MoveNext
cmdLast.Enabled = Not (recClone.EOF)
cmdNext.Enabled = Not (recClone.EOF)
recClone.MovePrevious
End If


Me![RecordCount] = "Record " & (recClone.AbsolutePosition + 1) & " of " & _
DCount("RecID", "tbl_OraclePlantCodes")

recClone.Close

Exit_Form_Current:
Exit Sub

Err_Form_Current:
If Err = 3021 Then
' Error 3021 means recordset is at Add New Record
' Enable <Previous> and <First> buttons
' Disable <Next> and <Last> buttons
cmdPrevious.Enabled = True
cmdFirst.Enabled = True
cmdNext.Enabled = False
cmdLast.Enabled = False
Resume Exit_Form_Current
Else
MsgBox Err.Description
Resume Exit_Form_Current
End If

End Sub
 
number of records

Does anybody know how to do this yet.

to reask, I want to display the number of records there are on a certain table like you can display the number of pages on a report.

On the individual form that your filling out I want to display the record # out of total records on the table.

Thanks
 
Or
Me.txtCurrRec = Form.CurrentRecord
Me.txtTotalRecs = Form.RecordsetClone.RecordCount + IIf(Form.NewRecord, 1, 0) & " " & "(filtered)"
 

Users who are viewing this thread

Back
Top Bottom