Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

obtaining a unique identifier, incorporating data from another fie

Discussion in 'Information Technology' started by Holly1, Jul 28, 2006.

  1. Holly1

    Holly1
    Expand Collapse
    Guest

    I am in the process of creating a new table which requires me to produce
    unique identifying numbers, which are also dependant on information on
    another field within the same table. I have no idea how to do this. Please
    help.
    --
    Holly1
     
  2. Loading...

    Similar Threads Forum Date
    Obtaining God Gurmat Vichaar Jul 14, 2006
    Obtaining the status of immortality Interfaith Dialogues Jan 6, 2006
    Obtaining all rewards ! Interfaith Dialogues Sep 26, 2005
    Obtaining your mind's desires Interfaith Dialogues Aug 25, 2005
    India Gwalior: A Unique Link to India's History Breaking News Nov 16, 2013

  3. Arvin Meyer [MVP]

    Arvin Meyer [MVP]
    Expand Collapse
    Guest

    This is a violation of Third Normal Form. A Key must not depend upon the
    value of another field. It can include the value (such as in a compound
    key), but not depend upon it. I suggest that if you need this, that you use
    it as an index, but not as the Key. An example of a date field with and
    incrementing number might be something like (air code):

    Function NextJobnum()
    Static intNum As Integer
    Dim db As DAO.Database
    Dim rst As DAO.Dynaset
    On Error Go To Error_Handler

    Set db = CurrentDb
    Set rst = db.OpenRecordset("Select [JobNum] from [MyTable] Order By
    [JobNum];")

    If Not rst.EOF Then
    rst.MoveLast
    intNum = val(mid(rst.Fields("JobNum"),7)) + 1
    Else
    intNum = 1
    End If
    NextJobnum = Month(Date) & Day(Date) & intNum

    ExitHere:
    On Error Resume Next
    rst.Close
    Set rst = Nothing
    Set db = Nothing
    intNum = 0

    Error_Handler:
    Resume Exit_Here

    End Function

    --
    Arvin Meyer, MCP, MVP
    Microsoft Access
    Free Access downloads
    http://www.datastrat.com
    http://www.mvps.org/access
    "Holly1" <Holly1@discussions.microsoft.com> wrote in message
    news:6AC839C6-DFC8-4368-A6FF-DD5B6FD25F0E@microsoft.com...
    > I am in the process of creating a new table which requires me to produce
    > unique identifying numbers, which are also dependant on information on
    > another field within the same table. I have no idea how to do this.

    Please
    > help.
    > --
    > Holly1
     
  4. sheng guo ying

    sheng guo ying
    Expand Collapse
    Guest

    ллÄãÃǵİïÖú.
    "Arvin Meyer [MVP]" <a@m.com> дÈëÏûÏ¢ÐÂÎÅ
    :#M6rqeCiGHA.4080@TK2MSFTNGP03.phx.gbl...
    > This is a violation of Third Normal Form. A Key must not depend upon the
    > value of another field. It can include the value (such as in a compound
    > key), but not depend upon it. I suggest that if you need this, that you

    use
    > it as an index, but not as the Key. An example of a date field with and
    > incrementing number might be something like (air code):
    >
    > Function NextJobnum()
    > Static intNum As Integer
    > Dim db As DAO.Database
    > Dim rst As DAO.Dynaset
    > On Error Go To Error_Handler
    >
    > Set db = CurrentDb
    > Set rst = db.OpenRecordset("Select [JobNum] from [MyTable] Order By
    > [JobNum];")
    >
    > If Not rst.EOF Then
    > rst.MoveLast
    > intNum = val(mid(rst.Fields("JobNum"),7)) + 1
    > Else
    > intNum = 1
    > End If
    > NextJobnum = Month(Date) & Day(Date) & intNum
    >
    > ExitHere:
    > On Error Resume Next
    > rst.Close
    > Set rst = Nothing
    > Set db = Nothing
    > intNum = 0
    >
    > Error_Handler:
    > Resume Exit_Here
    >
    > End Function
    >
    > --
    > Arvin Meyer, MCP, MVP
    > Microsoft Access
    > Free Access downloads
    > http://www.datastrat.com
    > http://www.mvps.org/access
    > "Holly1" <Holly1@discussions.microsoft.com> wrote in message
    > news:6AC839C6-DFC8-4368-A6FF-DD5B6FD25F0E@microsoft.com...
    > > I am in the process of creating a new table which requires me to produce
    > > unique identifying numbers, which are also dependant on information on
    > > another field within the same table. I have no idea how to do this.

    > Please
    > > help.
    > > --
    > > Holly1

    >
    >
     

Share This Page