I suppose the same value type in Access would be an AutoNumber field type... Then set that as the Primary Key - if it is indeed supposed to be the primary key. You can only have one AutoNumber field per table.
That's for a table...
Not sure about a ReplicationID. I'd imagine if you're just looking or referencing that value in VBA, you'd just need to Dim it as a Long...
Or wait... does the ReplicationID in SQL (I forget) create something similar or same as NewID()? If so, then you'd have to go with String, I suppose, as the variable type..
kjv1611 Sql Server has a datatype called Unique Identifier. When linking from Access to SQL Server that field is defined as Numeric with Replication ID in the Fieldsize. Not sure what Newid() does. Have to look that up. but did get it to work by making it a string. Thanks for that.
NewID() is useful for at least 2 things. You can use it to add a unique ID on the fly.. You can also use it (and this is mainly what I use it for) to select random records.
For random, you could say:
SELECT TOP 1000 t.ID ,t.Name
FROM MyTable t
ORDER BY NewID()
Or for setting up a new ID field, you could select it into a new table, or update the existing one, setting your ID field equal to NewID().
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.