Automatic assignment of next random no. to new record

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • anita

    Automatic assignment of next random no. to new record

    I had posted this question before, but did not hear from anybody.
    Can somebody pls help me out.
    I am creating a table with two fields F1, F2 and F2 has about 50,000
    randomly generated alphanumeric nos(RandomID)st ored in the combobox
    control. Everytime I enter a new record in F1, the next available
    RandomID should be automatically assigned to the new record entry and
    displayed in the respective form control(F2). Can anybody guide me
    through pls.
    Any help in this regard will be highly appreciated.
    Thanks
    Anita
  • Alan Webb

    #2
    Re: Automatic assignment of next random no. to new record

    Anita,
    Whats wrong with Access' autonumbering set to random instead of increment?
    Works for me, should work for you.

    "anita" <tamilan71@yaho o.com> wrote in message
    news:6ea59d1d.0 409300541.11a94 2c3@posting.goo gle.com...[color=blue]
    >I had posted this question before, but did not hear from anybody.
    > Can somebody pls help me out.
    > I am creating a table with two fields F1, F2 and F2 has about 50,000
    > randomly generated alphanumeric nos(RandomID)st ored in the combobox
    > control. Everytime I enter a new record in F1, the next available
    > RandomID should be automatically assigned to the new record entry and
    > displayed in the respective form control(F2). Can anybody guide me
    > through pls.
    > Any help in this regard will be highly appreciated.
    > Thanks
    > Anita[/color]


    Comment

    • anita

      #3
      Re: Automatic assignment of next random no. to new record

      Alan

      Thanks for your suggestion. I was not aware about autonumbering set to
      random. However I cannot use this because my random nos. has to be
      necessarily alphanumeric values, which has already been generated by a
      statistical program.
      Pls let me know if you or anybody else have any further suggestions on
      this.
      Thanks again.


      "Alan Webb" <knogeek@hotmai l.com> wrote in message news:<c5ydnYWWz IAiksHcRVn-pg@comcast.com> ...[color=blue]
      > Anita,
      > Whats wrong with Access' autonumbering set to random instead of increment?
      > Works for me, should work for you.
      >
      > "anita" <tamilan71@yaho o.com> wrote in message
      > news:6ea59d1d.0 409300541.11a94 2c3@posting.goo gle.com...[color=green]
      > >I had posted this question before, but did not hear from anybody.
      > > Can somebody pls help me out.
      > > I am creating a table with two fields F1, F2 and F2 has about 50,000
      > > randomly generated alphanumeric nos(RandomID)st ored in the combobox
      > > control. Everytime I enter a new record in F1, the next available
      > > RandomID should be automatically assigned to the new record entry and
      > > displayed in the respective form control(F2). Can anybody guide me
      > > through pls.
      > > Any help in this regard will be highly appreciated.
      > > Thanks
      > > Anita[/color][/color]

      Comment

      • David Schofield

        #4
        Re: Automatic assignment of next random no. to new record

        On 1 Oct 2004 06:34:57 -0700, tamilan71@yahoo .com (anita) wrote:
        [color=blue]
        >Alan
        >
        >Thanks for your suggestion. I was not aware about autonumbering set to
        >random. However I cannot use this because my random nos. has to be
        >necessarily alphanumeric values, which has already been generated by a
        >statistical program.
        >Pls let me know if you or anybody else have any further suggestions on
        >this.
        >Thanks again.
        >
        >[/color]
        Hi
        If you already have a table of random numbers and if this has an index
        field of increasing integers, you can use an incrementing autonumber
        field on you main table and just join between the two tables.
        David

        Comment

        • Alan Webb

          #5
          Re: Automatic assignment of next random no. to new record

          Anita,
          Now that I know this, then to do what you want will require some coding.
          What you want is a function that can be called that returns your random
          numbers. If you don't have to sweat supporting this in something
          interesting like Hebrew or Chinese, then you can work with the first 256
          characters in the ANSI character set. 48 to 57 are the numeric values of
          the numbers 1 to 10. Then 65 to 90 is uppercase letters, and 97 to 122 is
          lower case letters. The first thing would be to choose a length for your
          random number--probably at least 6 characters and maybe as many as 15 (more
          characters improves the odds that there is not already a random number like
          it). The second thing is to choose a random number from 1 to 3. This will
          decide if the current character will be a number, uppercase or lower case
          letters. Then have your code pick a number in the appropriate
          range--between 65 to 90, or 97 to 122. Do this as many times as you need to
          pick all the characters in your random number. Then have your function
          return the result.
          If all this is greek then reply to the newsgroup and I'll post an example.

          "anita" <tamilan71@yaho o.com> wrote in message
          news:6ea59d1d.0 410010534.50650 983@posting.goo gle.com...[color=blue]
          > Alan
          >
          > Thanks for your suggestion. I was not aware about autonumbering set to
          > random. However I cannot use this because my random nos. has to be
          > necessarily alphanumeric values, which has already been generated by a
          > statistical program.
          > Pls let me know if you or anybody else have any further suggestions on
          > this.
          > Thanks again.
          >
          >
          > "Alan Webb" <knogeek@hotmai l.com> wrote in message
          > news:<c5ydnYWWz IAiksHcRVn-pg@comcast.com> ...[color=green]
          >> Anita,
          >> Whats wrong with Access' autonumbering set to random instead of
          >> increment?
          >> Works for me, should work for you.
          >>
          >> "anita" <tamilan71@yaho o.com> wrote in message
          >> news:6ea59d1d.0 409300541.11a94 2c3@posting.goo gle.com...[color=darkred]
          >> >I had posted this question before, but did not hear from anybody.
          >> > Can somebody pls help me out.
          >> > I am creating a table with two fields F1, F2 and F2 has about 50,000
          >> > randomly generated alphanumeric nos(RandomID)st ored in the combobox
          >> > control. Everytime I enter a new record in F1, the next available
          >> > RandomID should be automatically assigned to the new record entry and
          >> > displayed in the respective form control(F2). Can anybody guide me
          >> > through pls.
          >> > Any help in this regard will be highly appreciated.
          >> > Thanks
          >> > Anita[/color][/color][/color]


          Comment

          Working...