ACCESS插入问题,无法同时更新大量值


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 & "') & "

当我尝试只创建一个CurrentDB.Execute来更新值时,它没有发生。当我创建多个currentdb.execute时,它只适用于第一个。

有人能修改currentdb代码并帮助我吗。

在每个CurrentDb.Execute之前插入一个DoEvents命令,或者更好地使用DAO和Access的功能,并将Data作为DAO.Recordset打开。

然后使用方法.AddNew.Update插入这七组值——它将比多次调用CurrentDb.Execute和SQL连接运行得更快,代码也更干净。

最新更新