View Single Post
  #3  
Old June 23rd, 2004, 05:39 PM
Art
external usenet poster
 
Posts: n/a
Default Table name as parameter in SQL query

John,

Thanks for the response. What I'm doing is fairly simplistic and perhaps there's a better way. We get monthly text files. I need to analyze some data in the colllection of them, each month. I have an mdb that imports each text file into a unique table. I then have an append query which takes that table and adds it to my "master table".

I'm trying to automate some of this in VB.net and I'd want to call the append query, but pass a parameter to it, telling it which of the monthly imported tables to use. I don't want the import routine itself to append, because on occassion there are errors and I need to redo everything. In that case I can wipe out the master table and re-import all of the monthly ones -- they're really not very big -- each on the order of 10,000 records.

Anyway, that's what I'm trying to do. Thanks for your comments -- if you have any suggestions I'd be very anxious to hear them.

Art

"John Vinson" wrote:

On Wed, 23 Jun 2004 05:48:03 -0700, Art
wrote:

Hi,

I'd like to create a query in Access that will prompt me for the table name from which to get the data. Since I'm not very familiar with SQL I normally create a query using the QBE grid, switch to SQL view and make changes.

Ultimately I'm going to use this query from a VB.net program and will be looping through a sequence of tables as my data sources.

I'd appreciate any help, hints or suggestions.


You cannot pass a table name as a Parameter to a query; you'll have to
have your VB.Net program actually construct a SQL string.

I'm queasy about your table design - multiple identically-structured
tables are generally A Bad Idea. Are you storing data in tablenames?
What are these tables?

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public