Moving Access application to new server

Bigjayce

New member
Local time
Today, 22:05
Joined
Aug 10, 2007
Messages
8
Hi, I am currently installing a new network for a client and they have a custom written timesheet application running in Access. The application runs from one of the old PC's and I am trying to move it to the new server, as soon as you try to run it it stops saying you must locate the datatables which I have copied to the server.

I opened a new database then imported everything in to bypass the autoexec macro and found the following module:

Option Compare Database
Option Explicit

'default tables file location- "Office" node on net neighbourhood
Const strTablesFilepath = "\\office\database\timesheets\2000v1Tables.mdb"

Function AreTablesAttached() As Boolean
' Update connection information in attached tables.

Dim strFileName As String

Dim tdf As TableDef
Dim db As Database
Dim rst As Recordset

Set db = CurrentDb

AreTablesAttached = True

' Continue if attachments are broken.
On Error Resume Next

' Open attached table to see if connection information is correct.
Set rst = db.OpenRecordset("TimeSheetData")

' Exit if connection information is correct.
If Err.Number = 0 Then
rst.Close
Exit Function
Else
strFileName = strTablesFilepath
If Not Dir(strFileName) Then
MsgBox "You Must Locate the Data Tables"

DoCmd.OpenForm "frmGetTables", WindowMode:=acHidden
DoEvents

Forms!frmGetTables!dlgCommon.DialogTitle = "Please Locate Data File"
Forms!frmGetTables!dlgCommon.ShowOpen

strFileName = Forms!frmGetTables!dlgCommon.FileName
End If
End If

If strFileName = "" Then
GoTo Exit_Failed ' User pressed Cancel.
End If

' Loop through all tables, reattaching those with nonzero-length Connect strings.
For Each tdf In db.TableDefs
If Len(tdf.Connect) Then
tdf.Connect = ";DATABASE=" & strFileName
Err.Number = 0
tdf.RefreshLink
If Err.Number <> 0 Then


MsgBox Err.Description, , "Problem with linked Tables, check location or network connection"

AreTablesAttached = False
Exit Function
End If
End If
Next tdf
Exit Function

Exit_Failed:
MsgBox "You can't run this program until " & _
"you locate Data Tables", , "Tables Connection Failed"
AreTablesAttached = False

End Function

I changed the line Const strTablesFilepath = "\\office\database\timesheets\2000v1Tables.mdb"
to
Const strTablesFilepath = "\\192.168.2.30\database\timesheets\2000v1Tables.mdb"

But it still asks for the tables to be loaded, I'm new to access although I have used VBA a bit in Excel

Can anyone tell me what I'm doing wrong

Jayce
 
2003 sorry should have included that

Jayce
 
Ok, not trying to teach you how to suck eggs, but does the database disconnect itself from the tables each time, or do you have a load of linked tables in your database? If so, delete them and hopefully problem solved. If not, let me know and I will give you my email and I will have a look at it for you
 
I'd have to say ......HUH?? lol told you I was new to access lol
 

Users who are viewing this thread

Back
Top Bottom