How To Use Vba To Add New Record In Ms

[Solved] How To Use Vba To Add New Record In Ms | Vb - Code Explorer | yomemimo.com
Question : How to use VBA to add new record in MS Access?

Answered by : green-team

Private Sub btnAddRecord_Click()
Dim tblCustomers As DAO.Recordset
Set tblCustomers = CurrentDb.OpenRecordset("SELECT * FROM [tblCustomers]")
tblCustomers.AddNew
tblCustomers![Customer_ID] = Me.txtCustomerID.Value
tblCustomers![CustomerName] = Me.txtCustomerName.Value
tblCustomers![CustomerAddressLine1] = Me.txtCustomerAddressLine1.Value
tblCustomers![City] = Me.txtCity.Value
tblCustomers![Zip] = Me.txtZip.Value
tblCustomers.Update
tblCustomers.Close
Set tblCustomers = Nothing
DoCmd.Close
End Sub

Source : https://stackoverflow.com/questions/39109270/how-to-use-vba-to-add-new-record-in-ms-access/39124798 | Last Update : Tue, 08 Feb 22

Answers related to how to use vba to add new record in ms access

Code Explorer Popular Question For Vb