Just hold the shift key down when opening the database and then go immediately and do the linked table manager. You can't change the values in the system table directly anyway.Thanks. I have changed the name of the back end. I used the Link Table Manager to link all tables, but on startup I get the error message 'Cannot find file...' and then the OLD name of the back end. So somewhere it is not getting changed. I was hoping to find where the back end name is stored, and change it.
Just hold the shift key down when opening the database and then go immediately and do the linked table manager. You can't change the values in the system table directly anyway.
Private Sub Form_Open(Cancel As Integer)
Dim tbl As TableDef
Dim x As Long, MaxX As Long
Dim tblDB As String
Me.Visible = False
tblDB = myFolder & "Database\Your_be.mdb"
If Dir(tblDB) = "" Then
MsgBox "No table database has been found, " & vbCr & vbCr & _
"This application will not work, so its beeing closed", vbCritical
Application.Quit
End If
MaxX = 1 ' first count all attached tables
For Each tbl In CurrentDb.TableDefs()
If tbl.Attributes = dbAttachedTable Then MaxX = MaxX + 1
Next tbl
x = 1 ' Now update them
For Each tbl In CurrentDb.TableDefs()
If tbl.Attributes = dbAttachedTable Then
tblDB = myFolder & Mid(tbl.Connect, InStr(1, tbl.Connect, "Database\"))
If tbl.Connect <> ";Database=" & tblDB Then
Me.Visible = True
Me.Repaint
tbl.Connect = ";Database=" & tblDB
tbl.RefreshLink
End If
x = x + 1
End If
Me.Fill.Width = x / MaxX * Me.FillTo.Width
Next tbl
If Me.Visible Then
Me.lblWait.Caption = "Done relinking ... "
Me.Repaint
MaxX = Timer + 2
Do While Timer <= MaxX
Loop
End If
DoCmd.OpenForm "frmMain"
DoCmd.Close acForm, Me.Name
End Sub
Function myFolder()
myFolder = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
End Function
But you can change the linked table source...
I have a form with 2 boxes on it... along with this code which runs on open
I am sure you can addapt this to your needsCode:Private Sub Form_Open(Cancel As Integer) Dim tbl As TableDef Dim x As Long, MaxX As Long Dim tblDB As String Me.Visible = False tblDB = myFolder & "Database\Your_be.mdb" If Dir(tblDB) = "" Then MsgBox "No table database has been found, " & vbCr & vbCr & _ "This application will not work, so its beeing closed", vbCritical Application.Quit End If MaxX = 1 ' first count all attached tables For Each tbl In CurrentDb.TableDefs() If tbl.Attributes = dbAttachedTable Then MaxX = MaxX + 1 Next tbl x = 1 ' Now update them For Each tbl In CurrentDb.TableDefs() If tbl.Attributes = dbAttachedTable Then tblDB = myFolder & Mid(tbl.Connect, InStr(1, tbl.Connect, "Database\")) If tbl.Connect <> ";Database=" & tblDB Then Me.Visible = True Me.Repaint tbl.Connect = ";Database=" & tblDB tbl.RefreshLink End If x = x + 1 End If Me.Fill.Width = x / MaxX * Me.FillTo.Width Next tbl If Me.Visible Then Me.lblWait.Caption = "Done relinking ... " Me.Repaint MaxX = Timer + 2 Do While Timer <= MaxX Loop End If DoCmd.OpenForm "frmMain" DoCmd.Close acForm, Me.Name End Sub Function myFolder() myFolder = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\")) End Function
![]()
line. i.e., MY full code version of this is (with the remmed out line in red):Code:tblDB = myFolder & Mid(tbl.Connect, InStr(1, tbl.Connect, "Database\"))
Private Sub Form_Open(Cancel As Integer)
Dim tbl As TableDef
Dim x As Long, MaxX As Long
Dim tblDB As String
Me.Visible = False
tblDB = myFolder & "\ORDERS_ReferenceLabs - be.mdb"
If Dir(tblDB) = "" Then
'tblDB = \\wm-icpmr\...
tblDB = myFolder & "\test\ORDERS_ReferenceLabs - be.mdb"
' MsgBox "No table database has been found, " & vbCr & vbCr & _
' "This application will not work, so its beeing closed", vbCritical
' Application.Quit
End If
MaxX = 1 ' first count all attached tables
For Each tbl In CurrentDb.TableDefs()
If tbl.Attributes = dbAttachedTable Then MaxX = MaxX + 1
Next tbl
x = 1 ' Now update them
For Each tbl In CurrentDb.TableDefs()
If tbl.Attributes = dbAttachedTable Then
[COLOR=Red]' tblDB = myFolder & Mid(tbl.Connect, InStr(1, tbl.Connect, "\"))[/COLOR]
If tbl.Connect <> ";Database=" & tblDB Then
Me.Visible = True
Me.Repaint
tbl.Connect = ";Database=" & tblDB
tbl.RefreshLink
End If
x = x + 1
End If
Me.Fill.Width = x / MaxX * Me.FillTo.Width
Next tbl
If Me.Visible Then
Me.lblWait.Caption = "Done... "
Me.Repaint
MaxX = Timer + 2
Do While Timer <= MaxX
Loop
End If
DoCmd.OpenForm "frmLogin"
DoCmd.Close acForm, Me.Name
End Sub
But you can change the linked table source...
I have a form with 2 boxes on it... along with this code which runs on open![]()
Option Compare Database
Private Sub Form_Open(Cancel As Integer)
Dim tbl As TableDef
Dim x As Long, MaxX As Long
Dim tblDB As String
Me.Visible = True
tblDB = myFolder & "Database\FR Leads_be.mdb"
If Dir(tblDB) = "" Then
MsgBox "No table database has been found, " & vbCr & vbCr & _
"This application will not work, so its being closed", vbCritical
Application.Quit
End If
MaxX = 1 ' first count all attached tables
For Each tbl In CurrentDb.TableDefs()
If tbl.Attributes = dbAttachedTable Then MaxX = MaxX + 1
Next tbl
x = 1 ' Now update them
For Each tbl In CurrentDb.TableDefs()
If tbl.Attributes = dbAttachedTable Then
tblDB = myFolder & Mid(tbl.Connect, InStr(1, tbl.Connect, "Database\"))
If tbl.Connect <> ";Database=" & tblDB Then
Me.Visible = True
Me.Repaint
tbl.Connect = ";Database=" & tblDB
tbl.RefreshLink
End If
x = x + 1
End If
Me.Fill.Width = x / MaxX * Me.FillTo.Width
Next tbl
If Me.Visible Then
Me.lblWait.Caption = "Done relinking ... "
Me.Repaint
MaxX = Timer + 2
Do While Timer <= MaxX
Loop
End If
DoCmd.OpenForm "frm_city"
DoCmd.Close acForm, Me.Name
End Sub
Function myFolder()
myFolder = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
End Function
Me.Fill.Width = x / MaxX * Me.FillTo.Width
Next tbl
If Me.Visible Then
Me.lblWait.Caption = "Done... "
Me.Repaint
MaxX = Timer + 2
Do While Timer <= MaxX
I noticed that there was the following lines in the code (lines 34-40), and I wasn't sure what their express purpose was. Could anyone give some clarification about this?
Code:Me.Fill.Width = x / MaxX * Me.FillTo.Width Next tbl If Me.Visible Then Me.lblWait.Caption = "Done... " Me.Repaint MaxX = Timer + 2 Do While Timer <= MaxX
Compile error: Method or data member not found
Me.Fill.Width = x / MaxX * Me.FillTo.Width
As an update, I attempted to run this code on the Form_Open event of the switchboard (as well as a data entry form). In both scenarios, I obtained the following error (highlighting line 34 of the code, specifically the bolded part below):
Would anyone have an idea of why the FillTo method may not exist? (As far as my internet searches have shown, the Fill method appears to exist.)
Thanks in advance!