Counting problem

raindrop3

Registered User.
Local time
Today, 11:46
Joined
Sep 6, 2001
Messages
98
Hello,

I have a little counting problem. My code writes a file to a directory and everytime a file is copied to a dir, a record is inserted into my table.
It is not allowed that a directory contains more than 150 files. So everytime a file is copied, my code count the records in the table. If ther are more than 150, a new dir is created. However, everytime there are 150 records added, a new dir must be created.
My code put 150 files int the first dir, 300 into the second, 450 into the third, etc.

I CAN'T GET THE CODE RIGHT!
Can someone give me some tips for this 'little' problem.
Every 150 records (files) extra, a new dir must be created.

Thanks, thanks, thanks in advantage!

Albert
 
We can be more helpful if you post your code. So we can see how you are actually doing the count.
 
maximum = inputbox(......)Maximum files in a directory.

rc = recordset with info about images to be copied. ("SELECT * FROM PHOTOS WHERE DELETE = -1")

archief = Target recordset. (Info of rc must be copied to this table!)
****************
Here is my code:

If Archief.RecordCount >= 1 Then
Archief.MoveLast

10 Do Until rc.EOF
On Error Resume Next

Newnumber = ar("number") + 1

With Archief
start = .RecordCount
.AddNew
Archief("Straatnaam") = rc("Straatnaam")
Archief("Plaats") = rc("Plaats")
Archief("Huisnummer") = rc("Plaats")
Archief("fotonummer") = rc("fotonummer")
Archief("datum foto") = rc("datum foto")
Archief("Trefwoord") = rc("trefwoord")
Archief("naam firma") = rc("naam firma")
Archief("Fotograaf") = rc("fotograaf")
Archief("Omschrijving") = rc("omschrijving")
Archief("Filenumber") = start + 1
Archief("icon") = rc("icon")
.Update
.MoveLast

If .RecordCount >= Maximum Then
MkDir path & newnumber
Maximum = Maximum + Maximum

ar.Edit
ar("number") = newnumber
ar.Update
GoTo 22

Else

22:

start = Archief.RecordCount
Huidigfilenumber = rc("filenumber")

archiefpath = path & ar("number") & "\"


FileCopy PathAfdeling & Huidigfilenumber & ".jpg", archiefpath & Begin & ".jpg"

rc.MoveNext

End If

End With


Loop

I think the problem is: maximum = maximum + maximum. But I have no idear how to solve it yet.

Albert
 
YOOOO! I have already solved the problem. It was a very, very, very, very stupid mistake...

And it was the 'maximum = maximum + maximum' part...

Thanks for the reply, Travis!

Albert
 

Users who are viewing this thread

Back
Top Bottom