How to Add an Access Button to Create a New Record
Question details
The user needs to add a command button to a Microsoft Access form that safely creates a new blank record without executing if the form is already on a new record.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Designing a database form and wanting to provide users with a clickable interface button to easily add new entries.
- Observed behavior
- A functioning command button that triggers a new record creation using VBA, safely evaluating the current form status to avoid duplicating commands.
Ensure your Microsoft Access database is open in Design View and that you have basic familiarity with the VBA (Visual Basic for Applications) editor.
Use VBA in the Click Event of a Command Button
Create a command button and assign a VBA script to its Click event to evaluate the current record state before adding a new one.
Using VBA provides precise control over form behaviors. By checking the form's NewRecord property first, you prevent Access from attempting to append a new row when the user is already positioned on a blank record, which avoids unnecessary errors.
Right-click your form in the Access navigation pane and select 'Design View' to begin editing the form layout.
Navigate to the Form Design tab on the ribbon, click the 'Button' control, and click anywhere on your form to place it. If the Command Button Wizard automatically opens, click 'Cancel' to close it.
Select the newly created button, press F4 to open the Property Sheet, navigate to the 'Other' tab, and type 'cmdYourNewAddButton' into the Name property.
Switch to the 'Event' tab within the Property Sheet, locate the 'On Click' property, click the ellipsis (...) button next to it, and select 'Code Builder'.
In the VBA editor that opens, paste the following code between the Private Sub and End Sub lines: 'If Not Me.NewRecord Then Me.Recordset.AddNew End If'. Save and close the VBA editor.

Need a Powerful, Free Alternative to Microsoft Office?
While WPS Office does not include a database management tool like Access, it serves as a highly compatible and lightweight alternative for Word, Excel, and PowerPoint. If you are looking to save on licensing costs for your daily document processing, WPS Office is an excellent choice.
- 1. Download the Installer: Visit the official WPS Office website and click the Free Download button.
- 2. Install WPS Office: Run the downloaded installer file and follow the straightforward on-screen instructions.
- 3. Start Creating Documents: Open WPS Office to instantly begin creating or editing your spreadsheets, documents, and presentations.

Frequently Asked Questions
Can I use macros instead of VBA to create a new record?
Yes. You can use the Command Button Wizard to automatically assign a macro that navigates to a new record. However, writing a custom VBA script offers more precise control, such as utilizing the Me.NewRecord check to prevent execution errors if the form is already displaying a blank entry.
What happens if I try to add a new record when I am already on one?
Without the 'If Not Me.NewRecord Then' validation check, Access might trigger a run-time error or unnecessarily refresh the blank state, which could disrupt the user's data entry workflow.
How do I ensure the current record is saved before clicking the new record button?
In Microsoft Access, navigating away from the current record to a new one automatically triggers a save action for the previous record's data, provided it passes all defined validation rules. Explicit save code is usually not required before executing Me.Recordset.AddNew.




