Guid

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

    #1

    Guid

    Hi

    Is there a way to generate Guids in access?

    Thanks

    Regards


  • Wayne Morgan

    #2
    Re: Guid

    In a table, set a field for AutoNumber, at the bottom change Long Integer to
    Replication ID.

    --
    Wayne Morgan
    Microsoft Access MVP


    "John" <john@nospam.in fovis.co.uk> wrote in message
    news:40a94d74$0 $17763$cc9e4d1f @news.dial.pipe x.com...[color=blue]
    > Hi
    >
    > Is there a way to generate Guids in access?[/color]


    Comment

    • Tony Toews

      #3
      Re: Guid

      "John" <john@nospam.in fovis.co.uk> wrote:
      [color=blue]
      >Is there a way to generate Guids in access?[/color]

      You can very likely use a Visual Basic API call so I'd search on those keywords.

      Tony
      --
      Tony Toews, Microsoft Access MVP
      Please respond only in the newsgroups so that others can
      read the entire thread of messages.
      Microsoft Access Links, Hints, Tips & Accounting Systems at

      Comment

      • John

        #4
        Re: Guid

        Anyway I can do it in the code?

        Regards

        "Wayne Morgan" <comprev_gothro ughthenewsgroup @hotmail.com> wrote in message
        news:lhdqc.359$ zb5.108@newssvr 15.news.prodigy .com...[color=blue]
        > In a table, set a field for AutoNumber, at the bottom change Long Integer[/color]
        to[color=blue]
        > Replication ID.
        >
        > --
        > Wayne Morgan
        > Microsoft Access MVP
        >
        >
        > "John" <john@nospam.in fovis.co.uk> wrote in message
        > news:40a94d74$0 $17763$cc9e4d1f @news.dial.pipe x.com...[color=green]
        > > Hi
        > >
        > > Is there a way to generate Guids in access?[/color]
        >
        >[/color]


        Comment

        • John

          #5
          Re: Guid

          Private Type GUID
          Data1 As Long
          Data2 As Integer
          Data3 As Integer
          Data4(7) As Byte
          End Type

          Private Declare Function CoCreateGuid Lib "OLE32.DLL" (pGuid As GUID) As
          Long

          Public Function GetGUID() As String
          '(c) 2000 Gus Molina

          Dim udtGUID As GUID

          If (CoCreateGuid(u dtGUID) = 0) Then

          GetGUID = _
          String(8 - Len(Hex$(udtGUI D.Data1)), "0") & Hex$(udtGUID.Da ta1) & _
          String(4 - Len(Hex$(udtGUI D.Data2)), "0") & Hex$(udtGUID.Da ta2) & _
          String(4 - Len(Hex$(udtGUI D.Data3)), "0") & Hex$(udtGUID.Da ta3) & _
          IIf((udtGUID.Da ta4(0) < &H10), "0", "") & Hex$(udtGUID.Da ta4(0)) & _
          IIf((udtGUID.Da ta4(1) < &H10), "0", "") & Hex$(udtGUID.Da ta4(1)) & _
          IIf((udtGUID.Da ta4(2) < &H10), "0", "") & Hex$(udtGUID.Da ta4(2)) & _
          IIf((udtGUID.Da ta4(3) < &H10), "0", "") & Hex$(udtGUID.Da ta4(3)) & _
          IIf((udtGUID.Da ta4(4) < &H10), "0", "") & Hex$(udtGUID.Da ta4(4)) & _
          IIf((udtGUID.Da ta4(5) < &H10), "0", "") & Hex$(udtGUID.Da ta4(5)) & _
          IIf((udtGUID.Da ta4(6) < &H10), "0", "") & Hex$(udtGUID.Da ta4(6)) & _
          IIf((udtGUID.Da ta4(7) < &H10), "0", "") & Hex$(udtGUID.Da ta4(7))
          End If

          End Function

          "Tony Toews" <ttoews@teluspl anet.net> wrote in message
          news:bv2ja091r7 00u9nen3nfvo6ov db4fvkhvr@4ax.c om...[color=blue]
          > "John" <john@nospam.in fovis.co.uk> wrote:
          >[color=green]
          > >Is there a way to generate Guids in access?[/color]
          >
          > You can very likely use a Visual Basic API call so I'd search on those[/color]
          keywords.[color=blue]
          >
          > Tony
          > --
          > Tony Toews, Microsoft Access MVP
          > Please respond only in the newsgroups so that others can
          > read the entire thread of messages.
          > Microsoft Access Links, Hints, Tips & Accounting Systems at
          > http://www.granite.ab.ca/accsmstr.htm[/color]


          Comment

          • David W. Fenton

            #6
            Re: Guid

            "John" <john@nospam.in fovis.co.uk> wrote in
            news:40a94d74$0 $17763$cc9e4d1f @news.dial.pipe x.com:
            [color=blue]
            > Is there a way to generate Guids in access?[/color]

            A number of parts of Access and VBA can't really handle GUIDs.

            Michael Kaplan long ago wrote about the pitfalls of GUIDs as PK in
            replicated databases, but nearly all the problems he describes apply
            to non-replicated databases:



            Basically, if Michael Kaplan doesn't think it's a good idea, it
            really isn't a good idea.

            --
            David W. Fenton http://www.bway.net/~dfenton
            dfenton at bway dot net http://www.bway.net/~dfassoc

            Comment

            Working...