By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,124 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,124 IT Pros & Developers. It's quick & easy.

Guid

P: n/a
Hi

Is there a way to generate Guids in access?

Thanks

Regards
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


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

--
Wayne Morgan
Microsoft Access MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:40***********************@news.dial.pipex.com ...
Hi

Is there a way to generate Guids in access?

Nov 12 '05 #2

P: n/a
"John" <jo**@nospam.infovis.co.uk> wrote:
Is there a way to generate Guids in access?


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
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #3

P: n/a
Anyway I can do it in the code?

Regards

"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:lh***************@newssvr15.news.prodigy.com. ..
In a table, set a field for AutoNumber, at the bottom change Long Integer to Replication ID.

--
Wayne Morgan
Microsoft Access MVP
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:40***********************@news.dial.pipex.com ...
Hi

Is there a way to generate Guids in access?


Nov 12 '05 #4

P: n/a
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(udtGUID) = 0) Then

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

End Function

"Tony Toews" <tt****@telusplanet.net> wrote in message
news:bv********************************@4ax.com...
"John" <jo**@nospam.infovis.co.uk> wrote:
Is there a way to generate Guids in access?
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
http://www.granite.ab.ca/accsmstr.htm

Nov 12 '05 #5

P: n/a
"John" <jo**@nospam.infovis.co.uk> wrote in
news:40***********************@news.dial.pipex.com :
Is there a way to generate Guids in access?


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:

http://trigeminal.com/usenet/usenet011.asp?1033

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
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.