Answers for "How to use VBA to add new record in MS Access?"

VBA
0

How to use VBA to add new record in MS Access?

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
Posted by: Guest on February-01-2022

Code answers related to "How to use VBA to add new record in MS Access?"

Code answers related to "VBA"

Browse Popular Code Answers by Language