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

Copy a record from one table to another

Status
Not open for further replies.

GussyBoy

IS-IT--Management
Mar 11, 2003
96
0
0
BS
I have a table with a few fields one of the fields being a combo box. This combo box is used to select the record that i want shown on the form. After selecting a record, I want to use a command button to add/copy the current record to another table. Is this possible? I've tried building a query but I can get the coding right for the criteria for the combo box. Please advise.

Thanks.
 
Are you using a form based on the table?
 
Does your dropdown include the Primary Key of the table? (It can have a length of 0 so it isn't shown.)
 
Yes. My dropdown combo box is the primary key field in the table.
 
Use an append query to append the one record to the other table using the primary ID as your criteria.
 
How do you reference the primary ID for that form in the criteria section of the query?

I've tried =[formname].[objectname] but that didnt work.
 
something like (untested)
"INSERT INTO Table2( [ID] ) SELECT [Table1].[Field1] FROM [Table1] WHERE ((([Table1].ID)='" & forms!formName!column(0) & "'));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top