If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Run a Query using VBA without User Interface
Hello,
I have a VBA Macro that Opens an Append Query (see below), which works great, except for the end user has to answer the following MsAccess prompts: 1) You are about to run an append query that will modify data in your table. (They have to click Yes) 2) You are about to append 1 row(s). (They have to click Yes) I'd rather them not have to answer either question. Instead I'd like the Append Query to run and do what it's asked without any human intervention. Can this be done? Please help! VBA Macro Code: DoCmd.OpenQuery "tblTask_List Query", acViewNormal, acEdit tblTask_List Query SQL Code: INSERT INTO tblTask_List ( Task_Description, Status, Area, Equipment_ID, Due_Date, Estimated_Duration, Actual_Duration, Assigned_Workgroup, Assigned_Person, Entered_By, Compliance_Task, Overdue_Flag, Notes, Status_Changed_By, Status_Changed_On, Completed_By, Completed_On, Document_Link_1, Document_Link_2, Document_Link_3, Document_Link_4, Recurring, Recurring_Days, Recurring_Until ) SELECT tblTask_List.Task_Description, tblTask_List.Status, tblTask_List.Area, tblTask_List.Equipment_ID, tblTask_List!Due_Date+tblTask_List!Recurring_Days AS [Recurring Due Date], tblTask_List.Estimated_Duration, tblTask_List. Actual_Duration, tblTask_List.Assigned_Workgroup, tblTask_List. Assigned_Person, tblTask_List.Entered_By, tblTask_List.Compliance_Task, tblTask_List.Overdue_Flag, tblTask_List.Notes, tblTask_List.Status_Changed_By, tblTask_List.Status_Changed_On, tblTask_List.Completed_By, tblTask_List. Completed_On, tblTask_List.Document_Link_1, tblTask_List.Document_Link_2, tblTask_List.Document_Link_3, tblTask_List.Document_Link_4, tblTask_List. Recurring, tblTask_List.Recurring_Days, tblTask_List.Recurring_Until FROM tblTask_List WHERE (((tblTask_List.Task_ID)=[Forms]![frmTask_List]![Task List Subform]. [Form]![Task_ID])); -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...eries/200911/1 |
#2
|
|||
|
|||
Run a Query using VBA without User Interface
Try this:
Run DoCmd.SetWarnings False DoCmd.OpenQuery "tblTask_List Query", acViewNormal, acEdit Run DoCmd.SetWarnings True Regards Kevin "Pasadena-D via AccessMonster.com" u56499@uwe wrote in message news:9fd41e1b4b9c7@uwe... Hello, I have a VBA Macro that Opens an Append Query (see below), which works great, except for the end user has to answer the following MsAccess prompts: 1) You are about to run an append query that will modify data in your table. (They have to click Yes) 2) You are about to append 1 row(s). (They have to click Yes) I'd rather them not have to answer either question. Instead I'd like the Append Query to run and do what it's asked without any human intervention. Can this be done? Please help! VBA Macro Code: DoCmd.OpenQuery "tblTask_List Query", acViewNormal, acEdit tblTask_List Query SQL Code: INSERT INTO tblTask_List ( Task_Description, Status, Area, Equipment_ID, Due_Date, Estimated_Duration, Actual_Duration, Assigned_Workgroup, Assigned_Person, Entered_By, Compliance_Task, Overdue_Flag, Notes, Status_Changed_By, Status_Changed_On, Completed_By, Completed_On, Document_Link_1, Document_Link_2, Document_Link_3, Document_Link_4, Recurring, Recurring_Days, Recurring_Until ) SELECT tblTask_List.Task_Description, tblTask_List.Status, tblTask_List.Area, tblTask_List.Equipment_ID, tblTask_List!Due_Date+tblTask_List!Recurring_Days AS [Recurring Due Date], tblTask_List.Estimated_Duration, tblTask_List. Actual_Duration, tblTask_List.Assigned_Workgroup, tblTask_List. Assigned_Person, tblTask_List.Entered_By, tblTask_List.Compliance_Task, tblTask_List.Overdue_Flag, tblTask_List.Notes, tblTask_List.Status_Changed_By, tblTask_List.Status_Changed_On, tblTask_List.Completed_By, tblTask_List. Completed_On, tblTask_List.Document_Link_1, tblTask_List.Document_Link_2, tblTask_List.Document_Link_3, tblTask_List.Document_Link_4, tblTask_List. Recurring, tblTask_List.Recurring_Days, tblTask_List.Recurring_Until FROM tblTask_List WHERE (((tblTask_List.Task_ID)=[Forms]![frmTask_List]![Task List Subform]. [Form]![Task_ID])); -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...eries/200911/1 |
#3
|
|||
|
|||
Run a Query using VBA without User Interface
Kevin,
It worked! Thanks for the help! kc-mass wrote: Try this: Run DoCmd.SetWarnings False DoCmd.OpenQuery "tblTask_List Query", acViewNormal, acEdit Run DoCmd.SetWarnings True Regards Kevin Hello, [quoted text clipped - 37 lines] WHERE (((tblTask_List.Task_ID)=[Forms]![frmTask_List]![Task List Subform]. [Form]![Task_ID])); -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|