
Originally Posted by
June7
The code is adding two records. Each Execute adds a record. Try:
db.Execute = "INSERT INTO Table1 (Part_Name, Description) VALUES ('" & txtPart_Name & "', '" & txtDescription & "')"
I am curious about why you do this. Do you have a table of parts and info about the parts? You are saving this info to a table of orders or something like that? If so why don't you just save the unique id for that part record? That could be done without any coding.
Is this how my code should look.
Code:
Dim db As DAO.Database
Set db = CurrentDb
db.Execute = "INSERT INTO Table1 (Part_Name, Description) VALUES ('" & txtPart_Name & "', '" & txtDescription & "')"
Steps taken.
1. Added the description column
2. Added the txtdescription textbox
3. Modified the code as above
4. Clicked and got an error
(COMPILE ERROR ARGUMENT NOT OPTIONAL)
and it refers to the txtdescription
db.Execute = "INSERT INTO Table1 (Part_Name, Description) VALUES ('" & txtPart_Name & "', '" & txtDescription & "')"
??
It does update the table which is nice except
1. The ERROR pops up each time
2. It overwrites ID22 which contains the part name and description I input in the textboxes each time.