Insert Command
To insert data to a specific field using "Update" option to a table directly from a form, use the following code:
DoCmd.RunSQL "INSERT INTO TABLE1 (FIELD1, FIELD2) " & _
"VALUES ('SOME TEXT', 'SOME TEXT')"
Update Command
To update the database directly from a form, use the following code:
DoCmd.RunSQL "UPDATE Table1 SET [Field1]= " & me.text1 & _
", [Field2]= " & me.text2 & " WHERE [Field3]= '" & me.text3 & "';"
Delete Command
To delete all data from a specific table, use the following code:
DoCmd.RunSQL "DELETE * FROM Table1"

Post a Comment