Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Me.CurrentRecord Displayed on the Form

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
As many of you know each record in a form has a number which can be captured with "Me.currentRecord".

I would like to have text box not enabled which has that number displayed in the form. It would look like each record is numbered from 1 through the last record.

Thanks in advance
 

In the on Current event of the form:
Private Sub Form_Current()
Me!Text1 = CurrentFormRecord(Me)
End Sub


add this function to forms code:

Function CurrentFormRecord(frm As Form) As Long
CurrentFormRecord = frm.CurrentRecord
End Function
 
vbajock!

Thanks!

Where should I add this function.

Function CurrentFormRecord(frm As Form) As Long
CurrentFormRecord = frm.CurrentRecord
End Function

What do you mean to the "forms code".
 
Just cut and past it into the code module of the form, same module as the on current event is located
 
vbaJock!

Thanks for your code!

What happens is that it changes the value of Me!Text1 to the record that I am in for all records. lets say I am in record 5 it will change the value for all records to 5.

I know how to capture the record value that I am in. What I want is that it should display next to each record in Text1 the number of that record for record 1 the No. 1 for Record 10 the No. 10 each record should display which record number this is. All the time not only when I highlight(select) that record.
 
Are you using a continous form or a single form? Is me!text1 bound to a field in a table?

The code I gave you was tested in a single form.
 
vbajock

I really appreciate your help.

I am using a contiuous form and That is what a said in my first post I want it should be numbered from 1 through whatever.

Hope to hear some good news soon, Thanks;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top