Here are 2 ways to create a UID...
The 1st one produces a format that is equal to that of SQL Servers UID's.
VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function CoCreateGuid Lib "ole32" (id As Any) As Long
  4. Private Declare Function GetTickCount Lib "kernel32" () As Long
  5.  
  6. Private Sub Form_Load()
  7. Dim strOld      As String
  8. Dim strNew      As String
  9. Dim intIndex    As Long
  10. Dim lngStart    As Long
  11.     lngStart = GetTickCount
  12.     For intIndex = 1 To 10000
  13.         strNew = CreateUID
  14.         If strNew = strOld Then
  15.             MsgBox "No unique! Boooooooo", vbCritical
  16.         End If
  17.         strOld = strNew
  18.     Next intIndex
  19.     MsgBox GetTickCount - lngStart & "ms", vbInformation
  20. End Sub
  21.  
  22. Private Function CreateUID() As String
  23. Dim bytID(1 To 16)      As Byte
  24. Dim intIndex            As Integer
  25. Dim strUID              As String
  26.     Call CoCreateGuid(bytID(1))
  27.     For intIndex = 1 To 16
  28.         If bytID(intIndex) < CByte(16) Then
  29.             strUID = strUID & "0"
  30.         End If
  31.         strUID = strUID & Hex$(bytID(intIndex))
  32.         Select Case intIndex
  33.             Case 4, 6, 8, 10
  34.                 strUID = strUID & "-"
  35.         End Select
  36.     Next intIndex
  37.     CreateUID = strUID
  38. End Function
And the 2nd way...
VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function CoCreateGuid Lib "ole32" (id As Any) As Long
  4. Private Declare Function GetTickCount Lib "kernel32" () As Long
  5.  
  6. Private Type mtypUID
  7.     Data1 As Long
  8.     Data2 As Integer
  9.     Data3 As Integer
  10.     Data4(7) As Byte
  11. End Type
  12.  
  13. Private Sub Form_Load()
  14. Dim strOld      As String
  15. Dim strNew      As String
  16. Dim intIndex    As Long
  17. Dim lngStart    As Long
  18.     lngStart = GetTickCount
  19.     For intIndex = 1 To 10000
  20.         strNew = CreateGUID
  21.         If strNew = strOld Then
  22.             MsgBox "No unique! Boooooooo", vbCritical
  23.         End If
  24.         strOld = strNew
  25.     Next intIndex
  26.     MsgBox GetTickCount - lngStart & "ms", vbInformation
  27. End Sub
  28.  
  29. Private Function CreateGUID() As String
  30. Dim udtGUID As mtypUID
  31.     Call CoCreateGuid(udtGUID)
  32.     CreateGUID = _
  33.         String(8 - Len(Hex$(udtGUID.Data1)), "0") & Hex$(udtGUID.Data1) & _
  34.         String(4 - Len(Hex$(udtGUID.Data2)), "0") & Hex$(udtGUID.Data2) & _
  35.         String(4 - Len(Hex$(udtGUID.Data3)), "0") & Hex$(udtGUID.Data3) & _
  36.         IIf((udtGUID.Data4(0) < &H10), "0", "") & Hex$(udtGUID.Data4(0)) & _
  37.         IIf((udtGUID.Data4(1) < &H10), "0", "") & Hex$(udtGUID.Data4(1)) & _
  38.         IIf((udtGUID.Data4(2) < &H10), "0", "") & Hex$(udtGUID.Data4(2)) & _
  39.         IIf((udtGUID.Data4(3) < &H10), "0", "") & Hex$(udtGUID.Data4(3)) & _
  40.         IIf((udtGUID.Data4(4) < &H10), "0", "") & Hex$(udtGUID.Data4(4)) & _
  41.         IIf((udtGUID.Data4(5) < &H10), "0", "") & Hex$(udtGUID.Data4(5)) & _
  42.         IIf((udtGUID.Data4(6) < &H10), "0", "") & Hex$(udtGUID.Data4(6)) & _
  43.         IIf((udtGUID.Data4(7) < &H10), "0", "") & Hex$(udtGUID.Data4(7))
  44. End Function
They both create a UID, however, the 1st chunk of code is twice as fast...

Hope this is useful to someone...

Woka