Run SQL (INSERT INTO Booking " & "(Member ID, Court ID) " & " VALUES (11, 1);) which works but when i add the next fields the date and time and i get a 3134 error Do Cmd.Run SQL ("INSERT INTO Booking " & "(Member ID, Court ID, Date, Time) " & " VALUES (11, 1, #25/06/06#, );") ive changing the # and ' doing various combinations of the two.
Working from the Access query design window you are limited to the four query types described above, but using SQL in conjunction with VBA (or by entering SQL directly into the SQL view of the Access query design window) you can accomplish a lot more, including the use of "data-definition queries" which are used to build and modify the structure of the database itself.
The Run SQL method prompts you for two arguments, the SQL Statement itself which must be supplied as a string (i.e.
You can't run any sort of SQL statement using the Run SQL method, it is specifically for running the type of queries that Access calls "action queries".
These include Delete Queries (used to delete records from a table), Append Queries (used to add records to a table), Update Queries (used to edit records in a table) and Make Table Queries (used to create a new table).
it should be enclosed in quotes) and Use Transaction which is optional: The second argument concerns Transaction Processing and assumes True if you omit it.
When transaction processing is applied to a query, Access first performs a "dry run" of the query during which it writes all the changes to a temporary log file but does not make any permanent changes to the database.
To do this the user will open an unbound form to select a product from a combo box, and enter a new updated price in the textbox.
The code which creates and executes the SQL Statement will run when the Update command button is clicked.
Here is my code: Private Sub btn Remove From Group_Click() Dim st Doc Name As String Dim Var Item As Variant Dim sqlcmd As String For Each Var Item In Me.