Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Vb6

  • 23-02-2004 5:07pm
    #1
    Closed Accounts Posts: 3


    Does any1 know a component in vb that acts the same way as autoNumber in Ms Access ?


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    No, but you can write one in under a dozen lines of code, so I'm not really surprised.

    jc


  • Closed Accounts Posts: 3 jl2004


    dont mean do be a dumbass but im as much a newbie to vb as to boards.ie
    any chance of showin me the code?


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Describe what you want it for.....


  • Closed Accounts Posts: 24 Mazikeen


    The simplest implementation would be something like:
    Public Function getAutoNumber()
        Static iAutoNumber As Integer
        iAutoNumber = iAutoNumber + 1
        getAutoNumber = iAutoNumber
    End Function
    
    However it starts getting more complex as you introduce things such as multiple autonumber instances and persistance (where does your auto number go when you switch off your code?)


  • Closed Accounts Posts: 3 jl2004


    Thats grand, i have it figured out now, thanks.....


  • Advertisement
  • Closed Accounts Posts: 333 ✭✭McGintyMcGoo


    Thats grand, i have it figured out now, thanks.....


    ... "figured out" OR you just copied it exactly!!?? :D


Advertisement