B
BruceM
I have attempted to use the code at the MVP site for relinking tables at
startup. I placed the code in a standard module and called it from the Open
event of my startup form. However, when I tested by renaming the backend
database (the one to which the FE links), the code never had a chance to
run. Instead, a standard Access error message appeared: "Could not find
file '\\[Filename]'. The form's Open event never occurred. I chose the
Open event
because the code on the MVP site said to run the RefreshLinks function at db
startup. I took that to mean the first possible opportunity, which I had
thought was the startup form's Open event.
I modified the code (in the interest of full disclosure, I had help) because
I do not want to present the user with a dialog box for relinking. Most
users will have no idea what to do, so I am using a generic error message to
contact IT support. This means I did not add the API to open the standard
Windows File Open/Save dialog. I also eliminated the following function
from the Refresh Links code:
Function fGetMDBName(strIn As String) As String
'Calls GetOpenFileName dialog
Dim strFilter As String
strFilter = ahtAddFilterItem(strFilter, _
"Access Database(*.mdb;*.mda;*.mde;*.mdw) ", _
"*.mdb; *.mda; *.mde; *.mdw")
strFilter = ahtAddFilterItem(strFilter, _
"All Files (*.*)", _
"*.*")
fGetMDBName = ahtCommonFileOpenSave(Filter:=strFilter, _
OpenFile:=True, _
DialogTitle:=strIn, _
Flags:=ahtOFN_HIDEREADONLY)
End Function
Considering that when the link is not good, no code runs, I can't see that
leaving out code could affect anything. I could provide more details, but I
don't know which ones would be helpful. Does anybody have an idea as to
what I need to do differently?
startup. I placed the code in a standard module and called it from the Open
event of my startup form. However, when I tested by renaming the backend
database (the one to which the FE links), the code never had a chance to
run. Instead, a standard Access error message appeared: "Could not find
file '\\[Filename]'. The form's Open event never occurred. I chose the
Open event
because the code on the MVP site said to run the RefreshLinks function at db
startup. I took that to mean the first possible opportunity, which I had
thought was the startup form's Open event.
I modified the code (in the interest of full disclosure, I had help) because
I do not want to present the user with a dialog box for relinking. Most
users will have no idea what to do, so I am using a generic error message to
contact IT support. This means I did not add the API to open the standard
Windows File Open/Save dialog. I also eliminated the following function
from the Refresh Links code:
Function fGetMDBName(strIn As String) As String
'Calls GetOpenFileName dialog
Dim strFilter As String
strFilter = ahtAddFilterItem(strFilter, _
"Access Database(*.mdb;*.mda;*.mde;*.mdw) ", _
"*.mdb; *.mda; *.mde; *.mdw")
strFilter = ahtAddFilterItem(strFilter, _
"All Files (*.*)", _
"*.*")
fGetMDBName = ahtCommonFileOpenSave(Filter:=strFilter, _
OpenFile:=True, _
DialogTitle:=strIn, _
Flags:=ahtOFN_HIDEREADONLY)
End Function
Considering that when the link is not good, no code runs, I can't see that
leaving out code could affect anything. I could provide more details, but I
don't know which ones would be helpful. Does anybody have an idea as to
what I need to do differently?