Link to home
Start Free TrialLog in
Avatar of fasse
fasse

asked on

Create list in access or excel

I need to create a list of numbers from 100-000 to 999-999 is this possible to do. I have only been able to find third party software that looks like it would work.

example
100-000 to 100-999 then
101-000 to 101-999 then
102-000 to 102-999 and so on until 999-999
Thanks
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

Sure it is possible with VBA. Where do you want the list to go?

Dim I As Long

Dim J As Long


For I = 100 To 999

    For J = 0 To 999
    
        Debug.Print Format(I, "000") & "-" & Format(J, "000")
    
    Next J


Next I

Open in new window


This example sends the list to the immediate windows
Avatar of fasse
fasse

ASKER

A table in access called tblvalidparts
ASKER CERTIFIED SOLUTION
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fasse

ASKER

I have a form set where someone looking for a new partnumber can start to type in the part and only the ones that have not been used show up.  
Example
you type 203-2
It will show you all the 203-2XX numbers that are available.
I am currently using this and everyone seems to like it. But we have used most of the numbers that I have done by had and was just looking for an easy way to create the list for every possible part number.

I will give this a try.
I see.

Let me know if you can't get the code to run after changing to use your field name.
Avatar of fasse

ASKER

Worked perfect.  Thanks so much