derekbrown
Registered User.
- Local time
- Today, 00:16
- Joined
- Jun 8, 2005
- Messages
- 12
Is it possible to delay the Form_Current event? I use the code below to duplicate records, ask for a change in teh reference number and then resort the database according to the reference numbers. This works fine until I introduce some code into a Form_Current procedure. Now whenever I activate the macro below to copy a record the data in the copy record is wiped out and the form rendered with its defaul values. I am assuming this is because the code in the Form_Current section is rendering the form whilst something else is trying to paste values in it so is ther a way to delay either the pasting of the new data or the activation of the Form_Current procedure?
I have tried using a few basic counters but to no avail! Any help would be greatly appreciatted.
Cheers
_______________________________
Private Sub cmdCopyPrevRec_Click()
On Error GoTo Err_cmdCopyPrevRec_Click
Dim TestNum As String
TestNum = Test_Number
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
NewTestNum = InputBox("Please enter test number:", "Test Number", TestNum + ".1")
Test_Number = NewTestNum
Test_Number.SetFocus
DoCmd.RunCommand acCmdSortAscending
DoCmd.FindRecord NewTestNum, , , , , acCurrent, True
Exit_cmdCopyPrevRec_Click:
Exit Sub
Err_cmdCopyPrevRec_Click:
Display = MsgBox("Copied without updating Test Number", vbOKOnly)
Resume Exit_cmdCopyPrevRec_Click
End Sub
I have tried using a few basic counters but to no avail! Any help would be greatly appreciatted.
Cheers
_______________________________
Private Sub cmdCopyPrevRec_Click()
On Error GoTo Err_cmdCopyPrevRec_Click
Dim TestNum As String
TestNum = Test_Number
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
NewTestNum = InputBox("Please enter test number:", "Test Number", TestNum + ".1")
Test_Number = NewTestNum
Test_Number.SetFocus
DoCmd.RunCommand acCmdSortAscending
DoCmd.FindRecord NewTestNum, , , , , acCurrent, True
Exit_cmdCopyPrevRec_Click:
Exit Sub
Err_cmdCopyPrevRec_Click:
Display = MsgBox("Copied without updating Test Number", vbOKOnly)
Resume Exit_cmdCopyPrevRec_Click
End Sub