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

How can I update a "NEW" record

Status
Not open for further replies.

hazelett

Programmer
Jun 29, 2001
15
US
I'm trying to copy data from an Employee table into a Termination table. I select a SocSecNbr from one form and have it open the Termination form. If it finds related records it display them correctly. The problem comes in when there is no record and it opnes a "NEW" record. At this point I want to copy data from my Employee table into the Termination table. However, I get errors that indicate I can't update these fields. If I use an unbound field it updates correctly but I want to place data into fields that are bound to the Termination table. Can this be done or am I at a dead end?
 
I use the code below to delete a record from one form/table and input it into another form/table


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 1, , acMenuVer70
DoCmd.OpenForm "frmDeletedPerson", , , acNew
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Close acForm, "frmDeletedPerson"
End Sub

Hope this helps
Hymn
 
I was getting nowhere so I quit trying to do it in code and setup a subform that linked to my SocSecNbr that had all of the data I needed. I then used the default property of each field that I needed to populate and entered the control ID of the info I needed and it worked. Now it displays any existing information correctly and if a new record is being entered then the defauklteded fields show the right info too.

Thanks for the tip. I hadn't thought of using the edit menu that way.

Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top