[AccessD] Append Query

Gustav Brock gustav at cactus.dk
Wed Jun 11 05:04:19 CDT 2003


Hi Terri

Again assuming that the order of the fields remains the same, you can
also use a union query:

<SQL>

  SELECT
    ID AS SalesID,
    Sales AS QSales,
    ...
    Value AS QValue
  FROM
    tblSomeTable
  WHERE
    FALSE
  UNION SELECT
    *
  FROM
    ImportTbl;

</SQL>

This will grab the fieldnames but no records from the first select and
the records from the import table from the next select.
tblSomeTable must be a copy of a typical import table; of course,
adjust fieldnames as needed.

Feed the output of this to an append query. I don't think a table
creation query can be used as the output from a union query is all
strings, thus all fields in a created table would be of type text.

/gustav


> I have data that I have imported into my database into a table named ImportTbl.  I will be doing this quarterly - and each time this happens the field names get changed around a little bit by the
> person submitting the data.  For example, they might call the field Q1 Sales and then the next time Q2 Sales - which isn't too bad, but then there are other fields like Hospital Name, they might
> call Facility Name.

> I want to transfer the data from the ImportTbl to another table that I have established generic field names - such as Sales, Name, etc.  I then have set up queries, reports etc, based on this table
> (UpdateTbl).

> What is the best way to do this programmatically?



More information about the AccessD mailing list