G
Guest
I'm trying to add a "duplicate record" button to a form. The Access version of the process:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
Throws errors every time I run it. I suspect this has soemthing to do with it trying to paste into the autonumber field. So far, I've been unable to capture the error and prevent my user from seeing it.
I searched the archives of this board duplication questions and tried the solution recommended at: http://support.microsoft.com/default.aspx?scid=kb;en-us;210236
The KB's recommendation has given me many hours of headache. The method they use walks through every control on the form and tries to set the control's value to the corresponding value from the recordset. Unfortunately, I have a lot of controls on my form that don't exist in the record set (labels, command buttons, etc). I had to fight the sample code to get it to work even a little bit. One example, it took me a while to get it to use a record of my choosing to copy from. For a long while it thought my recordset was empty (Both BOF and EOF = true) In short, I really don't want to continue down that road unless it really is "the only way."
Any suggestions for this seemingly simple task?
Also - I'd like to thank all of you guys (and gals) out there that know Access so well and are willing to give your time to help those of us that are lost.
-Kyle
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
Throws errors every time I run it. I suspect this has soemthing to do with it trying to paste into the autonumber field. So far, I've been unable to capture the error and prevent my user from seeing it.
I searched the archives of this board duplication questions and tried the solution recommended at: http://support.microsoft.com/default.aspx?scid=kb;en-us;210236
The KB's recommendation has given me many hours of headache. The method they use walks through every control on the form and tries to set the control's value to the corresponding value from the recordset. Unfortunately, I have a lot of controls on my form that don't exist in the record set (labels, command buttons, etc). I had to fight the sample code to get it to work even a little bit. One example, it took me a while to get it to use a record of my choosing to copy from. For a long while it thought my recordset was empty (Both BOF and EOF = true) In short, I really don't want to continue down that road unless it really is "the only way."
Any suggestions for this seemingly simple task?
Also - I'd like to thank all of you guys (and gals) out there that know Access so well and are willing to give your time to help those of us that are lost.
-Kyle