Error in Duplicating record on MS Access Form (VBA) due to Unbound Control
Posted on 2008-06-25
I have an MS Access form frmA tied to a table tblA. All of the controls except 2 new ones that I recently added, are tied to some field from tblA (i.e. their Data Source) is some field in tblA. The 2 new controls I added are not bound to the table, they are combo boxes to simply apply a Filter or Sort By, on the records in frmA. Before adding the 2 new controls, I was able to Duplicate an existing record via a command button I added using the MS Access Wizard (code below):
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Now since adding the control, I get the error message that it was unable to paste & the errors have been added to a table Paste Errors. I think that when I use the Duplicate command, Access tries to paste selections for the combo boxes (2 new controls) into tblA, which however, does not have a field assocaited with the control.
My question is, using the same Duplicate command button, how can I specify or restrict these 2 controls from being copied, while copying everything else using the same code above.