View Full Version : Unique Keys??


gmatriix
08-25-2008, 01:37 PM
Hello All,

Is there a way to create a unique key base on a number change...I am possibly not explaining this right but here is a example:

Before

29
29
29
29
30
30
30

After

29-1
29-2
29-3
29-4
30-1
30-2
30-3

Each time the number changes it starts over with "-1" Is there any way to do this?

Any ideas would be helpful!

Thanks!

MStef
08-25-2008, 10:58 PM
Look at "DemoUniqueKeysA2000.mdb",
Look at Table1, Query1, Module1.
Run Query1 and look at Table1, (don't do it 2 times).
Before take a copy of your Table.
If you need, enlarge FIELD SIZE (f1Num).

gmatriix
08-26-2008, 01:05 AM
Wow,

Thank you so much. I hope to be as good as this some day.....

Thanks again!!!!!!!!!!

gmatriix
08-26-2008, 04:38 AM
Hey I am using this in a query...Is there a way to make it stay at 1 2 3 4 instead of adding?

MStef
08-26-2008, 04:43 AM
I don't understand what do you want.

gmatriix
08-26-2008, 04:51 AM
I have a query that have a field called Week_No. So is there any way that the numbering can stay at this:

Before

28
28
28
29
29
29

After

28-1
28-2
28-3
29-1
29-2
29-3

Right now it is doing this:

28-276
28-277
28-278
29-240
29-251
29-262

Is there a way to make it start over each time it is ran with -1,-2,-3?

The expression in the query looks like this:

Wk Key: GetNumUPD([Week_No])

Thanks

MStef
08-26-2008, 05:01 AM
In my demo it start with 1, 2, 3, always when Week_No is changed.
It must be you made a mistake somewhere.

gmatriix
08-26-2008, 05:32 AM
Can I send you my file?.....I tried to upload it but it would not do it......do you have a email I can send it to?