Fetch the Record Number to display on the form

  • Thread starter Thread starter David Morison
  • Start date Start date
D

David Morison

Hi,

I'd like to display the record number and the number of record numbers on
the form instead of in the navigation bar. e.g Record [current record
number] of [number of records]. I realise this is probably fairly easy, but
I can't find out how to do it after searching the online help, and the web.
I've tried the page number script within Access, but I've since found it
doesn't equate 'page' to 'form record'.

Any help is appreciated,

Cheers,

Dave
 
Dave,
There are probably a couple ways to do this, I am probably more old
fashioned.

one, to get a record number, you can create an AutoNumbered field and
place it in the form, and this will give you an easy record id as well.

to get the total records:
create an unbound text box in your form, and then use this as the control:

=Count ( [Your Field Name Here ] )
this will count the number of times (records) are in the form.
it is good practice to use your primary key for this function since that
field will be in every record.

hope that helps!
 
Hi,

Thanks for that, I had actually thought of doing that, but I should have
been more clear. The number of records is fine, but the autonumber field
will not work, as my form consists of a subform embedded within a form.

So to put an autonumber field in the table corresponding to the subform
would mean that a) the numbers might be in the wrong order, and b) for the
subform the numbering would be wrong - i.e. the table linked to the subform
might have autonumbered such that the numbers for a particular entry in the
main form are 6 and 12, however you'd want to display 1 and 2.

Is this clear, and is this possible without basing the subform on a query,
as I don't particularly want to redo the whole thing...

Cheers,

Dave

kryszystof via AccessMonster.com said:
Dave,
There are probably a couple ways to do this, I am probably more old
fashioned.

one, to get a record number, you can create an AutoNumbered field and
place it in the form, and this will give you an easy record id as well.

to get the total records:
create an unbound text box in your form, and then use this as the
control:

=Count ( [Your Field Name Here ] )
this will count the number of times (records) are in the form.
it is good practice to use your primary key for this function since that
field will be in every record.

hope that helps!

David said:
Hi,

I'd like to display the record number and the number of record numbers on
the form instead of in the navigation bar. e.g Record [current record
number] of [number of records]. I realise this is probably fairly easy,
but
I can't find out how to do it after searching the online help, and the
web.
I've tried the page number script within Access, but I've since found it
doesn't equate 'page' to 'form record'.

Any help is appreciated,

Cheers,

Dave
 
Actually, I found exactly what I was looking for in a previous post.

Frank posted earlier:

=IIf([CurrentRecord]>(Count(*)),'New Record',('Record ' & [CurrentRecord] &
' of ' & Count(*)))

Cheers Frank (though you'll probably never read this),

Dave
 
You are making it harder than it really is:
For the record number - rst.AbsolutePosition
for the number of records - rst.RecordCount


David Morison said:
Actually, I found exactly what I was looking for in a previous post.

Frank posted earlier:

=IIf([CurrentRecord]>(Count(*)),'New Record',('Record ' & [CurrentRecord] &
' of ' & Count(*)))

Cheers Frank (though you'll probably never read this),

Dave

David Morison said:
Hi,

I'd like to display the record number and the number of record numbers on
the form instead of in the navigation bar. e.g Record [current record
number] of [number of records]. I realise this is probably fairly easy,
but I can't find out how to do it after searching the online help, and the
web. I've tried the page number script within Access, but I've since found
it doesn't equate 'page' to 'form record'.

Any help is appreciated,

Cheers,

Dave
 
Oh, I forgot to mention, to change this when you move from record to record,
put this in the Current event of your form:

Me.txtCurrRecord = rst.AbsolutePosition
Me.txtTotalRecords = rst.RecordCount

David Morison said:
Actually, I found exactly what I was looking for in a previous post.

Frank posted earlier:

=IIf([CurrentRecord]>(Count(*)),'New Record',('Record ' & [CurrentRecord] &
' of ' & Count(*)))

Cheers Frank (though you'll probably never read this),

Dave

David Morison said:
Hi,

I'd like to display the record number and the number of record numbers on
the form instead of in the navigation bar. e.g Record [current record
number] of [number of records]. I realise this is probably fairly easy,
but I can't find out how to do it after searching the online help, and the
web. I've tried the page number script within Access, but I've since found
it doesn't equate 'page' to 'form record'.

Any help is appreciated,

Cheers,

Dave
 
Back
Top