“Add A New Record” function is not working (1 Viewer)

access2010

Registered User.
Local time
Yesterday, 19:54
Joined
Dec 26, 2009
Messages
1,131
I would appreciate some help with the adding of new records to this form
@On Click = Event Procedure

= = =
Private Sub cmdAddNewRecord_Click()

On Error GoTo Err_cmdAddNewRecord_Click

' Save any current changes to the record

DoCmd.RunCommand acCmdSaveRecord

' Attempt to add a new record

DoCmd.GoToRecord , , acNewRec

Exit_cmdAddNewRecord_Click:

Exit Sub

Err_cmdAddNewRecord_Click:

MsgBox "Error " & Err.Number & ": " & Err.Description

Resume Exit_cmdAddNewRecord_Click

End Sub

= = =
Error Message
Stock Name and Stock Symbol already exists on the investments01_Tbl => OK

= = =
You can’t go to the specified record

Thank you Barbara
 
Thank you DHookom, for your suggestion.

We have been using the code in this database since 2010 without any issue until now, specifically, “ONLY in THIS FORM”.

We have tried many other codes without success and would appreciate your assistance with this problem.
 
I would appreciate some help with the adding of new records to this form
@On Click = Event Procedure

= = =
Private Sub cmdAddNewRecord_Click()

On Error GoTo Err_cmdAddNewRecord_Click

' Save any current changes to the record

DoCmd.RunCommand acCmdSaveRecord

' Attempt to add a new record

DoCmd.GoToRecord , , acNewRec

Exit_cmdAddNewRecord_Click:

Exit Sub

Err_cmdAddNewRecord_Click:

MsgBox "Error " & Err.Number & ": " & Err.Description

Resume Exit_cmdAddNewRecord_Click

End Sub

= = =
Error Message
Stock Name and Stock Symbol already exists on the investments01_Tbl => OK

= = =
You can’t go to the specified record

Thank you Barbara
 
You don't need the save record command at all. ACCESS saves records automatically. If you can't add records, then check the record source and make sure it allows new records to be added. If you still can't add records then check the form properties. Someone changed something.
 

Users who are viewing this thread

Back
Top Bottom