 |
| 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
|
|
|
|

October 28th, 2003, 05:01 AM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 28th, 2003, 10:29 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 28th, 2003, 09:15 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 28th, 2003, 09:22 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 28th, 2003, 11:26 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 29th, 2003, 12:14 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 29th, 2003, 02:48 AM
|
|
Authorized User
|
|
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

October 29th, 2003, 10:36 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|
 |