Reputation: 495
I'm trying to setup a button that will setup a weeks worth of tasks in a task manager I created in Access. What I'm trying to get to happen is when you click a button it creates a record and fills in the values for fields "Task Name", "Task Description", "Company", "Priority", and "Status". Each of these fields is a combo box. I was trying to use something like this:
DoCmd.GoToRecord , , acNewRec
INSERT INTO tblTasks ([Task Name], [Task Description], [Company], [Priority], [Status]) _
VALUES ('Change Notice', 'Daily Task', 'Ginny's', '(2) Normal', 'Not Started')
I get a compile error when trying this and it's probably because this is butchered from SQL code. I'm not sure what the correct syntax is to add this to Access VBA.
Any help would be greatly appreciated!!
Upvotes: 0
Views: 589
Reputation: 56016
Try this:
CurrentDb.Execute("INSERT INTO tblTasks ([Task Name], [Task Description], [Company], [Priority], [Status]) VALUES ('Change Notice', 'Daily Task', 'Ginny''s', '(2) Normal', 'Not Started')")
Upvotes: 1