View Full Version : Comparing DB Entries within a field and Validating them


umairsheikh
09-25-2005, 07:33 AM
Hi,

This may be a little difficult to explain but here goes:

I have a table in access 97 with the field Account. An account name is usually written as 0000000_A, but it MAY also have a secondary account and is usually written with the same first series of digits but ends in B e.g. 0000000_B. Therefore, we could have an account 0023654_A and 0023654_B.

Now for each account name there is another field called Items which are chosen from a combo box on a form (item 1, item 2, item 3, item 4, item 5, item 6, item 7 and item 8). An account may have more than one item.

Now if account B exists then it MUST contain the same entries as account A but can also have additional items.
So we could have a situation where:

0023654_A
item 1
item 2
item 3
item 4

0023654_B
item 1
item 2
item 3
item 4
item 5
item 6

Now what I am trying to implement is that if the core items (these are those that are contained in both - which would be item 1, item 2, item 3 and item 4 in the above example) are changed in either accounts making them not equal then a warning message should come up stating so. IT IS IMPERATIVE THAT THE CORE ITEMS ARE PRESENT IN BOTH.

I have some experience in Access 97, but unsure of how to tackle this. Could somebody please guide me ???

neileg
09-26-2005, 08:39 AM
Not clear how you are holding the items. They should be individual records in a second table.

I would hold your account name as two fields, 0000000 and a or b. In your items table identify the items that relate to a b account. They you know that,
- an item that matches on the 0000000 with no b identifier links to an a account
- an item that matches on the 0000000 with any identifier links to an b account
This way you don't need to hold duplicated entries.