Solved

How to sequentally number records displayed on a subform

Posted on 2003-12-04
2
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
Drizzt95 earned 100 total points
ID: 9880596
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
ID: 9881005
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

734 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