dbTalk Databases Forums  

Synchronize tables with own script

comp.database.ms-access comp.database.ms-access


Discuss Synchronize tables with own script in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Marc Weber
 
Posts: n/a

Default Synchronize tables with own script - 09-28-2005 , 03:31 PM






Hi.

I know there is the tool of Access to create a Master MDB with copies
which can be synchronized later on. Sometimes I forget to do this..

In short: Is it possible make access two tables having the same fields
from totally different independent mdb files?

In case it's not I've tried to implement some little script.
Having two tables:

Left table:
ID Text
1 one
2 two
4 five

right table:
ID
2 two
4 four

my script creates another table containing
L/R = left/ right table of comparism

action L_ID R_ID L_Text R_Text
1 one
4 4 five four

where you can specify
Quote:
copy left to right (and perhaps create it)
copy right to left
dl delete left
dr delete right

This way it should be really easy to synchronize some changes..
But I have some problems implementing it..
I'm not sure..
First of all I use DAO to get a list of tables of both mdb files.
Then I get the field lists and extract the primary fields.
The next step is creating the table which contains the "diff".
After creating this table I'm closing and showing it:

dim vergl As DAO.tabledef
vergl=CurrentDB.CreateDB("Vergleich")
[...]
vergl.close
DoCmd.OpenTable Vergleich

The odd thing here:
Access tells me that it can't find this table and it ask my to stop or
to go to debug mode. After going to debug mode I can reexecute this
command with pressing F5 .. Now the table pops up (??)


But I don't know how to show this table in a modal way.
DoCmd.OpenTable DiffTable does show it, but the programs continues..
So I've tried to make quick hack:

Public Sub WaitForUser()
Me.ready.SetFocus=False ' Me.ready is checkbox control on the form
do while not Me.ready.Value
DoEvents
Next
End Sub

Is there some other way?

Another ugly thing that Access says after running my script that I don't
have enough privileges to save my work any more .. (I don't mind,
copying the text and restarting WinXP works) I'm not sure wether it's
the right translation because I'm German and I'm using the German
translation of Access.

I'm not sure wether some is intersted in my piece of code and wether I
should paste it here (actually it's a form with most function names
beeing German. I could translate them)
What do you think?

Marc


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.