Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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

    >
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page