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

Reconneecting to BE after network drops out

MS
A97

At work we have a badly set up network. The boss won't spend any money.
Basically there are about 10 computers on a LAN. One computer is used to
store most of our data - it is not a true server.

I have made a heap of FE/BE databses with the data being stored on this
central computer. Because of the undisciplined networking, connections are
frequently broken resulting in the FE's being used at the time having to be
closed and reopened when the network resource is available again.

Is there a way of (say) closing all the forms of the FE application being
used, reconnecting to the BE and continuing without having to close the
Access application in task manager?

Cheers!
Nov 13 '05 #1
2 1489
Here are some functions to close all forms, disconnect all tables,
connect them all again. I haven't tried them after a broken network
connection - I use them to switch between a development and a
production environment - but think they should work.
Assuming you can trap the error when it occurs and call them.
Your boss's attitude is false economy.
The big worry with faulty networks is that they will eventually corrupt
your backends.
If you're lucky you'll be able to repair them; if you're not, your boss
will lose his data.
Terry Bell
Melbourne
Function CloseAllForms(Optional except)
Dim frm As Form, intI As Integer, i As Integer
Dim intJ As Integer, ExceptForm
Dim intControls As Integer, intforms As Integer
intforms = Forms.Count ' Number of open forms.
If IsMissing(except) Then
ExceptForm = ""
Else
ExceptForm = except
End If

For i = Forms.Count - 1 To 0 Step -1
If Forms(i).Name <> ExceptForm Then
DoCmd.Close acForm, Forms(i).Name
End If
Next i
End Function

Public Function DetachAllTables()
Dim db As Database, BackEndDb As Database, tbl As TableDef, x
SysCmd acSysCmdSetStatus, "Detaching Tables"
Set db = CurrentDb()
For Each tbl In db.TableDefs
If tbl.Attributes = dbAttachedTable Then
SysCmd acSysCmdSetStatus, "Detaching " & tbl.Name
DropTable tbl.Name
End If
Next
db.TableDefs.Refresh
End Function

Public Function AttachAllTablesIn(DBPath)
Dim db As Database, BackEndDb As Database, tbl As TableDef, x
'Open the backend database and connect all the tables
Set BackEndDb = DBEngine(0).OpenDatabase(DBPath)
For Each tbl In BackEndDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" Then 'Don't attach hidden system
tables
SysCmd acSysCmdSetStatus, "Attaching " & tbl.Name
AttachTable tbl.Name, CurrentDb(), DBPath
End If
Next
CurrentDb().TableDefs.Refresh
SysCmd acSysCmdClearStatus
End Function

Public Sub DropTable(TableName)
Dim db As Database
Set db = CurrentDb()
On Error Resume Next 'Ignore errors
db.TableDefs.Delete TableName
'DoCmd.DeleteObject acTable, TableName SLOW!!!!!
On Error GoTo 0 'Resume normal error handling
db.TableDefs.Refresh
End Sub

Private Sub AttachTable(tblx As String, db As Database, DBPath)
Dim tbl As TableDef
db.TableDefs.Refresh
Set tbl = db.CreateTableDef(tblx)
tbl.Connect = ";DATABASE=" & DBPath
tbl.SourceTableName = tblx
db.TableDefs.Append tbl
db.TableDefs.Refresh
End Sub

Nov 13 '05 #2
MS

<dr**********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Here are some functions to close all forms, disconnect all tables,
connect them all again. I haven't tried them after a broken network
connection - I use them to switch between a development and a
production environment - but think they should work.
Assuming you can trap the error when it occurs and call them.
Your boss's attitude is false economy.
The big worry with faulty networks is that they will eventually corrupt
your backends.
If you're lucky you'll be able to repair them; if you're not, your boss
will lose his data.
Terry Bell
Melbourne
Function CloseAllForms(Optional except)
Dim frm As Form, intI As Integer, i As Integer
Dim intJ As Integer, ExceptForm
Dim intControls As Integer, intforms As Integer
intforms = Forms.Count ' Number of open forms.
If IsMissing(except) Then
ExceptForm = ""
Else
ExceptForm = except
End If

For i = Forms.Count - 1 To 0 Step -1
If Forms(i).Name <> ExceptForm Then
DoCmd.Close acForm, Forms(i).Name
End If
Next i
End Function

Public Function DetachAllTables()
Dim db As Database, BackEndDb As Database, tbl As TableDef, x
SysCmd acSysCmdSetStatus, "Detaching Tables"
Set db = CurrentDb()
For Each tbl In db.TableDefs
If tbl.Attributes = dbAttachedTable Then
SysCmd acSysCmdSetStatus, "Detaching " & tbl.Name
DropTable tbl.Name
End If
Next
db.TableDefs.Refresh
End Function

Public Function AttachAllTablesIn(DBPath)
Dim db As Database, BackEndDb As Database, tbl As TableDef, x
'Open the backend database and connect all the tables
Set BackEndDb = DBEngine(0).OpenDatabase(DBPath)
For Each tbl In BackEndDb.TableDefs
If Left(tbl.Name, 4) <> "MSys" Then 'Don't attach hidden system
tables
SysCmd acSysCmdSetStatus, "Attaching " & tbl.Name
AttachTable tbl.Name, CurrentDb(), DBPath
End If
Next
CurrentDb().TableDefs.Refresh
SysCmd acSysCmdClearStatus
End Function

Public Sub DropTable(TableName)
Dim db As Database
Set db = CurrentDb()
On Error Resume Next 'Ignore errors
db.TableDefs.Delete TableName
'DoCmd.DeleteObject acTable, TableName SLOW!!!!!
On Error GoTo 0 'Resume normal error handling
db.TableDefs.Refresh
End Sub

Private Sub AttachTable(tblx As String, db As Database, DBPath)
Dim tbl As TableDef
db.TableDefs.Refresh
Set tbl = db.CreateTableDef(tblx)
tbl.Connect = ";DATABASE=" & DBPath
tbl.SourceTableName = tblx
db.TableDefs.Append tbl
db.TableDefs.Refresh
End Sub

Tnak you, I'll try them out.

I keep a daily copy of the BEs just in case.
Nov 13 '05 #3

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

Similar topics

2
by: Greg Buckley | last post by:
I have come across an interesting problem. Let me first state that I am not a fluent ASP programmer. I am a network engineering trying to port an existing app. The app in question is currently...
0
by: Alan Dunlop | last post by:
Anyone able to help with this one? I used to be able to switch users and hold up the connection to my ISP before upgrading to Office 2003. Now it doesn't ask it just drops the connection as soon...
4
by: cvopicka | last post by:
i have found many refrences to access being slow over a netowrk but my boss and i just found this and i was hoping to get some help. on the local machine we have the Access 2000 format database...
7
by: nydiroth | last post by:
Our servers went down for over 6 hours yesterday and I was asked if there was a way to store the database on the server and a local station at the same time. My datbase is split and the tables...
11
by: Richard Myers | last post by:
Hello Im sure many of you have seen this error message before: For us its the third time this year. This error occurs seemingly at random. I have no idea what causes it too happen. None....
1
by: Sean Wolfe | last post by:
I have this wierd bizarrre problem that I'm experienceing with the Response.Redirect() method. I have a site where the users are on a particular page in SSL. When they post the data back, and...
3
by: Tego | last post by:
I have a main ASPX page that loads HTML pages into it. If the HTML page contains characters like the (R) registered or (C) or apostrophe then these characters are replaced (usualy with a question...
0
by: WKsp21 | last post by:
HI , i'm woking with a FujitsuSiemens Loox720 with Wifi. I want to use FTP for up & downloading files. But very often my network connection is broken. does anybody know how i can detect if the...
3
by: Jason | last post by:
Hi, I am working on a project to move my mailing tool to support Multi Languages including Chinese and Hebrew. To do this I have added the following code to the Message object...
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: 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,...

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.