473,401 Members | 2,068 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,401 software developers and data experts.

Kill file, how to find out it it's available yet?

On each workstation there's a front end, when the front end opens it checks
a 'version number' held in a table of properties against the version number
in a copy of the front end held on the server. If it's the same it opens
normally. If not it shells out to an UpdateClient.mdb and quits. The
UpdateClient.mdb overwrites the FE on the workstation with the one on the
server. But I was getting an access error (70, I think). Presuming that the
FE hadn't actually closed fully when UpdateClient.mdb was trying to
overwrite it I did this:

Dim intTime As Single
350 intTime = Timer
360 Do While Timer < intTime + 10
370 DoEvents
380 Loop

390 Kill sLocalClientPath

400 FileCopy sNetworkClientPath, sLocalClientPath

It works fine, but is there a more elegant way? 10 seconds should be enough,
but most of the time will be too long, leaving the users sat at their
machines, and sometime might be too long.

I thought about trapping for error 70 and trying again, but then thought
that if there really is a 'genuine' access error, like the FE won't close or
something, then there will be an endless loop.

TIA, Mike MacSween
Nov 12 '05 #1
12 3740
Try michka's TSOON utility (Trigeminal Shut-One, Open-Next) from:
www.trigeminal.com

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f***********************@pubnews.gradwell.ne t...
On each workstation there's a front end, when the front end opens it checks a 'version number' held in a table of properties against the version number in a copy of the front end held on the server. If it's the same it opens
normally. If not it shells out to an UpdateClient.mdb and quits. The
UpdateClient.mdb overwrites the FE on the workstation with the one on the
server. But I was getting an access error (70, I think). Presuming that the FE hadn't actually closed fully when UpdateClient.mdb was trying to
overwrite it I did this:

Dim intTime As Single
350 intTime = Timer
360 Do While Timer < intTime + 10
370 DoEvents
380 Loop

390 Kill sLocalClientPath

400 FileCopy sNetworkClientPath, sLocalClientPath

It works fine, but is there a more elegant way? 10 seconds should be enough, but most of the time will be too long, leaving the users sat at their
machines, and sometime might be too long.

I thought about trapping for error 70 and trying again, but then thought
that if there really is a 'genuine' access error, like the FE won't close or something, then there will be an endless loop.

TIA, Mike MacSween

Nov 12 '05 #2
"Allen Browne" <al*********@SeeSig.invalid> wrote in message
news:Si*********************@news-server.bigpond.net.au...
Try michka's TSOON utility (Trigeminal Shut-One, Open-Next) from:
www.trigeminal.com


Yes, thanks Allen. I actually tried that, and Tony's FE updater too, but
couldn't get either of them to work. Thanks to both of those for providing
those, but in the end I thought I'd just do it myself. A bit of a 'learn
through experience' approach.

I do actually like the idea of doing this completely in Access too. I know
msaccess.exe will be on the machines, so there's no need to think about
whether the VB run time is there, or registering dlls.

Of course there's no reason to think that anything I write will be any
better than either of those (quite the opposite, in fact!), but as both of
them are unsupported (I think) I didn't want to hassle the writers.

Cheers, Mike
Nov 12 '05 #3
Check to see whether the LDB file exists.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f***********************@pubnews.gradwell.ne t...
On each workstation there's a front end, when the front end opens it checks a 'version number' held in a table of properties against the version number in a copy of the front end held on the server. If it's the same it opens
normally. If not it shells out to an UpdateClient.mdb and quits. The
UpdateClient.mdb overwrites the FE on the workstation with the one on the
server. But I was getting an access error (70, I think). Presuming that the FE hadn't actually closed fully when UpdateClient.mdb was trying to
overwrite it I did this:

Dim intTime As Single
350 intTime = Timer
360 Do While Timer < intTime + 10
370 DoEvents
380 Loop

390 Kill sLocalClientPath

400 FileCopy sNetworkClientPath, sLocalClientPath

It works fine, but is there a more elegant way? 10 seconds should be enough, but most of the time will be too long, leaving the users sat at their
machines, and sometime might be too long.

I thought about trapping for error 70 and trying again, but then thought
that if there really is a 'genuine' access error, like the FE won't close or something, then there will be an endless loop.

TIA, Mike MacSween

Nov 12 '05 #4
"Mike MacSween" <mi******************@btinternet.com> wrote in
news:3f***********************@pubnews.gradwell.ne t:
On each workstation there's a front end, when the front end
opens it checks a 'version number' held in a table of
properties against the version number in a copy of the front
end held on the server. If it's the same it opens normally. If
not it shells out to an UpdateClient.mdb and quits. The
UpdateClient.mdb overwrites the FE on the workstation with the
one on the server. But I was getting an access error (70, I
think). Presuming that the FE hadn't actually closed fully
when UpdateClient.mdb was trying to overwrite it I did this:

Dim intTime As Single
350 intTime = Timer
360 Do While Timer < intTime + 10
370 DoEvents
380 Loop

390 Kill sLocalClientPath

400 FileCopy sNetworkClientPath, sLocalClientPath

It works fine, but is there a more elegant way? 10 seconds
should be enough, but most of the time will be too long,
leaving the users sat at their machines, and sometime might be
too long.

I thought about trapping for error 70 and trying again, but
then thought that if there really is a 'genuine' access error,
like the FE won't close or something, then there will be an
endless loop.

TIA, Mike MacSween
I use error trapping within a loop with a counter

Dim iRetries as integer
iRetries = 0
390 Kill sLocalClientPath

On Error goto HandleMyError70
400 FileCopy sNetworkClientPath, sLocalClientPath
On Error goto GenericErrorHandler

HandleMyError70:
if .errNo = 70 then
iRetries = iRetries+1
intTime = timer
do while Timer <intTime+ 100 ' 100 ms
DoEvents
loop
If iRetries >99 '10 seconds + a litle
MessageBox "TimeOut Error"
'bail out however you want.
else
Resume 're-execute the line where error occurred
end if
end if

Bob Q
Nov 12 '05 #5
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:nq********************@news02.bloor.is.net.ca ble.rogers.com...
Check to see whether the LDB file exists.


Yes, that's a thought. As a matter of fact I seem to have a problem (?) with
the back end of this app where the ldb file is being left open, after all
the users are out. It seems to be happening consistently now since I... ah!
I've just changed permissions on the back end folder. To read write only, I
think. Would that do that? Do I need read write and modify?

Cheers, Mike
Nov 12 '05 #6
Thanks Bob. Yes, I was thinking something along those lines myself. I'll
give it a go.

Only awkward thing is I've written this superb updater (!) to update the FE
from the server. Unfortunately this code is in the actual updating mdb,
which can't be updated remotely. Doh!

Mike

"Bob Quintal" <bq******@generation.net> wrote in message
news:db******************************@news.teranew s.com...
"Mike MacSween" <mi******************@btinternet.com> wrote in
news:3f***********************@pubnews.gradwell.ne t:
On each workstation there's a front end, when the front end
opens it checks a 'version number' held in a table of
properties against the version number in a copy of the front
end held on the server. If it's the same it opens normally. If
not it shells out to an UpdateClient.mdb and quits. The
UpdateClient.mdb overwrites the FE on the workstation with the
one on the server. But I was getting an access error (70, I
think). Presuming that the FE hadn't actually closed fully
when UpdateClient.mdb was trying to overwrite it I did this:

Dim intTime As Single
350 intTime = Timer
360 Do While Timer < intTime + 10
370 DoEvents
380 Loop

390 Kill sLocalClientPath

400 FileCopy sNetworkClientPath, sLocalClientPath

It works fine, but is there a more elegant way? 10 seconds
should be enough, but most of the time will be too long,
leaving the users sat at their machines, and sometime might be
too long.

I thought about trapping for error 70 and trying again, but
then thought that if there really is a 'genuine' access error,
like the FE won't close or something, then there will be an
endless loop.

TIA, Mike MacSween


I use error trapping within a loop with a counter

Dim iRetries as integer
iRetries = 0
390 Kill sLocalClientPath

On Error goto HandleMyError70
400 FileCopy sNetworkClientPath, sLocalClientPath
On Error goto GenericErrorHandler

HandleMyError70:
if .errNo = 70 then
iRetries = iRetries+1
intTime = timer
do while Timer <intTime+ 100 ' 100 ms
DoEvents
loop
If iRetries >99 '10 seconds + a litle
MessageBox "TimeOut Error"
'bail out however you want.
else
Resume 're-execute the line where error occurred
end if
end if

Bob Q

Nov 12 '05 #7
"Mike MacSween" <mi******************@btinternet.com> wrote:
Tony's FE updater too, but
couldn't get either of them to work.


What was the problem?

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 #8
"Tony Toews" <tt****@telusplanet.net> wrote in message
news:qa********************************@4ax.com...
"Mike MacSween" <mi******************@btinternet.com> wrote:
Tony's FE updater too, but
couldn't get either of them to work.


It's a bit late, but as far as I can remember lot's of 'file not found' type
messages. To tell the truth I was having trouble understanding what went
where. I'll have another go when I've got time and post if I have problems.

Cheers, Mike MacSween
Nov 12 '05 #9

"Mike MacSween" <mi******************@btinternet.com> wrote in message
news:3f***********************@pubnews.gradwell.ne t...
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:nq********************@news02.bloor.is.net.ca ble.rogers.com...
Check to see whether the LDB file exists.
Yes, that's a thought. As a matter of fact I seem to have a problem (?)

with the back end of this app where the ldb file is being left open, after all
the users are out. It seems to be happening consistently now since I... ah! I've just changed permissions on the back end folder. To read write only, I think. Would that do that? Do I need read write and modify?


Your users need Change (RWXD) on the folder where the MDB exists. The last
user to log out of the database needs to be able to delete the LDB.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)


Nov 12 '05 #10
I have a slightly different way to do this. It attempts to lock the
file for writing (the key line is "Open filename For Binary Lock Read
As #tmp"). If it can't open the file for writing, it will pop up a
messagebox.
'copy is too awful to attempt to claim
'feel free to copy, modify, and claim it's your own
Private Sub waitForSourceFileToClose(filename As String)
On Error GoTo sub_Error
Dim startTime As Date
Dim tmp As Long
Dim finished As Boolean
startTime = Now()

tmp = FreeFile
finished = False

Do While finished = False
finished = True
Open filename For Binary Lock Read As #tmp
Close #tmp

If finished = False And DateDiff("s", startTime, Now()) >= 15
Then
If MsgBox("Waiting for file '" & filename & "' to close.
" & _
"Wait another 15 seconds for it to free up? (check and
ensure all other " & _
"Access databases are closed at this time)", vbYesNo,
"Cannot Open File") = vbYes Then

startTime = Now()
Else
Err.Raise vbObjectError + 1, "Update Procedure", _
"The source MDB file is not available for copying at
this time. Filename: " & filename
End If
End If
Loop

sub_Exit:
Exit Sub

sub_Error:
If Err.Number = 70 Then
finished = False
Resume Next
Else
MsgBox Err.Number & " " & Err.Description
Resume sub_Exit
End If
End Sub
Nov 12 '05 #11
"Mike MacSween" <mi******************@btinternet.com> wrote:
>Tony's FE updater too, but
>couldn't get either of them to work.


It's a bit late, but as far as I can remember lot's of 'file not found' type
messages. To tell the truth I was having trouble understanding what went
where. I'll have another go when I've got time and post if I have problems.


There is one parameter in the INI file which, in hindsight, really doesn't make a lot
of sense. I will be renaming that one and splitting it up as soon as I possibly can.
As well as adding a forms based wizard.

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 #12
"Tony Toews" <tt****@telusplanet.net> wrote in message
news:88********************************@4ax.com...
"Mike MacSween" <mi******************@btinternet.com> wrote:
>Tony's FE updater too, but
>couldn't get either of them to work.
It's a bit late, but as far as I can remember lot's of 'file not found' typemessages. To tell the truth I was having trouble understanding what went
where. I'll have another go when I've got time and post if I have

problems.
There is one parameter in the INI file which, in hindsight, really doesn't make a lot of sense. I will be renaming that one and splitting it up as soon as I possibly can. As well as adding a forms based wizard.


That would be great. I'm sure it's good, but brains here couldn't work out
how to make it work.

Cheers, Mike
Nov 12 '05 #13

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

Similar topics

6
by: Bob Swerdlow | last post by:
My application starts up a number of processes for various purposes using: self.popen = popen2.Popen3("/usr/local/bin/python -O "myscript.py") and then shuts them down when appropriate with...
37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
0
by: Markus Poehler | last post by:
Hi my program should run on terminal server. I open Acrobat process and I have to kill them at some points in my application. This fails cause of insufficient rights on terminal server. the...
12
by: Steve | last post by:
AccessXP in Access2000 mode I have the following code outline in a standard module in MyDatabase.mdb --- Use CreateDatabase to create MyOtherDatabase.mdb Use two make table queries to create...
7
by: David Mitchell | last post by:
I use a function to read all of the files from a couple of directories (and subfolders) and update a table(tblfiles) with the fullpath and file name, the filesize and the date the file was created....
0
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a...
5
by: Dino Buljubasic | last post by:
My application can allow a user to open a file for viewing by fetching file data from database, creating the file in a temp directory and starting appropriate process (i.e. Adobe or any other...
13
by: Goofy | last post by:
Does anyone know how I can kill a session by session ID ? -- Goofy
3
by: spectrumdt | last post by:
Hello. I am running Fedora Linux and KDE, using the Konsole command line. When coding Python, I regularly make a bug causing my program to not terminate. But how do I kill the non-terminating...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.