Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Through Query "INSERT INTO..."

Status
Not open for further replies.

WAR40K

Technical User
Oct 29, 2003
29
0
0
US
I would like to use a pass through query to pull information from an SQL 2000 database on a remote server and populate an Access 2k table with the data. For example, I have one big table in the SQL database which contains Customer contact information, and some Request for Quote information. I want to import just the contact information and put it into an Access Table "Contact_Table" and then import the RFQ information and put it into an Access Table "rfq_table".

Problem is I cannot seem to get the pass through query to work using the Query tool in Access. I would like to avoid linking the tables if at all possible.

Here is the shorter of the two Queries (I pulled it from VBA, which is how I'm currently accomplishing the task using a linked table).

strSQL = "INSERT INTO Contact_Table (entryDate, prefix, first, last, company, address1, " & _
"address2, address3, city, state, zip, country, phone, fax, email) " & _
"SELECT DISTINCT dbo_rfq_table.entryDate, dbo_rfq_table.prefix, dbo_rfq_table.first, " & _
"dbo_rfq_table.last, dbo_rfq_table.company, " & _
"dbo_rfq_table.address1, dbo_rfq_table.address2, dbo_rfq_table.address3, " & _
"dbo_rfq_table.city, dbo_rfq_table.state, dbo_rfq_table.zip, " & _
"dbo_rfq_table.country, " & _
"dbo_rfq_table.phone, dbo_rfq_table.fax, dbo_rfq_table.email " & _
"FROM dbo_rfq_table;"

Thank you.
 
Check this thread705-1000506 for some options on how to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top