Hi,
Not sure whether to post under queries, tables, or VBA but here goes:
Each week I receive four excel files (relating to different years' data) from another office and I save them into specific locations/filenames. My Access2003 db uses those four spreadsheets as linked tables. Each file is identical in format and my next step is to delete the previous week's data and then append each file into my "combined years" table.
I'm doing this as follows from a command button. This is just one of the statements, but the others are the same apart from the year in the filename.
Only the Study Recruit ID field is a problem!
I know the field names aren't so good but that's how they come!
Study Recruit ID can contain text or numbers. It can be as simple as 3, or as complex as DCF40AE0-CF9F-DF11-8FF6-002264A1A658. So I have ensured that the data type of the target table is Text.
When I append the data, I get lots of blanks in the Study Recruit ID field and it appears the missing ones are those values that were numeric in the source tables. But shouldn't numeric values append OK into a text-field? I thought they did.
I've checked the design view of the linked tables and the field is text there too.
Fields with dates are appending OK, as are fields that contain just text or just numbers. It's just this one that can be either that's bugging me!
Any ideas how I should fix this?
Thank you,
Not sure whether to post under queries, tables, or VBA but here goes:
Each week I receive four excel files (relating to different years' data) from another office and I save them into specific locations/filenames. My Access2003 db uses those four spreadsheets as linked tables. Each file is identical in format and my next step is to delete the previous week's data and then append each file into my "combined years" table.
I'm doing this as follows from a command button. This is just one of the statements, but the others are the same apart from the year in the filename.
Only the Study Recruit ID field is a problem!
Code:
DoCmd.RunSQL "INSERT INTO [Input file - combined years] ( [Topic ID], [Study ID], Acronym, [Study Title], [Active Status], Randomised, [Design Type], Phase, [Sample Size], [Accrual Site ID], [COLOR="Red"][Study Recruit ID][/COLOR], [Study Entry Date], Topic, [Topic Category], [Organisation ID], CLRN, TrustID, [Trust Name], [Site Name], [Investigator Name], [Count] )" _
& "SELECT [2008-09 input file].[Topic ID], [2008-09 input file].[Study ID], [2008-09 input file].Acronym, [2008-09 input file].[Study Title], [2008-09 input file].[Active Status], [2008-09 input file].Randomised, [2008-09 input file].[Design Type], [2008-09 input file].Phase, [2008-09 input file].[Sample Size], [2008-09 input file].[Accrual Site ID], [2008-09 input file].[COLOR="red"][Study Recruit ID][/COLOR], [2008-09 input file].[Study Entry Date], [2008-09 input file].Topic, [2008-09 input file].[Topic Category], [2008-09 input file].[Organisation ID], [2008-09 input file].CLRN, [2008-09 input file].TrustID, [2008-09 input file].[Trust Name], [2008-09 input file].[Site Name], [2008-09 input file].[Investigator Name], [2008-09 input file].[Count]" _
& "FROM [2008-09 input file];"
I know the field names aren't so good but that's how they come!
Study Recruit ID can contain text or numbers. It can be as simple as 3, or as complex as DCF40AE0-CF9F-DF11-8FF6-002264A1A658. So I have ensured that the data type of the target table is Text.
When I append the data, I get lots of blanks in the Study Recruit ID field and it appears the missing ones are those values that were numeric in the source tables. But shouldn't numeric values append OK into a text-field? I thought they did.
I've checked the design view of the linked tables and the field is text there too.
Fields with dates are appending OK, as are fields that contain just text or just numbers. It's just this one that can be either that's bugging me!
Any ideas how I should fix this?
Thank you,