Solved

Copy record from on table to another and change a few fields before add.

Posted on 2012-04-06
5
354 Views
Last Modified: 2012-06-27
Ok, I am pretty lost here......  


The table that I'm reading from is SupplierRFQ, it has one record.  I want to copy that one record(all fields) to SupplierRFQSlt which is identical to the SupplierRFQ table with the exception of a few fields.  I am using a query that loops through a contact database that has contacts.  I need to add the record from SupplierRFQ to SupplierRFQSlt for each contact in the query and populate the additional fields(SupplierRFQContact) in SupplierRFQSlt during that add.

The query loop I have in place is working fine with the exception of the above question.

Please provide code using my table names and field name, I'm new to VBA.......
0
Comment
Question by:CompTech810
  • 3
  • 2
5 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 37815967
Based on your description ther are is no code needed to do this.  The query grid will handle all this.
You just use an append query.

Start by creating a select query from the SupplierRFQ table and the Contacts table, without joining them in the query grid.

You can select whichever fields you want from each table and then when you convert the query to an append query, make sure the fields all map to the required destination.
0
 
LVL 2

Author Comment

by:CompTech810
ID: 37815998
Ok, I'll take a look at this.  What would be perfect is what I have below.

CurrentProject.Connection.Execute "INSERT INTO SupplierRFQSLT SELECT *, 'Testing' As SupplierAbbreviation FROM SUPPLIERRFQ"

Is there a way that this can be done?
0
 
LVL 2

Author Comment

by:CompTech810
ID: 37816704
That worked!!

But one of the fields I populate with a combination of fields, that value = the file location field.

How do I do that, can  do it in the query field then use 'FileLocation' field in the append area?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 37816763
In the field cell enter the expression that combines the sources, like...

FullName:FirstName & " " & LastName

You can then remove the individual fields if they are not going anywhere.
0
 
LVL 2

Author Comment

by:CompTech810
ID: 37816971
Thanks!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now