R
Rob Parker
Yesterday, I had a user report a problem to me, related to copying and
pasting an existing record into a new record. I've spent much of today
trying to figure out exactly what happens, and how to prevent this in
future - with little success - and looking for incorrect records in the
existing data (fortunately only a couple of records).
Details: Using Access 2000, SP-3. Continuous form, with record selectors
visible, and additions allowed (both these settings are required by users).
The form is bound to a table, and about half of the fields in the table are
visible in bound controls in the form; the others are set by either a
default value in the table (entry date), or via code in the form's OnInsert
event which uses values from some combo-boxes or hidden text-boxes in the
form's header (the code also does some validation).
Select an existing record by clicking on its record selector, then Copy
(either from Edit menu, or via keyboard shortcut key); set the appropriate
entries in the combo-boxes in the header; click on the record selector for a
new record at the bottom of the form, and Paste (again, either from Edit
menu or shortcut key).
Result: a new record is created, with entries in those fields which have
default values, but with none of the data from the copied record. And the
KILLER: the data from the visible fields in the copied records overwrites
the data for another (random) existing record; the other data (from the
combo-box values/hidden textboxes) is not overwritten.
I've searched the newsgroups with no success. I've also browsed the Access
Web site, and thought that perhaps the items regarding bookmark bugs might
help (even though the code does not use bookmarks - perhaps used internally
by the Jet engine in this case (I thought, clutching at straws)); sadly, no
joy there.
I'm at a loss as to how to detect that the user is doing this copy/paste
operation, and trap/prevent it. Any suggestions on that would be gratefully
received. Also an explanation of why this is occurring would be
appreciated. I could remove the standard menus and replace them with custom
ones, without the copy/paste options; but since this can also be done via
keyboard shortcuts (and is another carved-in-stone user requirement, to
allow copying between fields in different records on occasion) it wouldn't
prevent the problem. Similarly, hiding the record selectors or dis-allowing
additions in the continuous form (there is also a "details" form, which
exposes all fields to the user) would prevent this, but I can't do that
either.
TIA,
Rob
pasting an existing record into a new record. I've spent much of today
trying to figure out exactly what happens, and how to prevent this in
future - with little success - and looking for incorrect records in the
existing data (fortunately only a couple of records).
Details: Using Access 2000, SP-3. Continuous form, with record selectors
visible, and additions allowed (both these settings are required by users).
The form is bound to a table, and about half of the fields in the table are
visible in bound controls in the form; the others are set by either a
default value in the table (entry date), or via code in the form's OnInsert
event which uses values from some combo-boxes or hidden text-boxes in the
form's header (the code also does some validation).
Select an existing record by clicking on its record selector, then Copy
(either from Edit menu, or via keyboard shortcut key); set the appropriate
entries in the combo-boxes in the header; click on the record selector for a
new record at the bottom of the form, and Paste (again, either from Edit
menu or shortcut key).
Result: a new record is created, with entries in those fields which have
default values, but with none of the data from the copied record. And the
KILLER: the data from the visible fields in the copied records overwrites
the data for another (random) existing record; the other data (from the
combo-box values/hidden textboxes) is not overwritten.
I've searched the newsgroups with no success. I've also browsed the Access
Web site, and thought that perhaps the items regarding bookmark bugs might
help (even though the code does not use bookmarks - perhaps used internally
by the Jet engine in this case (I thought, clutching at straws)); sadly, no
joy there.
I'm at a loss as to how to detect that the user is doing this copy/paste
operation, and trap/prevent it. Any suggestions on that would be gratefully
received. Also an explanation of why this is occurring would be
appreciated. I could remove the standard menus and replace them with custom
ones, without the copy/paste options; but since this can also be done via
keyboard shortcuts (and is another carved-in-stone user requirement, to
allow copying between fields in different records on occasion) it wouldn't
prevent the problem. Similarly, hiding the record selectors or dis-allowing
additions in the continuous form (there is also a "details" form, which
exposes all fields to the user) would prevent this, but I can't do that
either.
TIA,
Rob