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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update table with Query results

Status
Not open for further replies.

5166narda

Programmer
Jul 9, 2002
35
US
I need to update a history table with the results of a query that is run from input on a form in access. the query is tying a bunch of data together and giving me all the information I want. The problem is I am not sure on how to code in VB to access the results of the query. I can run the query --
stDocName = "qryrptall"
DoCmd.OpenQuery stDocName, acNormal, acEdit

but then how do I access the specific fields and load them into a table???

This is the query:
SELECT tblRptAll.Owner, tblHeader.Field1, tblHeader.Field2, tblRptAll.ExporterName, tblExporter.[Exporter Address1],tblExporter.[ExporterCity, State Zip], tblExporter.[ExporterTaxID Number], tblRptAll.StartDate, tblRptAll.EndDate, tblRptAll.ProducerName, tblVendors.ProducerStreetAddress1, tblVendors.ProducerCityStateZip,
tblVendors.ProducerTaxID, tblRptAll.ImporterName,
tblCustomers.CustomerAddress1,tblCustomers.CustomerCityStateZip, tblCustomers.CustomerTaxIDNumber, tblRptAll.Min,
tblproducts.ProductDescription, tblproducts.HSDescription,
tblproducts.HSTariffCode, tblproducts.PreferenceCriterion,
tblproducts.Producer, tblproducts.NetCost, tblproducts.CountryofOrigin, tblRptAll.Name, tblAuthor.Company, tblAuthor.Title, tblAuthor.Voice, tblAuthor.Fax, tblRptAll.CurDate, tblRptAll.Pages, tblRptAll.DocumentNo
FROM (((((tblRptAll INNER JOIN tblHeader ON tblRptAll.Owner = tblHeader.ID) INNER JOIN tblExporter ON tblRptAll.ExporterName = tblExporter.[Exporter Name])
INNER JOIN tblCustomers ON tblRptAll.ImporterName = tblCustomers.CustomerName) INNER JOIN tblproducts ON (tblRptAll.Owner = tblproducts.SelectHeader) AND
(tblRptAll.Min = tblproducts.MIN)) INNER JOIN tblAuthor ON tblRptAll.Name = tblAuthor.Name) INNER JOIN tblVendors ON tblRptAll.ProducerName = tblVendors.ProducerName;

The form provides all the tblrptall data.

Any help would be appreciated....
 
Do you want to just add all of the results of your query into an existing table? Or are you updating records already there.

If just adding, then change the select to insert into, or use the query design form and select query type, append query and answer its questions.

Chaz

Ascii dumb question, get a dumb Ansi
 
I am trying to add new records to an existing table. I tried creating an append query but it does not find any records when I run it??
 
Is doing a "DoCmd RunSQL" an option?

< M!ke >
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top