ACC2000: "????????" Is Displayed as the Value of a SQL Server GUID Field (278099)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q278099
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

When you use Visual Basic for Applications (VBA) code to retrieve and display the value of a Jet Replication ID or a SQL Server Unique Identifier(GUID) field, you get a value of "????????".

CAUSE

A GUID is a 16-byte array that Microsoft Access does not know how to interpret unless the data is converted.

RESOLUTION

To enable Access to properly interpret and display a GUID field, convert the GUID field to a string by using the StringFromGUID() function. For example, when you run the following code against an open form with a GUID field in its record source, you will see a string of hexadecimal numbers enclosed in braces preceded by the word "guid" and enclosed by another set of braces.

Note that
Debug.Print StringFromGUID(Forms![FormName]![GUIDFieldName])
				
is displayed something like this:

{guid {3B9B63A3-863D-11CF-8CAE-00AA00C0016B}}

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Open the sample Access project NorthwindCS.adp.
  2. Create a table named tblGuid and name one of its fields fldGUID. Make fldGUID a UniqueIdentifier data type and set the Is RowGUID property to true.
  3. Add some records to the tblGUID table.
  4. Create a form that is bound to the entire tblGUID table.
  5. Add a command button to the form, and then set the OnClick property of the command button to the following event procedure:
    Msgbox Me!fldGUID
    View the form in Form view, and then click the command button. Note that you receive a message box that displays "????????".

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

197916 HOWTO: Use GUIDs w/ Access, SQL 6.5 and SQL 7

For more information about the StringFromGUID function, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type stringfromguid function in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Modification Type:MajorLast Reviewed:12/12/2002
Keywords:kbdta kbprb KB278099