Subsequent acCmdPasteAppend doesn't work

  • Thread starter Thread starter Andy_I via AccessMonster.com
  • Start date Start date
A

Andy_I via AccessMonster.com

I have a main form that has two datasheet subforms: 1) fsub_sales, 2)
fsub_inventory. This form will be used to enter data that comes from
multiple Excel spreadsheet.

Currently, the user selects the first field in the fsub_sales form and goes
to the following menu: Edit -> Paste Append. Then, the user selects the
first field in the fsub_inventory form and again selects the menu: Edit ->
Paste Append. Of course, this is all done after copying the approriate data
from Excel - once for the sales data and again for the inventory data.

All I'm trying to do is to mimic the Edit-Paste Append with a command button.
Here's my code for the Paste Append command button.
======================================
Private Sub cmd_paste_append_Click()
Dim ctl As Control

'First set the focus back to the subform.
Set ctl = Screen.PreviousControl
ctl.SetFocus

'Paste Append the data.
DoCmd.RunCommand acCmdPasteAppend

End Sub
=======================================

This works fine on the first call but any subsequent call shows the data
being added on the screen but not really being saved to the tables that the
subforms are bound to. Also, the message "You are about to paste xx records
(s)...." is displayed on the first call but not on any following
cmd_Paste_Append_Click() call.

It seems like the data is not being committed to the table. But why would it
work on the first call?

Thanks a lot...I could probably just modify the shortcut menu to include
Paste Append but this problem is really bugging me.

Andy_I
 
Back
Top