Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to sequentally number records displayed on a subform

Posted on 2003-12-04
2
Medium Priority
?
401 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 400 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

721 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