text field in query

thegooser

Registered User.
Local time
Today, 22:25
Joined
Aug 16, 2010
Messages
15
Hi all.

I have 32 different csv files all with the same fields. I am looking at linking all of the csv files to access. I would then like to produce one query with all of the data inside.

The only problem I am having is that would like a field in the final query to tell me which csv file it is from.

Is there anyway for me to add a field in a query with a pre set text value. For example, in the final cell of every record in csv1 I would like it to say csv1.

As it will work with ever changing csv files, I need a linked text file so I can't do anything with the table itself.

Does anyone know what I am going on about, and if so how I can solve this?
 
You can easily just get your query to display a value in a 'column' if required. In your query design view, you could add the following to the next available 'column' in the 'Field' line:

FileName: "csv1"

This would display csv1 against every record.

However, if you need to somehow determine the filename that you are querying from, that's more work ;)
 
Would you be able to add a field to each of the source csv files with a reference, that will be read into Access and tell you which file it came from?
 
Addyman has the right answer. The only thing that I might do differently is to make it a UNION Query, becasue you said "I would then like to produce one query with all of the data inside".
 

Users who are viewing this thread

Back
Top Bottom