[AccessD] Append Query

Stuart McLachlan stuart at lexacorp.com.pg
Tue Jun 10 18:12:15 CDT 2003


On 10 Jun 2003 at 10:24, Terri Jarus wrote:

> 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?
> 
> Thanks for any help on this.
> 

Assuming that you always have the same number of  fields in the same 
order, you could do something like this:


Set newdata = db.openrecordset("ImportTbl)
Set maindata = db.openrecordset("UpdateTbl")
While not newdata.eof
  maindata.addnew
  for loopcount = 0 to NoOfFields - 1
     maindata(loopcount) = newdata(loopcount)
  next
 maindata.update
 newdata.movenext
Wend


-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.





More information about the AccessD mailing list