How To AutoNumber a Continuous Form In Access (1 Viewer)

vdanelia

Registered User.
Local time
Today, 07:20
Joined
Jan 29, 2011
Messages
215
Hello I have very simple Question...
I wonder How to simply Auto-number continuous form as we simply do in the Reports like: =1 (With Unbound Text-Box) I searched, but found nothing.

Thanks
 

missinglinq

AWF VIP
Local time
Today, 10:20
Joined
Jun 20, 2003
Messages
6,385

missinglinq

AWF VIP
Local time
Today, 10:20
Joined
Jun 20, 2003
Messages
6,385
...I checked the given Links and found some variants, but they're query based.
If you look you'll see that I noted that in my post. I believe you're going to find that a Query is the only way you can do this. These numbers have to be Bound to something; Unbound Controls in Continuous Forms all display the same Value. And since the numbers will change, depending on the Records in the underlying set, each time the Form is opened, they have to be re-calculated each time, and this can only be done, to my knowledge, using a Query.

Linq ;0)>
 

vdanelia

Registered User.
Local time
Today, 07:20
Joined
Jan 29, 2011
Messages
215
Thanks missinglinq For your suggestion....
According with some examples i came to this: I think this variant is very simple

1. Create Unbound Text box and Set control-source of unbound Text box to
= RowNum([Form])
Then Let use the Code:

Code:
'Copyright Stephen Lebans 1999
'May not be resold
'Please include my 1 line Copyright notice
'in your code if you use these functions

'I left a bunch of development code in here in case anyone decides to go
'down the same paths I did.
'Created by Stephen Lebans with help from Chris Bergmans
' Updated by Allen Browne Oct/2002
'Production version of GetLineNumberForm
'Works in Form or SubForm mode
'Set controlsource of unbound Text box to
'= RowNum([Form])
'Type exactly as above

Public Function RowNum(frm As Form) As Variant
On Error GoTo Err_RowNum
    'Purpose:   Numbering the rows on a form.
    'Usage:     Text box with ControlSource of:  =RowNum([Form])
    
    With frm.RecordsetClone
        .Bookmark = frm.Bookmark
        RowNum = .AbsolutePosition + 1
    End With
    
Exit_RowNum:
    Exit Function
    
Err_RowNum:
    If Err.Number <> 3021& Then  'Ignore "No bookmark" at new row.
        Debug.Print "RowNum() error " & Err.Number & " - " & Err.Description
    End If
    RowNum = Null
    Resume Exit_RowNum
End Function
Working perfectly
 

vbaInet

AWF VIP
Local time
Today, 15:20
Joined
Jan 22, 2010
Messages
26,374
If a Primary Key exists, here's another way of doing it (attached). Non-recordset based.
 

Attachments

smig

Registered User.
Local time
Today, 17:20
Joined
Nov 25, 2009
Messages
2,140
Can you know which record row is the first visible one in a continous form?
 

missinglinq

AWF VIP
Local time
Today, 10:20
Joined
Jun 20, 2003
Messages
6,385
Can you know which record row is the first visible one in a continous form?
Not much information, but if you're trying to do something when on the first record,

If Me.CurrentRecord = 1 Then

should do it.

Linq ;0)>
 

smig

Registered User.
Local time
Today, 17:20
Joined
Nov 25, 2009
Messages
2,140
Not realy help.
When you scroll records some of records are not visible but the record counter count them.
 

missinglinq

AWF VIP
Local time
Today, 10:20
Joined
Jun 20, 2003
Messages
6,385
In ten years of participating in Access forums this has to be absolutely, positively the most absurd statement I've ever seen! You need to explain what

"When you scroll records some of records are not visible but the record counter count them."

means!

How are you scrolling Records? If you have a fast machine, you may not be able to 'see' each Record as it passes by, but that doesn't mean that it doesn't exist!

Sorry, but your post simply makes no sense!
 

smig

Registered User.
Local time
Today, 17:20
Joined
Nov 25, 2009
Messages
2,140
I'll try to explain

In a continous form you don't see all records when you use the sidebar (or any other way), Only some of the records are visble.
Sure they are all there, even if you can't see them at the moment. Never said they are not.

My question was if it's possible to count only the visible ones, or to know which one is the first visible one.

I hope it's more clear now

Tal
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom