Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop for a value

Status
Not open for further replies.

hoofit

Technical User
Nov 20, 2005
343
US
Good afternoon,
I have a table with the following fields;

category
interval
value

I need to control data entry in the value field in a manner that allows duplicates only if they are not sequenced. This example is sequenced;

category interval value
a-pm 5 8
a-pm 3 9
b-pm 6 9

This example is not sequenced;
category interval value
a-pm 5 8
a-pm 3 9
b-pm 6 8

In the first example, the number 9 is sequenced. The second example it is not although in both cases it is duplicated which is fine. I'm not sure how to approach this. Seems like a loop would be best to determine if a sequence exists. Any thoughts would be helpful

hoof
 
I don't see any mechanism in your table to ensure that the sort order is correct. I don't know if you are aware of this or not but tables in Access are not stored in the order the data is inputted. It may APPEAR to be that way but it is really not. So, unless you provide a way to know which data is in which order you are floating in the wind.

So, how can you tell that a value is sequenced? How is the sort order determined? Are you sorting on category and then value? Or what?

Bob Larson
FORMER Microsoft Access MVP (2008-2009, 2009-2010)
Free Tutorials/Samples/Tools:
 
Hi boblarson,

OK, seems that a query would do it, sorted ascending on category then value. But then I need a way to find the sequenced values, or better, prevent them from occuring.

hoof
 
Please define duplicate and sequenced.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I think we need more information on what this data represents, how it is put into the database and why so that we can make any helpful decisions on how to avoid the situation you are looking to avoid. It isn't clear at all what this is and why you can't have, what you call sequenced, items there.

Bob Larson
FORMER Microsoft Access MVP (2008-2009, 2009-2010)
Free Tutorials/Samples/Tools:
 
I'm working on clarification. PHV, by sequenced I mean one after the other. As in the example, 9,9 is a sequence, 9,8,9 is not because the nines are separated by an 8.

hoof
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top