I'm trying to enhance the technique to add a "New"/"All" value to a list.
Starting point - this works:
SELECT MfrRls FROM SCH_Forms
WHERE JobNum=[txtJobNum] AND Form=[cmbForm]
UNION Select
"New" AS New From SCH_Forms ORDER BY MfrRls;
When there are records in the table the value list includes the MfrRls's plus New.
When there are no records in the table the value list is New.
The goal is for that 'new' value to be the next MfrRls number.
Table
JobNum / Form / MfrRls
1234 / 1 / 1
1234 / 1 / 2
The value list should be 1,2,3
The SQL Statement is now to this point and works when there is a record in the table, I need it to create a value list: 1 when there are no records in the table.
- I put in the Nz hoping that would do what was needed.
SELECT MfrRls FROM SCH_Forms
WHERE JobNum=[txtJobNum] AND Form=[cmbForm]
UNION Select
( SELECT Nz(Max(MfrRls),0)+1 AS New
FROM SCH_Forms
WHERE SCH_Forms.[JobNum]=[txtJobNum] AND SCH_Forms.[Form]=[cmbForm]
GROUP BY SCH_Forms.MfrRls) as MfrRls
From SCH_Forms ORDER BY MfrRls;
I realize that another approach is to construct the value list in VBA code. It would be great to 'keep it simple', if it is possible - and I would add another technique to my repertoire.