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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

giving records a number in a form

Status
Not open for further replies.

stupiet

Programmer
Aug 21, 2001
176
0
0
US
To anyone who can help,

I have a continuous form with many records displayed on it. What I want to do is to give each record a number, so that when it is displayed the first record will have a "1", second record a "2" etc. You can do this in a report by setting the RUNNING SUM to "Over All". How can you do the same in a form.

Also, if you turn the navigation buttons on, it shows that it is possible to assign a number to each record. I just don't know how they did it.

Hope you understand what I mean and Hope you can help me.

Thanks,

Stupiet
 
Thanks for your help! I've tried it and it works just like I wanted. Thanks a lot.
 
Hi:
I used another function to do the job and my fuction works fine. However, I am sure my function needs some tuining up to be perfect.
Note : I have a field on my form which has Recnum() as field source.
------------------------
My fuction:
------------------------
Option Compare Database
Public Function RecNum()
Dim rs As Recordset
Set rs = Forms!AlreadyAssigendInst_For_DesAspecificProg.RecordsetClone
rs.Bookmark = Forms!AlreadyAssigendInst_For_DesAspecificProg.Bookmark
RecNum = rs.AbsolutePosition + 1
rs.MoveNext
End Function
-----------------------------------
So, please, if I am getting the correct result the wrong way let me know.
 
new9,

I tried the sample on the microsoft website. Turns out you can only use it on subforms. I have a continuous form with no subforms in them, and I want to mark them with a number.

I tried your function, but I did not get it to work. Could you be more specific on what I should do?

What I did was adding a textbox to my form and wrote "=RecNum()" in the control source. I am pretty sure this is wrong, so if you could let me know I would appreciate it. I am not very good with modules so I need the help!

Thanks very much,

Tan
 
Hi:
What kind of error did you get?
Anyway, try the following:
On the fuction,
Change this "AlreadyAssigendInst_For_DesAspecificProg" to your continous form name and try it again.

Good luck,,
 
Hi New9,

I would have replied sooner but I never got an e-mail message to notify me about the update.

Anyways, I tried replacing the form name to my continuous form name and it still didn't work. What it displayed was "#Name?".

Again, these are the steps I did:

I used your function and created a module with it.
I replaced the name to my continuous form name.
Then I opened my form and added a textbox with "=RecNum()" in the Control Source.
When I viewed the form "#Name?" popped up for each record.

Please, if you could help me out again I would really appreciate it.

Thanks,

Stupiet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top