W
Wylie C
I have a form with a control bound to a table. The field in the table,
RouteNum, is set as primary key. When the form opens in new record mode, the
RouteNum number is created by adding one to the maximum value in the
corresponding field in the table. I have placed the delete record and close
form command buttons by using the built in wizard in Access 2000. The
required property is set to No in the table. The problem I am having is if
the user opens the form accidentally, clicking the delete key advises that
the record is being deleted but then I get a msg, No current record but I
can't close the form using the close button. In fact nothing works and I have
to shut down the program to work in the program again.
HELP!! Code follows:
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub
Private Sub Close_Click()
On Error GoTo Err_Close_Click
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub
RouteNum, is set as primary key. When the form opens in new record mode, the
RouteNum number is created by adding one to the maximum value in the
corresponding field in the table. I have placed the delete record and close
form command buttons by using the built in wizard in Access 2000. The
required property is set to No in the table. The problem I am having is if
the user opens the form accidentally, clicking the delete key advises that
the record is being deleted but then I get a msg, No current record but I
can't close the form using the close button. In fact nothing works and I have
to shut down the program to work in the program again.
HELP!! Code follows:
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub
Private Sub Close_Click()
On Error GoTo Err_Close_Click
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub