dbTalk Databases Forums  

Re: AC2000 - what's wrong with this code? - the answer

comp.databases.ms-access comp.databases.ms-access


Discuss Re: AC2000 - what's wrong with this code? - the answer in the comp.databases.ms-access forum.



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

Default Re: AC2000 - what's wrong with this code? - the answer - 07-29-2003 , 09:21 AM






Deano wrote:
Quote:
Here's some code that someone wrote for me. It's supposed to copy
tblRights from an external mdb into my main database. tblRights
already exists there so when it's copied in it becomes tblRights1.

tblRights is cleared out using the DELETE line and then the contents
of tblRights1 is appended into tblRights. Finally tblRights1 is
deleted.

However when i check I find that tblRights is empty; the code hasn't
copied the records over - anyone know why it's not working?
tblRights does have relationships but I'm pretty sure this shouldn't
affect it.

-----that code snippet----
'selectedBU contains the path.

DoCmd.TransferDatabase acLink, "Microsoft access", selectedBU,
acTable, "tblRights", "tblRights"
DoCmd.RunSQL "DELETE tblRights.* FROM tblRights;"
DoCmd.RunSQL "INSERT INTO tblRights SELECT tblRights1.* FROM
tblRights1;" DoCmd.DeleteObject acTable, "tblRights1"

Just in case anyone's interested I worked out what was bugging out my code.
I noticed that the tables WERE importing OK but then when a certain tables
was imported the data in the problem tables suddenly disappeared.
This new table was related to the problem tables and seems to cause some
form of cascading deletion when imported.
Soooo, the solution was to import this table before any of the others - now
works ok!






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.