Results 1 to 7 of 7
  1. #1
    ultimateguy is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    31

    Incrementing a textbox on a continuous form

    I have a continuous form and I want to have a text box or a label next to each record that simply shows the Record Number. I have tried using a text box with Control Source = [Current Record]. This works for the Single Form view but when I change to continuous form, they all show a value of 1.

    How can I accomplish this?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Not easy in query or on form. Review http://allenbrowne.com/ranking.html

    Textbox on report has a RunningSum property which allows this.

    Why is this needed? What purpose does this serve?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ultimateguy is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    31
    The only purpose is to be a visual guide for the user. The form shows a round of trivia questions and I just thought it would be nice to show the question numbers. It's not essential however.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    You could start with a empty table that has an autonumber field (name this as tTriviaMT)
    copy the tTriviaMT to tTrivia
    load tTrivia with the questions. The autonumber will number the questions 1 thru X.

    Each time you load a new set of trivia, you have to start with the empty tTriviaMT table copy, so autonumber will start with 1.

  5. #5
    ultimateguy is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Posts
    31
    I have thought of doing that, but I would need to make a new table each time so that the AutoNumber restarts (because if I erase the table and populate it with a new round of ten questions, the AutoNumber will be from 11 to 20). I have been told previously by June7 that code that modifies the structure of the database should be avoided.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Don't delete table, delete records. Instead of autonumber, use code to populate the field with a sequential value.

    There is a way to generate a sequential number using DCount but this requires another field with value that will sort the records in an ascending order. Not very practical in reality.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,175

    counter in continuous form

    Hi,

    in the included example you'll find 2 ways to include a counter:
    - with a domain function: when you close the form it counts on from the last max number
    - with a form property: each time you close the form the counter restarts from 1

    greetings
    NG
    Attached Files Attached Files

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 01-01-2014, 02:10 PM
  2. textbox in a continuous form can be WRAP ?
    By joe55555 in forum Access
    Replies: 3
    Last Post: 11-04-2013, 03:28 AM
  3. incrementing date on new record in a form
    By cfljanet in forum Forms
    Replies: 16
    Last Post: 08-09-2013, 12:43 PM
  4. Obtain value of textbox - continuous form
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 03-31-2011, 07:54 AM
  5. Incrementing a value in a form
    By erbuchan in forum Access
    Replies: 10
    Last Post: 01-26-2011, 12:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums