Hello all;
I have just started using Access this week, and have found your forums very helpful in setting up my database.
I am making a form that inputs new records, but on the previous form, I want to make sure that the first two fields in combination are unique, however the two fields by themselves will not necessarily be. The first field is a 1-3 letter code (CodeFirst) and the 2nd field is an integer (CodeLast)
I have a Combo box for CodeFirst that pulls all the distinct values from the table (CodeSheet), I then want to set CodeLast to the max value +1 of all instances of CodeFirst.
Ex:
CodeFirst CodeLast
ABC 111
ABC 222
ABC 444
DEF 222
DEF 333
So in my combo box, if i choose ABC, I would need the new CodeLast to be 445, and if I chose DEF, I would need 334.
Here is what I was thinking, but I do not even know where this would go. I'm sorry I am terribly lost at the moment!
SELECT max(CodeSheet.CodeLast) FROM CodeSheet WHERE CodeSheet.CodeFirst=Forms!CodeSheetInputForm!Combo162;
Thank you all for your assistance!
I have just started using Access this week, and have found your forums very helpful in setting up my database.
I am making a form that inputs new records, but on the previous form, I want to make sure that the first two fields in combination are unique, however the two fields by themselves will not necessarily be. The first field is a 1-3 letter code (CodeFirst) and the 2nd field is an integer (CodeLast)
I have a Combo box for CodeFirst that pulls all the distinct values from the table (CodeSheet), I then want to set CodeLast to the max value +1 of all instances of CodeFirst.
Ex:
CodeFirst CodeLast
ABC 111
ABC 222
ABC 444
DEF 222
DEF 333
So in my combo box, if i choose ABC, I would need the new CodeLast to be 445, and if I chose DEF, I would need 334.
Here is what I was thinking, but I do not even know where this would go. I'm sorry I am terribly lost at the moment!
SELECT max(CodeSheet.CodeLast) FROM CodeSheet WHERE CodeSheet.CodeFirst=Forms!CodeSheetInputForm!Combo162;
Thank you all for your assistance!