Jim Dudley
Registered User.
- Local time
- Today, 08:18
- Joined
- Feb 16, 2012
- Messages
- 81
Background:
There are two different Excel Templates that are filled in at various campuses and then forwarded to a Central Administration office where the contents are Imported into Access 2010.
The import function is automated via VBA code and inserts the contents of each spreadsheet into a Temporary Table. (This code was created by a Contract Programmer that is no longer available) A series of queries sorts the Temporary tables' records into 2 Categories. (Complete and data missing). The completed records are appended to the main table and the incomplete records are appended to a holding table. Depending on the source spreadsheet the tables differ in as much as each source spreadsheet has its' own set of tables.
Issue:
The Excel templates are filled in by volunteer student help at the various College campuses before being forwarded to Central Administration for uploading to Access 2010. Each student is supposed to fill in a pre-set template with the following columns formated as follows:
Wdate (Workshop date) as 'Short date' (mm/dd/yy) - (This concern has been resolved)
Snum as Text (Snum is a 9 Character unique identifier assigned to each student. It is treated as Text and in all the tables it is Text field. Many of these identifiers begin with a"0" {Zero}. Therefore if they are put into an Excel Cell the leading Zero is dropped unless the Cell is formatted to Text.)
This dropping of the leading zero either on input or Import creates a problem.
Required solution would be to have some VBA code examine each [Snum] Cell and check the length of the data. If it is an 8 digit number, add a zero to the beginning and import the 9 digit identifier as TEXT. If it is already 9 Characters/Digits long, import it as TEXT.
e.g. Iif(len[Snum]=8),"0"&[Snum],[Snum]. If the [Snum] is eight characters long, add a "0", if it is 9 Characters long leave it as is but import it as TEXT not Numeric.
Question:
How do I put this statement into VBA and where should it be inserted?
System:
MS Office 2010
Windows 7
User:
Almost a beginner at using VBA
Other info:
I have attached a zipped copy of the import Code.
There are two different Excel Templates that are filled in at various campuses and then forwarded to a Central Administration office where the contents are Imported into Access 2010.
The import function is automated via VBA code and inserts the contents of each spreadsheet into a Temporary Table. (This code was created by a Contract Programmer that is no longer available) A series of queries sorts the Temporary tables' records into 2 Categories. (Complete and data missing). The completed records are appended to the main table and the incomplete records are appended to a holding table. Depending on the source spreadsheet the tables differ in as much as each source spreadsheet has its' own set of tables.
Issue:
The Excel templates are filled in by volunteer student help at the various College campuses before being forwarded to Central Administration for uploading to Access 2010. Each student is supposed to fill in a pre-set template with the following columns formated as follows:
Wdate (Workshop date) as 'Short date' (mm/dd/yy) - (This concern has been resolved)
Snum as Text (Snum is a 9 Character unique identifier assigned to each student. It is treated as Text and in all the tables it is Text field. Many of these identifiers begin with a"0" {Zero}. Therefore if they are put into an Excel Cell the leading Zero is dropped unless the Cell is formatted to Text.)
This dropping of the leading zero either on input or Import creates a problem.
Required solution would be to have some VBA code examine each [Snum] Cell and check the length of the data. If it is an 8 digit number, add a zero to the beginning and import the 9 digit identifier as TEXT. If it is already 9 Characters/Digits long, import it as TEXT.
e.g. Iif(len[Snum]=8),"0"&[Snum],[Snum]. If the [Snum] is eight characters long, add a "0", if it is 9 Characters long leave it as is but import it as TEXT not Numeric.
Question:
How do I put this statement into VBA and where should it be inserted?
System:
MS Office 2010
Windows 7
User:
Almost a beginner at using VBA
Other info:
I have attached a zipped copy of the import Code.