Insert Values into Table Through Form By using VBA Macros

     

  • InsertValues_into_Table_ThroughForm_By_using_VBA Macros
  •  

     

    Private Sub Cmdbutton_Click()
    Dim db As Database
    Set db = CurrentDb
    Dim rs As Recordset
    Set rs = db.OpenRecordset("Sales")
    rs.AddNew
    rs!ID = Me.ID.Value
    rs!Item = Me.Item.Value
    rs!Quantity = Me.Quantity.Value
    rs!Price = Me.Price.Value
    rs!Location = Me.Location.Value
    rs.Update
    rs.Close
    Set rs = Nothing
    Set db = Nothing
    MsgBox ("Hi Pavan Inserted Record")
    End Sub