GUIDFromString Function Example

The following example uses the GUIDFromString function to convert a string to a GUID. The string is a GUID stored in string form in a replicated Employees table. The field, s_GUID, is a hidden field added to every replicated table in a replicated database.

Sub CheckGUIDType()
    Dim dbs As Database, rst As Recordset

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("Employees")
    Debug.Print rst!s_GUID
    Debug.Print TypeName(rst!s_GUID)
    Debug.Print TypeName(GuidFromString(rst!s_GUID))
End Sub