G
Guest
I would like to click a button to copy a record with the exception of the
primary key.
I use the following code that includes an input box to enter the new primary
key value. The button works fine until I call some other function in the
forms "OnCurrent Event" If I use this event to act when I move from record to
record the button creates a new record but does not carry any of the data
except the primary key with it.
Does anyone have any suggestions? What other events trigger when you move
from record to record in a form other than the "Current"?
Private Sub btnDuplicateRecord_Click()
On Error GoTo Err_btnDuplicateRecord_Click
NewRoomNo = InputBox("Room Number Input", "Input Room Number", "XXX", 1000,
1000)
RunCommand acCmdSelectRecord
RunCommand acCmdCopy
RunCommand acCmdPasteAppend
txtRoomNo = NewRoomNo
Exit_btnDuplicateRecord_Click:
Exit Sub
Err_btnDuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_btnDuplicateRecord_Click
End Sub
primary key.
I use the following code that includes an input box to enter the new primary
key value. The button works fine until I call some other function in the
forms "OnCurrent Event" If I use this event to act when I move from record to
record the button creates a new record but does not carry any of the data
except the primary key with it.
Does anyone have any suggestions? What other events trigger when you move
from record to record in a form other than the "Current"?
Private Sub btnDuplicateRecord_Click()
On Error GoTo Err_btnDuplicateRecord_Click
NewRoomNo = InputBox("Room Number Input", "Input Room Number", "XXX", 1000,
1000)
RunCommand acCmdSelectRecord
RunCommand acCmdCopy
RunCommand acCmdPasteAppend
txtRoomNo = NewRoomNo
Exit_btnDuplicateRecord_Click:
Exit Sub
Err_btnDuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_btnDuplicateRecord_Click
End Sub