709-218-7927

The Landfall Garden House

60 Canon Bayley Road

CANADA A0C 1B0

CPRGreaves@gmail.com

Home

Christopher Greaves

Adding a New Record

In this lesson we will develop the program code to add a new record to our table; Access VBE will assist us in most of the work.

Create a new Command Button on your form, as before, but this time when the Wizard pops up, choose "Record Operations" from the left-hand pane and choose "Add New Record" from the right-hand pane.

Elect to use a text caption, and abbreviate the suggested text to "Add" - that's all we need to know about this button. We will call this button "cmd_AddRecord".

When you inspect the generated code you should see this:

Private Sub cmd_AddRecord_Click()
On Error GoTo Err_cmd_AddRecord_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmd_AddRecord_Click:
Exit Sub
Err_cmd_AddRecord_Click:
MsgBox Err.Description
Resume Exit_cmd_AddRecord_Click
End Sub

The essential line is "DoCmd.GoToRecord , , acNewRec".

7092187927 CPRGreaves@gmail.com

Bonavista, Friday, December 04, 2020 5:52 PM

Copyright © 1996-2020 Chris Greaves. All Rights Reserved.