From the course: Access: VBA

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add a new record to a table

Add a new record to a table

From the course: Access: VBA

Start my 1-month free trial

Add a new record to a table

- [Curtis] Every time your business hires a new employee, accepts a new order, or adds a customer, you need to enter that information into your database. In this movie I'll show you how to add a new record to a table. I have opened the course database and now I need to switch over to the visual basic editor. To do that I'll press alt F11. We're here in the visual basic editor and I need to add a code module. So, I will click insert, and module. And there I have my blank code module. I'll create a sub routine to add a new record to a table. So, I'll call it sub add new record. I'm not going to pass any information or any arguments so I'll just use an open and close parenthesis and enter. And you see that access adds the end sub statement marking the end of a sub routine. The first thing you need to do is to define a record set variable. So, I will dim myR, just short for my record set, as recordset. Next I need to assign a particular record set which could be a table or a query to that…

Contents