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

Saving a record from Table 1 to Table 2

Status
Not open for further replies.

KerryL

Technical User
May 7, 2001
545
US
I'm having all sort of trouble with something that shouldn't be so difficult.

I'm trying to pull a record from Table A and save it to Table B but I can't seem to get it to work.

Table A contains 185,000 records. I created a query that filters the records (by name or ssn) based on user input. The filtered list comes up in a listbox on frmSelect.

From the list box containing the filtered records, I want the users to be able to double-click on the record they want, which will populate frmPartic and save the record to Table B.

But I can't seem to get the double-click event to take the selected record from the listbox on frmSelect to frmPartic and into Table B.

If more explanation is needed, please let me know, but I sure would like to figure this out.

Thanks

 
All you need to get from the list box is the primary key of the source Table

Then do a

DoCmd.RunSQL "INSERT INTO TargetTable(FieldList) SELECT SourceFieldList FROM tblSource WHERE SourceId = " & listboxValue





'ope-that-'elps.





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
The source table (Table A) is a linked table, so I can't create a primary key field in it. There's a unique field in the table, it's just that Access won't allow me to assign it as the key field.


 
Okay - don't get caught up in semantics.

As long as the field is unique to the record it will do. Use it.





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top