I have a spreadsheet, which has been set up so that our users can go on site and be able to track what they are doing offline. When they come back to our “world”, we need to be able to import that spreadsheet into our database application. The application is 2010 Access, with linked SQL tables. The spreadsheet has 29 fields, which are a template. They will always be the same, whether there is info to fill out for every record. I did the following, in an attempt to set up a structure for handling this:
I created a table for importing all the records from any of these spreadsheets, and I upsized it to SQL. In the SQL table, I added some foreign key fields, as this will be a sort of temp table for the data to come in (and allow us to QC the data at a later time).
Of the 29 fields, 12 of them go into a main table for the tracking. The other 17 go into a 2nd table. In this 2nd table, it is normalized with a look-up for the “type” of what we are tracking. So that we can have 1 record for each thing we track, with copies of the types we are tracking, I have an un-normalized spreadsheet for use in the field, and once this workbook is imported, I need to insert the data into the appropriate tables, figuring I can update the working table with the foreign key of the normalized table record that gets created for that info.
I have been looking at some examples, but not sure how to best go about this. I am looking to create the following:
1. Have a form for entry of the main table data, and a button to prompt a dialog for a user to choose a spreadsheet (somewhere on the network)
2. Import all 29 fields into the “working” table
a. I may need to do some checks on the spreadsheet data, to require that if there is data on a row, 3 of the columns must have info (I would like to require 9 fields not be empty)
3. Insert the first 12 columns of data for all records that do not have a foreign key field id, indicating that that row has been inserted AND all the fields are not equal to a record in the main table (not a dupe)
4. Update the foreign key field in the working table to the ID for the main table row that was inserted
5. Insert the 9 columns into the type table for the type “original” with the corresponding main table foreign key
6. Update the foreign key for the type table record
7. Inset the 4 columns into the type table for the “replacement” with the corresponding main table foreign key
8. Update the foreign key for the type table record
9. Report that the import is done
Please let me know if this doesn’t make sense, or if you have any ideas/examples of how to get this going. Once I get a good push, I am usually off and running
misscrf
It is never too late to become what you could have been ~ George Eliot
I created a table for importing all the records from any of these spreadsheets, and I upsized it to SQL. In the SQL table, I added some foreign key fields, as this will be a sort of temp table for the data to come in (and allow us to QC the data at a later time).
Of the 29 fields, 12 of them go into a main table for the tracking. The other 17 go into a 2nd table. In this 2nd table, it is normalized with a look-up for the “type” of what we are tracking. So that we can have 1 record for each thing we track, with copies of the types we are tracking, I have an un-normalized spreadsheet for use in the field, and once this workbook is imported, I need to insert the data into the appropriate tables, figuring I can update the working table with the foreign key of the normalized table record that gets created for that info.
I have been looking at some examples, but not sure how to best go about this. I am looking to create the following:
1. Have a form for entry of the main table data, and a button to prompt a dialog for a user to choose a spreadsheet (somewhere on the network)
2. Import all 29 fields into the “working” table
a. I may need to do some checks on the spreadsheet data, to require that if there is data on a row, 3 of the columns must have info (I would like to require 9 fields not be empty)
3. Insert the first 12 columns of data for all records that do not have a foreign key field id, indicating that that row has been inserted AND all the fields are not equal to a record in the main table (not a dupe)
4. Update the foreign key field in the working table to the ID for the main table row that was inserted
5. Insert the 9 columns into the type table for the type “original” with the corresponding main table foreign key
6. Update the foreign key for the type table record
7. Inset the 4 columns into the type table for the “replacement” with the corresponding main table foreign key
8. Update the foreign key for the type table record
9. Report that the import is done
Please let me know if this doesn’t make sense, or if you have any ideas/examples of how to get this going. Once I get a good push, I am usually off and running
misscrf
It is never too late to become what you could have been ~ George Eliot