Check ID Number between range

dinoc

Registered User.
Local time
Today, 15:13
Joined
Oct 23, 2014
Messages
13
Hello All,

I'm trying to create some code that will create a new folder depending on the ID that is currently being added to the database.
What happens at the moment is a new ID is generated which in turn is job reference.
When this is added to the database a folder is created with a prefix of this ID number and a 20char test specified in a text field by the user.
Obivously this number is creeping up .

What I am trying to achieve is this:
If the ID = 57
Then a folder is create called 1 - 500 (and ignore if one has already been created, which it should have at ID number 1)
When the ID Number 501 comes along another new folder is create called 501 - 1000 etc etc.
The idea is not to have 3000+ folders in just one folder making it look a bit messy and lengthy to look through.

Does anyone have any suggestiong or solution to this?

Many thanks in advance.
 
Found a pretty old thread on the forum for you


This will allow you to create the folders if they dont exist..
Strongly recommend you use something like 000001-000500, so you dont get crosseyed searching the folders when they are alphabetized.

Thanks namliam,

I'm ok checking if the folder exists etc, the bit I'm having a problem with so that it works dynamicaly is the checking for the number if its between a range of 500 e.g

ID 1234 would would create a folder called 1234 in a parent folder of say 1000 - 1499.

That folder would have been created when ID 1000 came along and the check would have realised it does not yet exist.

If that makes sense haha :D
 
Sure that makes sence, its a simple matter of divide and conquer....
Might depend a little, 001-500 or a bit easier perhaps 000-499

I.e. for 000001-000500, this would build that name.
Format(Int((ID-1)/500)*500+1, "000000") & "-" & Format((Int((ID-1)/500)+1)*500, "000000")
 

Users who are viewing this thread

Back
Top Bottom