Query with Replication ID Parameter

suchiate

Registered User.
Local time
Today, 15:13
Joined
Jul 4, 2007
Messages
17
Hi All,

Can anyone tell me what is the data type to be used for the replication ID of a query parameter? I want to retrieve values from a table where the ID is the replication ID but I dont know what is the data type to be used for my query parameter.

Can anyone help me out? Thanks.
 
Can anyone tell me what is the data type to be used for the replication ID of a query parameter? I want to retrieve values from a table where the ID is the replication ID but I dont know what is the data type to be used for my query parameter.

Welcome to the joys *NOT* of using GUIDs in Access. See:

http://trigeminal.com/usenet/usenet011.asp?1033

I find that when I write code that does DAO lookups, I end up using the string part of GUID {xxx} for criteria and compare it to the CStr() value of the underlying GUID. Here's an example:

Code:
  If Left(strReplicaID, 5) = "{guid" Then
     strReplicaID = "{" & Mid(strReplicaID, 6)
     strReplicaID = Left(strReplicaID, Len(strReplicaID) - 1)
  End If
  strSQL = "SELECT MSysReplicas.Removed FROM MSysReplicas WHERE CStr([ReplicaId])=" & STR_QUOTE & strReplicaID & STR_QUOTE & " AND MSysReplicas.Removed Is Null;"

So, your WHERE compares CStr() of the GUID field to criteria that is only the string value from the canonical GUID.

This is what Michael Kaplan recommends as one of the solutions.

It will not be fast for large tables. I never use GUIDs for PK fields at all, so I'm only doing this when looking for data in the replication tables, none of which ever has more than a couple of hundred records in it.

And if your data is actually in SQL Server, then all bets are off, as it returns data differently still, and you would then use ADO, I believe.

I'm with Michael in recommending simply completely avoiding the problem by just not using GUIDs as a PK.

And I realize that none of this answers you question about parameter type, but I don't see any way to use a parameter for this (at least, not one that accomplishes anything). I don't use parameter queries, anyway, so this just may be my unfamiliarity with them, but I just don't see how there's anything you can do except setting it to String.
 

Users who are viewing this thread

Back
Top Bottom