473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Keeping track of size of database

Using A2000
I am using mini-databases residing on floppy disks for writing school
reports which can then be sent to a central db for electronic
collating. Occasionally the database has grown past the 1.38Mb
possible on disk and this has crashed the whole database into an un
recoverable state, losing data if not backed up. Is there access to
the size of the database within the db as a VB function so that I can
trigger a warning when moving from record to record if the db is
getting near the limit?

Thanks

Bill
Nov 12 '05 #1
12 4048
On 7 Jan 2004 13:50:07 -0800 in comp.databases.ms-access,
bi**@piperb.freeserve.co.uk (Bill) wrote:
Using A2000
I am using mini-databases residing on floppy disks for writing school
reports which can then be sent to a central db for electronic
collating. Occasionally the database has grown past the 1.38Mb
possible on disk and this has crashed the whole database into an un
recoverable state, losing data if not backed up. Is there access to
the size of the database within the db as a VB function so that I can
trigger a warning when moving from record to record if the db is
getting near the limit?


FileLen(CurrentDb.Name)

--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #2
Trevor Best <bouncer@localhost> wrote:
FileLen(CurrentDb.Name)


The best kind of answer. Succinct.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #3
FileLen gives the size of the file before it was opened - this is not what the
poster asked for. FileLen does not include the additional bytes added to the
file in the open session. The poster needs the LOF function.

From the Help file ---

Remarks

If the specified file is open when the FileLen function is called, the value
returned represents the size of the file immediately before it was opened.

Note To obtain the length of an open file, use the LOF function.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Trevor Best" <bouncer@localhost> wrote in message
news:4k********************************@4ax.com...
On 7 Jan 2004 13:50:07 -0800 in comp.databases.ms-access,
bi**@piperb.freeserve.co.uk (Bill) wrote:
Using A2000
I am using mini-databases residing on floppy disks for writing school
reports which can then be sent to a central db for electronic
collating. Occasionally the database has grown past the 1.38Mb
possible on disk and this has crashed the whole database into an un
recoverable state, losing data if not backed up. Is there access to
the size of the database within the db as a VB function so that I can
trigger a warning when moving from record to record if the db is
getting near the limit?


FileLen(CurrentDb.Name)

--
A)bort, R)etry, I)nfluence with large hammer.

Nov 12 '05 #4
On Wed, 07 Jan 2004 23:42:03 GMT in comp.databases.ms-access, "PC
Datasheet" <sp**@nospam.spam> wrote:
FileLen gives the size of the file before it was opened - this is not what the
poster asked for. FileLen does not include the additional bytes added to the
file in the open session. The poster needs the LOF function.

From the Help file ---

Remarks

If the specified file is open when the FileLen function is called, the value
returned represents the size of the file immediately before it was opened.

Note To obtain the length of an open file, use the LOF function.


Well it doesn't do what it says on the tin because it works for me.

?filelen(CurrentDb.Name)
909312
docmd.CopyObject CurrentDb.Name,"test1",acTable,"Table1"
?filelen(CurrentDb.Name)
925696

--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #5
On Wed, 07 Jan 2004 23:20:35 GMT in comp.databases.ms-access, Tony
Toews <tt****@telusplanet.net> wrote:
Trevor Best <bouncer@localhost> wrote:
FileLen(CurrentDb.Name)


The best kind of answer. Succinct.


I thought my internet connection was going to drop any moment :-)

--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #6
On Thu, 08 Jan 2004 07:56:56 +0000 in comp.databases.ms-access, Trevor
Best <bouncer@localhost> wrote:
On Wed, 07 Jan 2004 23:42:03 GMT in comp.databases.ms-access, "PC
Datasheet" <sp**@nospam.spam> wrote:
FileLen gives the size of the file before it was opened - this is not what the
poster asked for. FileLen does not include the additional bytes added to the
file in the open session. The poster needs the LOF function.

From the Help file ---

Remarks

If the specified file is open when the FileLen function is called, the value
returned represents the size of the file immediately before it was opened.

Note To obtain the length of an open file, use the LOF function.


Well it doesn't do what it says on the tin because it works for me.

?filelen(CurrentDb.Name)
909312
docmd.CopyObject CurrentDb.Name,"test1",acTable,"Table1"
?filelen(CurrentDb.Name)
925696


Works as advertised if you open the file yourself:

Function testfilelen()
Const cstrFile As String = "test.tmp"
Open cstrFile For Output As #1
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Close #1
End Function

0 0
0 1026
0 2052
0 3078

BTW, if anyone wants to open the current database and check LOF() then
open it for input (or binary), not output, that will fail, it will
also fail if the database is opened exclusively.

e.g.
Open CurrentDb.Name For Binary Access Read Shared As #1

--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #7
Thanks for all the help - will try it out.

Bill

Trevor Best <bouncer@localhost> wrote in message news:<b2********************************@4ax.com>. ..
On Thu, 08 Jan 2004 07:56:56 +0000 in comp.databases.ms-access, Trevor
Best <bouncer@localhost> wrote:
On Wed, 07 Jan 2004 23:42:03 GMT in comp.databases.ms-access, "PC
Datasheet" <sp**@nospam.spam> wrote:
FileLen gives the size of the file before it was opened - this is not what the
poster asked for. FileLen does not include the additional bytes added to the
file in the open session. The poster needs the LOF function.

From the Help file ---

Remarks

If the specified file is open when the FileLen function is called, the value
returned represents the size of the file immediately before it was opened.

Note To obtain the length of an open file, use the LOF function.


Well it doesn't do what it says on the tin because it works for me.

?filelen(CurrentDb.Name)
909312
docmd.CopyObject CurrentDb.Name,"test1",acTable,"Table1"
?filelen(CurrentDb.Name)
925696


Works as advertised if you open the file yourself:

Function testfilelen()
Const cstrFile As String = "test.tmp"
Open cstrFile For Output As #1
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Close #1
End Function

0 0
0 1026
0 2052
0 3078

BTW, if anyone wants to open the current database and check LOF() then
open it for input (or binary), not output, that will fail, it will
also fail if the database is opened exclusively.

e.g.
Open CurrentDb.Name For Binary Access Read Shared As #1

Nov 12 '05 #8
Tried but failed!
My database is called remote reports.mdb
I am working within that on a form and have tried to use
filelen("remote reports.mdb") as the control source for a textbox so
that it will display the current size of the db but this results in
#Name? in the textbox. Have I got the wrong end of the stick? If I try
using LOF(n) what do I put for the n if I want to refer to the db
itself?

Have also tried coding behind the form in VBA but not getting
anywhere.

Sorry to be such a durr brain.

Bill
bi**@piperb.freeserve.co.uk (Bill) wrote in message news:<aa*************************@posting.google.c om>...
Thanks for all the help - will try it out.

Bill

Trevor Best <bouncer@localhost> wrote in message news:<b2********************************@4ax.com>. ..
On Thu, 08 Jan 2004 07:56:56 +0000 in comp.databases.ms-access, Trevor
Best <bouncer@localhost> wrote:
On Wed, 07 Jan 2004 23:42:03 GMT in comp.databases.ms-access, "PC
Datasheet" <sp**@nospam.spam> wrote:

>FileLen gives the size of the file before it was opened - this is not what the
>poster asked for. FileLen does not include the additional bytes added to the
>file in the open session. The poster needs the LOF function.
>
>From the Help file ---
>
>Remarks
>
>If the specified file is open when the FileLen function is called, the value
>returned represents the size of the file immediately before it was opened.
>
>Note To obtain the length of an open file, use the LOF function.

Well it doesn't do what it says on the tin because it works for me.

?filelen(CurrentDb.Name)
909312
docmd.CopyObject CurrentDb.Name,"test1",acTable,"Table1"
?filelen(CurrentDb.Name)
925696


Works as advertised if you open the file yourself:

Function testfilelen()
Const cstrFile As String = "test.tmp"
Open cstrFile For Output As #1
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Close #1
End Function

0 0
0 1026
0 2052
0 3078

BTW, if anyone wants to open the current database and check LOF() then
open it for input (or binary), not output, that will fail, it will
also fail if the database is opened exclusively.

e.g.
Open CurrentDb.Name For Binary Access Read Shared As #1

Nov 12 '05 #9
TC
On the previously stated principle of succinctness, your answer surely
should have been:

LOF

:-)
TC
"PC Datasheet" <sp**@nospam.spam> wrote in message
news:fP*******************@newsread3.news.atl.eart hlink.net...
FileLen gives the size of the file before it was opened - this is not what the poster asked for. FileLen does not include the additional bytes added to the file in the open session. The poster needs the LOF function.

From the Help file ---

Remarks

If the specified file is open when the FileLen function is called, the value returned represents the size of the file immediately before it was opened.

Note To obtain the length of an open file, use the LOF function.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Trevor Best" <bouncer@localhost> wrote in message
news:4k********************************@4ax.com...
On 7 Jan 2004 13:50:07 -0800 in comp.databases.ms-access,
bi**@piperb.freeserve.co.uk (Bill) wrote:
Using A2000
I am using mini-databases residing on floppy disks for writing school
reports which can then be sent to a central db for electronic
collating. Occasionally the database has grown past the 1.38Mb
possible on disk and this has crashed the whole database into an un
recoverable state, losing data if not backed up. Is there access to
the size of the database within the db as a VB function so that I can
trigger a warning when moving from record to record if the db is
getting near the limit?


FileLen(CurrentDb.Name)

--
A)bort, R)etry, I)nfluence with large hammer.


Nov 12 '05 #10
On 8 Jan 2004 15:17:42 -0800 in comp.databases.ms-access,
bi**@piperb.freeserve.co.uk (Bill) wrote:
Tried but failed!
My database is called remote reports.mdb
I am working within that on a form and have tried to use
filelen("remote reports.mdb") as the control source for a textbox so
that it will display the current size of the db but this results in
#Name? in the textbox. Have I got the wrong end of the stick?
Did you put the equals sign in the control source, e.g.

=filelen(...

mind you I wouldn't bank on the function running from the same
directory that the database is in, you might need to code in an
absolute path but then that wouldn't work if you moved the database..
If I try
using LOF(n) what do I put for the n if I want to refer to the db
itself?
You'd need to open the database using the "Open" statement, as I said
before this will fail if you have the database opened exclusively, so
I wouldn't bother with that.
Have also tried coding behind the form in VBA but not getting
anywhere.


Try setting setting the controlsource to:

=DbSize()

Then in a public module:

public function DbSize()
DbSize=filelen(currentdb.name)
end function
--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #11
Suggest do not use this code:
filelen("remote reports.mdb")

Use this statement instead:
filelen(CurrentDb.Name)

See if that will work.
"Bill" <bi**@piperb.freeserve.co.uk> wrote in message
news:aa**************************@posting.google.c om...
Tried but failed!
My database is called remote reports.mdb
I am working within that on a form and have tried to use
filelen("remote reports.mdb") as the control source for a textbox so
that it will display the current size of the db but this results in
#Name? in the textbox. Have I got the wrong end of the stick? If I try
using LOF(n) what do I put for the n if I want to refer to the db
itself?

Have also tried coding behind the form in VBA but not getting
anywhere.

Sorry to be such a durr brain.

Bill
bi**@piperb.freeserve.co.uk (Bill) wrote in message

news:<aa*************************@posting.google.c om>...
Thanks for all the help - will try it out.

Bill

Trevor Best <bouncer@localhost> wrote in message news:<b2********************************@4ax.com>. ..
On Thu, 08 Jan 2004 07:56:56 +0000 in comp.databases.ms-access, Trevor
Best <bouncer@localhost> wrote:

>On Wed, 07 Jan 2004 23:42:03 GMT in comp.databases.ms-access, "PC
>Datasheet" <sp**@nospam.spam> wrote:
>
>>FileLen gives the size of the file before it was opened - this is not what the >>poster asked for. FileLen does not include the additional bytes added to the >>file in the open session. The poster needs the LOF function.
>>
>>From the Help file ---
>>
>>Remarks
>>
>>If the specified file is open when the FileLen function is called, the value >>returned represents the size of the file immediately before it was opened. >>
>>Note To obtain the length of an open file, use the LOF function.
>
>Well it doesn't do what it says on the tin because it works for me.
>
>?filelen(CurrentDb.Name)
> 909312
>docmd.CopyObject CurrentDb.Name,"test1",acTable,"Table1"
>?filelen(CurrentDb.Name)
> 925696

Works as advertised if you open the file yourself:

Function testfilelen()
Const cstrFile As String = "test.tmp"
Open cstrFile For Output As #1
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Print #1, String(1024, "x")
Debug.Print FileLen(cstrFile), LOF(1)
Close #1
End Function

0 0
0 1026
0 2052
0 3078

BTW, if anyone wants to open the current database and check LOF() then
open it for input (or binary), not output, that will fail, it will
also fail if the database is opened exclusively.

e.g.
Open CurrentDb.Name For Binary Access Read Shared As #1

Nov 12 '05 #12
Hoorah!

Thanks very much - this has worked and I can now flash up a warning
msgbox if the size gets critical

Another happy customer.

Bill

Trevor Best <bouncer@localhost> wrote in message news:<ve********************************@4ax.com>. ..
On 8 Jan 2004 15:17:42 -0800 in comp.databases.ms-access,
bi**@piperb.freeserve.co.uk (Bill) wrote:
Tried but failed!
My database is called remote reports.mdb
I am working within that on a form and have tried to use
filelen("remote reports.mdb") as the control source for a textbox so
that it will display the current size of the db but this results in
#Name? in the textbox. Have I got the wrong end of the stick?


Did you put the equals sign in the control source, e.g.

=filelen(...

mind you I wouldn't bank on the function running from the same
directory that the database is in, you might need to code in an
absolute path but then that wouldn't work if you moved the database..
If I try
using LOF(n) what do I put for the n if I want to refer to the db
itself?


You'd need to open the database using the "Open" statement, as I said
before this will fail if you have the database opened exclusively, so
I wouldn't bother with that.
Have also tried coding behind the form in VBA but not getting
anywhere.


Try setting setting the controlsource to:

=DbSize()

Then in a public module:

public function DbSize()
DbSize=filelen(currentdb.name)
end function

Nov 12 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Astra | last post by:
Hi All I've noticed on quite a few ASP sites that when they have a 'MyAccount' section they transfer the site to https and then when you have logged into your account successfully and gone back...
3
by: LC | last post by:
hi, i worry about people doing something they shouldn't to my db and I would like to track any structural changes (who and which)to my db. I am using oracle 8.0.6.0.0 and 9.2.0.2.0. regards,...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
9
by: Alfred Taylor | last post by:
I'm testing the waters of n-tier development and I ran into a scenario that I'm not sure what the best solution would be. I have a Company object which contains a collection of contacts retrieved...
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
0
by: Utter Newbie | last post by:
I know we have access to log files and web statistics can be pulled from those. But the guy who wants it built was thinking we should keep track of every time a page is hit seperately in MS sql...
2
by: metaperl | last post by:
I'm actually taking Microsoft's 2779 and just finished a lab where we kept track of our changes to the database. However, I'm not happy with the scripts interface because it does not tell me the...
2
by: De_Cisse | last post by:
Hi all, I'm working on an application in which I already make some preparations to be able to work in a frontend and backend database, even if this isn't the issue a this moment. I'm using VBA...
0
by: jehugaleahsa | last post by:
On Jun 13, 3:09 pm, "Bob Powell " <b...@spamkillerbobpowell.net> wrote: I apologize for the size. I should have probably put this on a blog or something. I'm not interested in tools. I...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.