Results 1 to 8 of 8
  1. #1
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99

    Numbering Entries In a Form

    Hi All
    I have a form called frmPartsRequistion, this form is used for enter data to the tblPartsRequsition. On this form I want to add a subform to let user see the history. Since there may be many records in the subform, I want to number them to make the subform look better. I search on the internet and got the code as below:
    Private Sub Form_Current()


    On Error GoTo Err_Form_Current

    Dim rst As Recordset
    Set rst = Me.RecordsetClone
    rst.Bookmark = Me.Bookmark
    Me.txtPosition = rst.AbsolutePosition + 1
    Exit_Form_Current:
    Set rst = Nothing
    Exit Sub
    Err_Form_Current:
    If Err = 3021 Then
    Me.txtPosition = rst.RecordCount + 1
    Else
    MsgBox Error$, 16, "Error in Form_Current()"
    End If
    Resume Exit_Form_Current

    End Sub

    The form shows like the picture attached, and it seems the code only run for one circle?
    Could someone give some suggestion?
    Thanks in advance

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Perhaps this link will be helpful: http://www.lebans.com/rownumber.htm

  3. #3
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    thanks a lot rural, I'll try this out and let you know the result
    it's 22:30 here, need some sleep......

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    We'll stay tuned.

  5. #5
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    It works! Thank you Rural!

    Here comes another question, since I am going to use this form as a subform in another form, so when the other form is opened I do not want this subform loaded and show the query condition dialog box(attached picture). I tried cancel the open event in the subform, but it does not work.
    My purpose is: make the subform invisible when the main form is loaded and then when user entered the primary key and click a button, the subform will show up.
    I don't know how to make the query in the subform not work do you have any idea?
    Thanks in advance.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    One issue per thread. Use this new issue to start a new thread and use the Thread Tools to mark this thread as Solved.

  7. #7
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    Yeah OK
    Acutally I made the subform based on the tbl instead of based on the query, and it work Ok.
    Thank you Rural.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for the update.

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

Similar Threads

  1. Form with an unkonwn number of entries?
    By bakkouz in forum Forms
    Replies: 3
    Last Post: 02-17-2011, 12:56 AM
  2. numbering line entries
    By tgavin in forum Access
    Replies: 6
    Last Post: 07-27-2010, 11:53 AM
  3. resolving repeating entries in sub form
    By cvgope in forum Forms
    Replies: 0
    Last Post: 10-07-2009, 11:14 PM
  4. Entries in table not showing on form!!!
    By corystemp in forum Access
    Replies: 6
    Last Post: 03-26-2009, 06:30 PM
  5. Auto Numbering
    By rkruczk in forum Forms
    Replies: 0
    Last Post: 10-09-2006, 04:25 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