Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 28th, 2003, 05:01 AM
Authorized User
 
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default Table comparison

hi,

i have a database where i want to import files into my table.
however it is hard to stop the user from importing the same data. so i would need to import all the data into a temp table, compare the primary key of the temp table against my main table., if i found primary key matches, i will not import that row of data into my main table.
how can i do that? i really have no idea of how to start on it.

pls advice
nono

 
Old October 28th, 2003, 10:29 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Instead of importing why don't you link the file. After you have done the link, do a find unmatched query to find the differences and use that result to append your table.

Does that help get you started?

What typr of file are you importing? Exceel, text, csv?



Sal
 
Old October 28th, 2003, 09:15 PM
Authorized User
 
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi sal,

i am importing excel files. as u have mention as to link instead of importing. if i do the linking of files, then will the data still be inserted into the database if no matches were found???

if so , can u guide me on how to link the files??

pls advice
nono

 
Old October 28th, 2003, 09:22 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, the data can still be imported?appended to your table.
Is this an excel file that constantly changes?
are you just trying to compare the two?
I am assumming that is the case

To link go to
File
Get External Data
Link Tables
  Select Excel and search for your file

Then follow the wizard.






Sal
 
Old October 28th, 2003, 11:26 PM
Authorized User
 
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi sal,

no that is not what i want. i do not want the linking to be done manually. i want it to be base on a command button click. when the user click on the command button-import, the system will import the data to a temp table and compare it with my destination table, if there are matches of the same primary key then, importing of that particular data will not be imported, while those that does not match will then be imported to the destination tables.

pls advice
nono
 
Old October 29th, 2003, 12:14 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK,. please tell me this.
Is this a repetitive task?
Will this be done all the time with the same Excel file?
Do you want to automate it?

Please answer all 3 questions.




Sal
 
Old October 29th, 2003, 02:48 AM
Authorized User
 
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

- the importing will be done frequently almost everyday.
- it will not be the same excel file.
- automate in the sense that when the user want to import the file, he will go to the import form to import the data.

cheers,
nono

 
Old October 29th, 2003, 10:36 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There are a lot of ways to import data from excel to access. The problems lies in the users not knowing anything about relational databases. To 99.99% of users, Access is a cool collection of spreadsheets.

If you have noticed, most Excel lovers do a lot of formatting to their spreadsheets (I HATE EXCEL). This makes it nearly impossible for you to predict what formatting the spreadsheet will have making it impossible to automate the task.

I have never allowed a user to import data on the fly into my database. I do not care who complains or how much they complain. I just will not allow it. It is the developer/data analyst the one responsible for importing the data.

You can not automate imports into excel the way you want to do it. You will need to do this task yourself.





Sal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Array or Table Performance comparison bananas SQL Language 4 June 5th, 2007 05:29 AM
datetime comparison MunishBhatia ASP.NET 2.0 Professional 2 May 24th, 2007 07:42 AM
Date comparison rajuru Beginning PHP 2 February 19th, 2005 10:33 AM
Table Look Up and Comparison mmcdonal Access VBA 1 November 17th, 2004 05:28 PM
Comparison in Access mega Access ASP 1 June 23rd, 2003 12:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.