continuous form, ordinal index by function, #Error

aidan

Registered User.
Local time
Today, 16:18
Joined
May 23, 2005
Messages
34
continuous form, ordinal index by function, where?

I want the recordnumber displayed on a continuous form. The code below works with the command button, but not afterinsert.

Here's the code: (function GetPosition() is the control source)

Code:
Private Sub Command28_Click()
   numbers
End Sub

Private Sub Form_AfterInsert()
   numbers
End Sub

Private Function getPosition() As String
    If Me.RecordsetClone.RecordCount > counter Then
        counter = counter + 1
        getPosition = "#" & counter
    Else
        getPosition = "#new"
    End If
End Function

Private Sub numbers()
    counter = 0
    Me.Requery
End Sub

So it should do something like this:
Code:
#1      [ctrl 1]
#2      [ctrl 1]
#3      [ctrl 1]
#new    [ctrl 1]

But called from after insert only the records on the screen get updated unless I scroll up, so simplified it looks like this:
Code:
-----------------  top of subform after scrolling up
#3      [ctrl 1]
-----------------  top of  subform before scrolling up
#1      [ctrl 1]
#2      [ctrl 1]
#new    [ctrl 1]

Where else can I put it or how can I modify the code to make it work?
Aidan
 
Last edited:
This is what I was looking for, thanks.

-- Aidan
 

Users who are viewing this thread

Back
Top Bottom