By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,490 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,490 IT Pros & Developers. It's quick & easy.

Updating a table from TXT file

tdw
100+
P: 206
Hi all,

I have several ideas on how to do this, but am having difficulty putting the ideas together and figuring out the most efficient way to do this.

I have a database of survey coordinate points. These records are imported from a txt file, and never manually entered. Currently there are no forms at all.

The first problem is that the txt file continually gets updated by a CAD program.
The second problem is that there is one extra field in the database that is not a column in the txt file: DATE. The date for each record gets manually entered into the database table. This date represents the date that the GPS coordinate was recorded in the field.

So, what I want to do is create a process in a new form that will do the following:
1. Select the txt file to import (I have already created this part).
2. Import the data (either replacing ALL of the records, while leaving the DATE fields alone, or finding all changes in the txt file and updating the table to reflect them, again leaving the DATE field alone.)
3. Prompt the user to add dates to the records that do not have one, preferably by allowing the user to enter a range of coordinate point numbers (the primary key of each record) to add a certain date to.
(I could probably figure step 3 out for myself. Just haven't done so yet.)

Any thoughts, especially on step 2?
So far I have been looking at PopulatePartial Method, PartialReplica Property, ReplicaFilter Property, Synchronize Method, CreateTableDef Method (for creating a new table based on the txt file and then maybe trying to update the original table based on the new one, then delete the new one? I don't know.)

Again, I would always need the table to update to reflect any additions or changes to the txt file, while retaining the dates for each record. Sometimes existing records (coordinate points) will have changed in the txt file, and often there will be new records (coordinate points) in the txt file. Also, again, the txt file does not contain any dates.

Thanks!
Dec 3 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,287
I think you should have a table to hold the imported data, but you don't have to create and delete it. Just keep the table, and delete all the records from it before you start. Then after you import to the table you could run an UPDATE like
UPDATE FinalTable Set FinalTable.field1 = ImportTable.field1 WHERE FinalTable.PKey = ImportTable.PKey
Then do an INSERT of any new records based on a NOT EXISTS of the primary key in the destination table.
I haven't looked at any of the other methods you mentioned, so there may be a much easier way.

As for #3, I would make a form that shows only records without a date, and the user can fill them in, since they don't need to worry about the ones that have a date already. You can filter the form for a certain range or whatever.
Dec 3 '08 #2

tdw
100+
P: 206
tdw
Ok, that all sounds good. I will try it.
Thanks!
Dec 3 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.