Free Resources from FMS

Additional Resources

 

Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.

Darren D.

 

Free Catalog

 

How to Generate a GUID with VB Script

Provided by:  FMS Development Team

Global Unique Ids (GUIDs) can be very useful in naming files, folders or database records. GUIDs are guaranteed to be unique irrespective of the origin.

"Scriptlet.Typelib" is an object that is normally used to generate a type library for Windows Script Component dynamically. By design, the object creates a GUID if one is not provided, so this feature is used to create GUIDs.

The following code shows how to create a GUID in Visual Basic Script:

set x = createobject("Scriptlet.TypeLib")
strNewGuid=left(x.GUID,38)

In order to generate 5 GUIDs, the following code sample may be used:

for n = 1 to 5
uniqueid(n) = left(createobject("Scriptlet.Typelib").guid,38)


Return to the tips page