AmateurHour:
I think I oversimplified the question possibly.
I think it's fair to say the data included was poorly chosen to give a misleading understanding. Don't worry. That sort of thing will be easier to recognise with experience.
CactusData has shown, again, a very clever way of providing the data to support a cartesian product for ten times more values. While you may not want to include all of this complication in your query I strongly recommend you recognise the technique and how it can be used, by extension, to provide values from 0 to any power of ten. Each extra power is reached by the simple addition of another table in the FROM clause. You may even want to set up a stored QueryDef to encapsulate the complexity within and thus enable you to benefit from that any time you are required to use a record source of a list of number from 0 up to whatever.
I'll leave that up to you to decide what suits you best. It may be daunting for a beginner, but show that to a superior and you can expect them to be impressed.
However, you may find it easier to follow if I illustrate what can be done using the simpler table approach.
- SELECT Val([SerialNumbers].[S/N])+[tblDigit].[Digit] AS [SerialNumber]
-
FROM [SerialNumbers]
-
, [tblDigit]
-
WHERE (Val([SerialNumbers].[S/N])+[tblDigit].[Digit]
-
<=Val(Mid([SerialNumbers].[S/N],InStr([SerialNumbers].[S/N],'-')+1))
-
ORDER BY [SerialNumbers].[S/N]
-
, [tblDigit].[Digit]
You'll see this is very much a repeat of much of what CactusData has already posted. Hopefully it's a little easier to understand as it's a more basic approach.
Before I finish let me just add that this is unnecessarily more complicated because the data for the start and end values is held in a text field. It would work more efficiently, and be easier to code, if it were normalised and each of the lower and upper values were stored in separate numeric fields.