How to Create a GUID Column in Microsoft Access

I’ve become a fan of GUIDs recently. They provide a unique ID to each row in a database table, and I much prefer them to just a standard row number.

I’ve known that SQL Server creates them quite easily, and had assumed that Microsoft Access would make life difficult for me. But that’s not the case. They’re so easy in Access, you just have to figure out how to do it. And figure it out I did didn’t – I got the solution from an article on the DevX web site. Here’s how to do it:

1. Create your column in Access to store the GUID. Set the data type as autonumber.
2. Change the Field Size to Replication ID.
3. Set the column as a primary key in your table. (I’m not sure if this bit is actually needed, but it’s good practise anyway).
4. Create another column in your Access table, just to test it. Hey presto!

Adrian