Selecting records in a form for adding to another table

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I would like to make a query-based continious form the
purpose of which will be selecting records for adding to
another table.

It should work approximately like as follows:
_______________________
Continious Form

Record 1 [Button]
Record 2 [Button]
Record 3 [Button]
_______________________

When one presses the button on the right of the record,
the record is being added to a destination table.

Please, give me a hint how I can do that?
 
Mike said:
I would like to make a query-based continious form the
purpose of which will be selecting records for adding to
another table.

It should work approximately like as follows:
_______________________
Continious Form

Record 1 [Button]
Record 2 [Button]
Record 3 [Button]
_______________________

When one presses the button on the right of the record,
the record is being added to a destination table.

The code behind the button could look something like:

Dim db As DAO.Database
Dim strSQL As String
strSQL = "INSERT INTO destination " _
& "SELECT * FROM source " _
& "WHERE keyfield = " & txtkeyfield
Set db = CurrentDb()
db.Execute strSQL, dbFailOnError
Set db = Nothing

But, it's usually a bad idea to copy entire records. Most
situations (archiving the records being an obvious
exception) only need to store the primary key of the source
table record in the destination table.

You may have additional issues if anyone tries to perform
this operation more than once.
 
Back
Top