Invoices Filter in Northwind sample and Replication ID type (1 Viewer)

mothernature

New member
Local time
Today, 12:16
Joined
Jan 15, 2008
Messages
6
Hi guys,

As you all know, in the Northwind sample database there are the Invoices and Invoices Filter query. The Invoices Filter query adds a criteria to select only items that belong to the current order. OrderID is integer.

However, if I change OrderID to Replication ID, it stops working.

Any idea how to make it work? Currently I work around this problem in my DB by adding a criteria to filter by Date and Customer ID, but IMO this is less than ideal.
 

pdx_man

Just trying to help
Local time
Yesterday, 22:16
Joined
Jan 23, 2001
Messages
1,347
Why are you changing it to Replication ID? Do you know what a Replication ID is? It is really to be utilized when using a Merge replication and you have remote instances synching up with a master. If this is not your utilization, what is your goal?
 

pdx_man

Just trying to help
Local time
Yesterday, 22:16
Joined
Jan 23, 2001
Messages
1,347
*** To add a quick comment, OrderID is an Integer. A Replication ID is a Globally Unique Identifier (GUID).
 

mothernature

New member
Local time
Today, 12:16
Joined
Jan 15, 2008
Messages
6
Yes, I know why I'm using GUID in my application. There will be 2 users: the boss and his employee. They will work separately, each one will be entering sales orders. They are disconnected and work on their computer and their flash disks. At the end of each day, the employee will hand over his flash disk and the boss will transfer the employee's work into his backend DB (and then erase the employee's today's sales).

I'm just wondering why this SQL (Invoices Filter):

Code:
SELECT Invoices.*
FROM Invoices
WHERE (((Invoices.OrderID)=[Forms]![Orders]![OrderID]));

doesn't work when OrderID is of type GUID. Is there some kind of special equality operator (=) for GUID?

Btw, this is Access 2002. I don't know if this has been changed in later versions. If someone could confirm if this is the case, that'd be nice.
 

pdx_man

Just trying to help
Local time
Yesterday, 22:16
Joined
Jan 23, 2001
Messages
1,347
The GUID is not really designed to be something that is utilized as an OrderID or anything like that. It ensures uniqueness for dislocated data entry. I don't think it even displays in later versions of Access.

I would use some other convention for the order ID. Perhaps concatonate an autonumber with the user/computer designation. 'B' + [autonumberfield].
 

mothernature

New member
Local time
Today, 12:16
Joined
Jan 15, 2008
Messages
6
Thanks for the suggestion.

Ok let's rephrase the question then. My main point is actually not about Northwind or my application or Orders/OrderID. It's: how to compare two GUID value (or a GUID column and a form field containing GUID)? Why does the = operator in the above SQL not work?
 

mothernature

New member
Local time
Today, 12:16
Joined
Jan 15, 2008
Messages
6
Ok, I *think* one needs to use StringFromGUID() and GUIDFromString() to deal with comparison with GUID. Haven't actually tried this at the moment though.
 

pdx_man

Just trying to help
Local time
Yesterday, 22:16
Joined
Jan 23, 2001
Messages
1,347
As David's article points out, there are issues with using the GUID, especially for it's un-intended purpose. I would really think about my last suggestion. Especially if this is going to be used for any period of time.
 

Users who are viewing this thread

Top Bottom