简体   繁体   English

访问插入问题,无法一次更新大量值

[英]ACCESS Insert Into issue , unable to update lot of values at once

CurrentDb.Execute "INSERT INTO Data ([Region],[Office],[Employee Name],[Role],[Email ID],[T1 - New File Creation],[T1 - Roll forward],[T1 - Final package (PDF)],[T1 - Final package (paper)],[T1 - Efiling],[T1 - paper filing],[T1 - pre-season package (PDF)],[T1 -pre-season package (paper)],[T1 -FROR Checklist DESC Service check],[T1 - DT1 Intake and Initiate],[T1 - Scan and validate],[T1 - CRA website document downloads (Pulling NOA and other tax)],[T2 -New file creation],[T2 -Roll forward],[T2 -Final package (PDF)],[T2 -Final package (paper)],[T2 -Efiling],[T2 - Returns],[T3 - New file creation],[T3 - Roll forward],[T3 -Final package (PDF)],[T3 -Final package (paper)],[T3 - Net filing],[T3 -Paper filing])" & _
"VALUES ('" & Me.Region.Value & "','" & Me.Office.Value & "','" & Me.Employee_Name.Value & "','" & Me.Role.Value & "', '" & Me.Email_ID.Value & "','" & Me.T1___New_File_Creation.Value & "','" & Me.T1___Roll_forward.Value & "','" & Me.T1___Final_package__PDF_.Value & "','" & Me.T1___Final_package__paper_.Value & "','" & Me.T1___Efiling.Value & "','" & Me.T1___paper_filing.Value & "','" & Me.T1___pre_season_package__PDF_.Value & "','" & Me.T1__FROR_Checklist_DESC_Service_check.Value & "','" & Me.T1___DT1_Intake_and_Initiate.Value & "','" & Me.T1___Scan_and_validate.Value & "','" & Me.T1___CRA_website_document_downloads__Pulling_NOA_and_other_tax_.Value & "','" & Me.T1___CRA_website_document_downloads__Pulling_NOA_and_other_tax_.Value & "','" & Me.T2__New_file_creation & " ','" & Me.T2__Roll_forward & "','" & Me.T2__Final_package__PDF_ & "','" & Me.T2__Final_package__paper_ & "','" & Me.T2__Efiling & "','" & Me.T2___Returns & "'", & _
'" & Me.T3___New_file_creation & "','" & Me.T3___Roll_forward & "','" & Me.T3__Final_package__PDF_ & "','" & Me.T3__Final_package__paper_ & "','" & Me.T3___Net_filing & "','" & Me.T3__Paper_filing & "') ;"
CurrentDb.Execute "INSERT Into Data ([T3 - New file creation],[T3 - Roll forward],[T3 -Final package (PDF)],[T3 -Final package (paper)],[T3 - Net filing],[T3 -Paper filing])" & _
"Values ('" & Me.T3___New_file_creation & "','" & Me.T3___Roll_forward & "','" & Me.T3__Final_package__PDF_ & "','" & Me.T3__Final_package__paper_ & "','" & Me.T3___Net_filing & "','" & Me.T3__Paper_filing & "') & "
CurrentDb.Execute "INSERT INTO Data ([T4_T5 - New file creation],[T4_T5 - Roll forward],[T4_T5 - Final package (PDF)],[T4_T5 -Final package (paper)],[T4_T5 - Netfiling],[T4_T5 - Paper filing])" & _
"Values ('" & Me.T4_T5___New_file_creation & "','" & Me.T4_T5___Roll_forward & "','" & Me.T4_T5___Final_package__PDF_ & "','" & Me.T4_T5__Final_package__paper_ & "','" & Me.T4_T5___Paper_filing & "') & "
CurrentDb.Execute "Insert Into Data ([T3010 - New file creation],[T3010 -Roll forward],[T3010 - Final package (PDF)],[T3010 - Final package (paper)],[T3010 - Paper filing])" & _
"Values ('" & Me.T3010___New_file_creation & "','" & Me.T3010__Roll_forward & "','" & Me.T3010___Final_package__PDF_ & "','" & Me.T3010___Final_package__paper_ & "','" & Me.T3010___Paper_filing & "') & "
CurrentDb.Execute "Insert Into Data ([US tax -Letters(templafy & ms word)],[US tax -Printing/assembly(Dti)],[US tax - Printing/assembly(PDF)],[US tax  - Printing/assembly(paper)],[Us tax - Paper filing]) " & _
"Values ('" & Me.US_tax__Letters_templafy___ms_word_ & "','" & Me.US_tax__Printing_assembly_Dti_ & "','" & Me.US_tax___Printing_assembly_PDF_ & "','" & Me.US_tax____Printing_assembly_paper_ & "','" & Me.Us_tax___Paper_filing & "') & "
CurrentDb.Execute "Insert Into Data ([USPT returns -Scan client information to pdf],[USPT returns -Printing/Assembly (CCH Axcess)],[USPT returns- Printing/Assembly (paper)],[USPT returns -Efiling],[USPT returns -Paper filing])" & _
"Values ('" & Me.USPT_returns__Scan_client_information_to_pdf & "','" & Me.USPT_returns__Printing_Assembly__CCH_Axcess_ & "','" & Me.USPT_returns__Printing_Assembly__paper_ & "','" & Me.USPT_returns__Efiling & "','" & Me.USPT_returns__Paper_filing & "') & "
CurrentDb.Execute "Insert Into Data ([GES tax - Finalize and mail],[GES tax - Finalize and pdf],[GES tax - Scanning],[O&E submissions],[EL Draft],[EL Finalize])" & _
"Values ('" & Me.GES_tax___Finalize_and_mail & "','" & Me.GES_tax___Finalize_and_pdf & "','" & Me.GES_tax___Scanning & "','" & Me.O_E_submissions & "','" & Me.EL_Draft & "','" & Me.EL_Finalize & "') & "

When I tried creating only one CurrentDB.Execute to update values it is not happening.当我尝试只创建一个 CurrentDB.Execute 来更新值时,它没有发生。 When I created multiple currentdb.execute it is only working for the firstone.当我创建多个 currentdb.execute 时,它仅适用于第一个。

Can anyone please modify the currentdb code and help me out.任何人都可以修改 currentdb 代码并帮助我。

Insert a DoEvents command before each CurrentDb.Execute or, better, use DAO and the power of Access and open Data as a DAO.Recordset .在每个CurrentDb.Execute之前插入一个DoEvents命令,或者更好的是,使用DAO和 Access 的功能并将Data作为DAO.Recordset打开。

Then use methods .AddNew and .Update to insert the seven sets of values - it will run way faster and with much cleaner code than the multiple calls for CurrentDb.Execute and the SQL concatenating.然后使用方法.AddNew.Update插入七组值 - 与多次调用CurrentDb.Execute和 SQL 连接相比,它将运行得更快,代码更简洁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM