Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Replication / November 2005

Tip: Looking for answers? Try searching our database.

TSI Un-replicator not working ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim Andersen - 13 Oct 2005 13:32 GMT
Using Access 2003, database is in 2000 format.

It seems to work, but when I open up the unreplicated.mdb and check out a
table in design view it still has the s_ColLineage, s_Generation, s_GUID and
s_Lineage fields. Is that "by design" ?

Am using Danish A2003 but that shouldn't(?) be a problem as the fieldnames
are the same.....

/jim
Graham R Seach - 13 Oct 2005 15:34 GMT
Jim,

I had problems with the TSI Un-replicator too, so I rolled my own. This
might help you.

http://www.pacificdb.com.au/MVP/Code/UnReplicate.htm

There are a couple of bugs in the 97 version, which I haven't had time to
fix yet, but the 03 version seems to work OK.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

> Using Access 2003, database is in 2000 format.
>
[quoted text clipped - 6 lines]
>
> /jim
Jim Andersen - 14 Oct 2005 07:56 GMT
> Jim,
>
> I had problems with the TSI Un-replicator too, so I rolled my own.
> This might help you.
>
> http://www.pacificdb.com.au/MVP/Code/UnReplicate.htm

I found a link to it in one of Davids postings. He (and others) mentions the
TSI util a lot, it was the first time I saw a reference to yours. I tried
it, and it workes great. Except I had a A2000 database, and used A2003, and
it wouldn't loadfromtext the form. But I then converted my 2000 db til 2003,
loadfromtext, converted, and then Saved As 2000.

thx for sharing the util,

/jim
jim - 26 Oct 2005 13:56 GMT
Hi Graham,

I have a problem with your util. It doesn't copy the relationships.
Everything else (AFAIK) works great. But I get error "3284: Index
already exists" when I get to

dbC.Relations.Append relC

I tried another piece of code, that copy relationships (I think I got
ot from MS KB) and that gives the same error, when trying to add the
relationship. I also tried the code in a clean new DB, created 2 tables
(same names as my replicated db-tables) and ran the code. And it worked
fine. It copied the relationship.

Here is the code btw, its basically the same just a bit more
self-contained:
Function ImportRelations(DbName As String) As Integer
'------------------------------------------------------------------
' PURPOSE: Imports relationships where table names and field names
'          match.
' ACCEPTS: The name of the external database as a string.
' RETURNS: The number of relationships imported as an integer.
'------------------------------------------------------------------

Dim ThisDb As DAO.Database, ThatDB As DAO.Database
Dim ThisRel As DAO.Relation, ThatRel As DAO.Relation
Dim ThisField As DAO.Field, ThatField As DAO.Field
Dim Cr As String, i As Integer, cnt As Integer, RCount As Integer
Dim j As Integer
Dim ErrBadField As Integer

Cr$ = Chr$(13)
RCount = 0

Set ThisDb = CurrentDb()
Set ThatDB = DBEngine.Workspaces(0).OpenDatabase(DbName$)

' Loop through all existing relationships in the external database.
For i = 0 To ThatDB.Relations.Count - 1
  Set ThatRel = ThatDB.Relations(i)

  ' Create 'ThisRel' using values from 'ThatRel'.
  Set ThisRel = ThisDb.CreateRelation(ThatRel.Name, _
     ThatRel.table, ThatRel.foreigntable, ThatRel.Attributes)

  ' Set bad field flag to false.
  ErrBadField = False

  ' Loop through all fields in that relation.
  For j = 0 To ThatRel.Fields.Count - 1
     Set ThatField = ThatRel.Fields(j)

     ' Create 'ThisField' using values from 'ThatField'.
     Set ThisField = ThisRel.CreateField(ThatField.Name)
     ThisField.foreignname = ThatField.foreignname

     ' Check for bad fields.
     On Error Resume Next
     ThisRel.Fields.Append ThisField
     If Err <> False Then ErrBadField = True
     On Error GoTo 0
  Next j

  ' If any field of this relationship caused an error,
  ' do not add this relationship.
  If ErrBadField = True Then
     ' Something went wrong with the fields.
     ' Do not do anything.
  Else
     ' Try to append the relation.
     On Error Resume Next
     ThisDb.Relations.Append ThisRel
     If Err <> False Then
        ' Something went wrong with the relationship.
        ' Skip it.
     Else
        ' Keep count of successful imports.
        RCount = RCount + 1
     End If
     On Error GoTo 0
  End If
Next i

' Close databases.
ThisDb.Close
ThatDB.Close

' Return number of successful imports.
ImportRelations = RCount

End Function
David W. Fenton - 26 Oct 2005 21:01 GMT
> I have a problem with your util

Whose utility?

Signature

David W. Fenton                        http://www.bway.net/~dfenton
dfenton at bway dot net                http://www.bway.net/~dfassoc

Graham R Seach - 27 Oct 2005 11:36 GMT
Jim,

I can't replicate the issue. What significance is there for the table name
and field name(s)? Is it for a primary key?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

> Hi Graham,
>
[quoted text clipped - 87 lines]
>
> End Function
Jim Andersen - 27 Oct 2005 12:57 GMT
> Jim,
>
> I can't replicate the issue. What significance is there for the table
> name and field name(s)? Is it for a primary key?

Hi Graham,

I don't understand the question.
It's a simple relation. Users (in tblUsers), are a member of one or more
groups (in tblGroups), via a tblUsersGroups.

It seems the .Name of the relation has something to do with it. The name of
the relation in the replicated database was something like
"{ETRJ5874-JFKF8276JDKJ-JKDJDF9887}" on the first relations. The later
relations had more meaningful names...

I singlestepped through the MS KB code, and just before the .Append, I used
the immediate window to do:
thisRel.Name = "number1" (and number2 etc)
and then the .Append worked fine.

If I didn't do the renaming, the .Append would fail. I could then do the
rename, move the execution pointer back to the .Append, and it would append
the relationship Ok.

I'm pretty sure I had to do a rename on all of the relations. Funny name or
not.

/jim
Graham R Seach - 27 Oct 2005 15:47 GMT
Jim,

You said the error message stated "Index already exists". Trap the error at
the point it occurs, then in the Immediate window, get the name of the
relation. Then see if one actually exists with that name:

?CurrentDb.Relations(relC).name

If it actually does exists, put a check into the code to find out when the
first relation with than name is created.
   If relC.Name = "blah blah" Then Stop

It might be that Access has indeed created a duplicate.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

>> Jim,
>>
[quoted text clipped - 25 lines]
>
> /jim
Jim Andersen - 28 Oct 2005 08:14 GMT
> You said the error message stated "Index already exists". Trap the
> error at the point it occurs, then in the Immediate window, get the
> name of the relation. Then see if one actually exists with that name:
>
> ?CurrentDb.Relations(relC).name

I did a currentdb.relations.count, and it returned 0.

Besides... you do
dbC.Relations.Delete relX.Name
a few lines up....

But I'll try....
There...
hmmm...  You didn't test you testcode ?
?CurrentDb.Relations(relC).name gives an error.

relC is a relation. The argument to the Relations collection should be an
integer.
Well, I tried CurrentDb.Relations(0), and that gives a runtime error. 3265
"Element not found in this collection"

Then tried
?CurrentDb.Relations(relC.Name).name  (with an added .Name) which also gives
error 3265

> If it actually does exists
If it does, it wont tell me :-)

> It might be that Access has indeed created a duplicate.
But it seems it hasn't.

Anything else ?

/jim
Graham R Seach - 30 Oct 2005 06:57 GMT
<<You didn't test you testcode ?>>
As a matter of fact I did, and it works for me.

Send me your database and I'll have a look.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html

>> You said the error message stated "Index already exists". Trap the
>> error at the point it occurs, then in the Immediate window, get the
[quoted text clipped - 31 lines]
>
> /jim
David W. Fenton - 13 Oct 2005 17:43 GMT
> Using Access 2003, database is in 2000 format.
>
[quoted text clipped - 4 lines]
> Am using Danish A2003 but that shouldn't(?) be a problem as the
> fieldnames are the same.....

I haven't used the TSI wizard, but I believe that was exactly what
it was designed to address, was the shortcoming of the MS-provided
wizard that it didn't remove the replication fields.

Signature

David W. Fenton                        http://www.bway.net/~dfenton
dfenton at bway dot net                http://www.bway.net/~dfassoc

George Nicholson - 13 Oct 2005 23:55 GMT
I think Microsoft supplied a wizard for Access 95 & 97 only. AFAIK,
TSI/michka's tool was intended as a "new" version which would work with Jet
4/Access 2000+ up.

I thought I remembered reading that not deleting fields was by design (would
you really trust *any* tool to delete fields from your tables <g>), but I
can't find anything to back that up, so I could easily be wrong.

HTH,
Signature

George Nicholson

Remove 'Junk' from return address.

>> Using Access 2003, database is in 2000 format.
>>
[quoted text clipped - 8 lines]
> it was designed to address, was the shortcoming of the MS-provided
> wizard that it didn't remove the replication fields.
Graham R Seach - 03 Nov 2005 08:21 GMT
An updated file has been posted to the website.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

> Using Access 2003, database is in 2000 format.
>
[quoted text clipped - 6 lines]
>
> /jim
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.