Re: ACCESS97, try to relink reference to another MDB
- From: polite person <sitting@xxxxxxxx>
- Date: Sat, 25 Mar 2006 07:26:44 GMT
On 24 Mar 2006 15:25:17 -0800, lesperancer@xxxxxxxxxx wrote:
thanks for your input, but my function to change the path of the link
tables works fine, thats not the issue
my problem is the same as having outlook97 on one machine, and
outlook2000 on another machine - and not using late-binding when you
use outlook automation
when you move your application to the second machine, the reference to
outlook97 would be MISSING and you'd have to browse to the outlook2000
in my case, the reference is configurator.mdb, but in production, it's
in a different folder than in development, causing the MISSING
reference
polite person wrote:
On 24 Mar 2006 09:01:54 -0800, lesperancer@xxxxxxxxxx wrote:
I've got two MDBs, that due to size, security, etc, need to be kept
separate
quotation
configurator (there will be more of these in the future)
so within quotation.mdb,
I linked all the tables that configurator.mdb uses
I created a reference to configurator.mdbm using full path name
I open a 'configurator' form, and away to work I go
now this is in a development world, and when we move the application to
production, I'd like to change all the configurator.mdb references in
quotation.mdb to point to the production MDBs using
Public Sub linkReferences()
Dim ref As Reference
Dim lngRef As Long
Dim strPath As String
On Error GoTo fErr
For lngRef = Application.References.Count To 1 Step -1
Set ref = Application.References(lngRef)
If (Left(ref.FullPath, Len(devQuotrak)) = devQuotrak) Then
If (applicationPath <> devQuotrak) Then
strPath = applicationPath & Mid(ref.FullPath,
Len(devQuotrak) + 1, 99)
Application.References.Remove ref
Application.References.AddFromFile strPath
End If
End If
Set ref = Nothing
Next lngRef
fExit:
On Error Resume Next
Set ref = Nothing
Exit Sub
fErr:
errorLog "linkReferences"
Resume fExit
End Sub
but when I hit the line ' Application.References.Remove ref', I get a
message
cant enter break mode at this time
and the 'remove' and 'add' does not happen
why this error ?
what else can I do ?
If these are linked tables you change the links via the CONNECT property.
For example
Public Function Relink(path1$, path2$)
Dim DB As DATABASE
Dim tdef As TableDef
Dim temp$, resp
Dim OldConnectString$, NewConnectString$
'takes all attachments to file (full) path1 and re-point them to path2
'fails if anything is missing
Set DB = CurrentDb
For Each tdef In DB.TableDefs
OldConnectString = tdef.Connect
If Len("" & OldConnectString) > 0 And InStr(1, OldConnectString, ";DATABASE=") Then
temp = InStr(OldConnectString, path1)
If temp > 0 Then
NewConnectString = str1tostr2once(OldConnectString$, path1, path2)
tdef.Connect = NewConnectString
tdef.RefreshLink
End If
End If
Next tdef
End Function
Public Function str1tostr2once(f, A$, B$)
'because Access 97
Dim temp$, C$, i As Integer, la As Integer, lb As Integer
'in string F, replaces A by B first occurrence only
If IsNull(f) Then
str1tostr2once = ""
Exit Function
Else
temp$ = CStr(f)
la = Len(A$)
lb = Len(B$)
i = InStr(temp$, A$)
If i > 0 Then
temp$ = Left(temp$, i - 1) & B$ & Right(temp$, Len(temp$) - i - la + 1)
End If
str1tostr2once = temp$
End If
End Function
Well maybe if you didn't use references you wouldn't have the problem, but it's true that I don't
know what you are trying to do.
.
- Follow-Ups:
- Re: ACCESS97, try to relink reference to another MDB
- From: lesperancer
- Re: ACCESS97, try to relink reference to another MDB
- References:
- ACCESS97, try to relink reference to another MDB
- From: lesperancer
- Re: ACCESS97, try to relink reference to another MDB
- From: polite person
- Re: ACCESS97, try to relink reference to another MDB
- From: lesperancer
- ACCESS97, try to relink reference to another MDB
- Prev by Date: Re: Email fonts
- Next by Date: Date Format Question
- Previous by thread: Re: ACCESS97, try to relink reference to another MDB
- Next by thread: Re: ACCESS97, try to relink reference to another MDB
- Index(es):
Relevant Pages
|