Solved

How to sequentally number records displayed on a subform

Posted on 2003-12-04
2
351 Views
Last Modified: 2012-05-04
I have a subform which displays a selection, based on a query, of records from a main table. Is there an easy way to add a text box with a sequential number for each record.
The form displays using a Continuous Forms format.
0
Comment
Question by:NPOS
2 Comments
 
LVL 3

Accepted Solution

by:
Drizzt95 earned 100 total points
Comment Utility
There may be an easier way but this works:

Add a module and paste the following in:

Public intCounter As Integer

Public Function Counter() As Integer
    intCounter = intCounter + 1
    Counter = intCounter
End Function

Add a text box and change the control source to:
=Counter()

You need to add intCounter = 0 to somewhere where the subform data is changed.  This may be in the main form or something, but I think it would also work in the subform under Form_DataSetChange() or Form_DataChange().  I'm not a hundred percent sure on that part.

I don't know what your knowledge is of VBA, so let me know if this is beyond you and I'll try to explain it better.
0
 

Author Comment

by:NPOS
Comment Utility
Thanks Dizzt95

That worked perfectly. Took a little experimaentatin to work out where to put the intCounter = 0  - but I managed it, even though I am certainly no VBA expert. m learning gradually though.

In this case I put it in the main form, where I have requery statements that run the subforms including the one I needed this for.

Many thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now