Insert record into new table

ggodwin

Registered User.
Local time
Today, 08:30
Joined
Oct 20, 2008
Messages
112
I have a master table that I look data up on using field call [TagNumber] in a form. Once I have located the record I would like to be able to insert certain fields into another table. Is this hard to do?

Source Table = SKPI
Field I am looking for = TagNumber

The fields that I want to INSERT are
[Type]
[NAMC]
[PartNumber]
[Quantity]
[TagNumber]


Summary:
Insert into table (Dispute)
[Type]
[NAMC]
[PartNumber]
[Quantity]
[TagNumber]
FROM (SKPI)
But I want to do this after I search SKPI for the record that needs to be inserted
 
How about adding a button on your form with this code behind it:

Private Sub btnAdd_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb()
Set rs = db.OpenRecordset("Dispute", DbOpenDynaset)

rs.AddNew
!Type = Me.Type
!NAMC = Me.NAMC
!PartNumber = Me.PartNumber
!Quantity = Me.Quantity
!TagNumber = Me.TagNumber
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub

This code will pull the required data for each field from bound text- or combo boxes on your form and put them in a new row in your Dispute table.

You can also run an append query from your form with [TagNumber] in the criteria line below the TagNumber field.

HTH
 

Users who are viewing this thread

Back
Top Bottom