我目前正在将ADP 2010 access数据库迁移到accdb 2013,并且遇到了一个问题。
数据库的功能之一是用户可以根据日期、期间和员工姓名查询标注。然后将其导出为word文档索赔表单。
我们使用两个记录集来获取此信息,一个是rst_callouts (单个标注),另一个是rst_standby (备用日期,即星期一到星期五)。
word模板包含一个表格,其中详细说明了以下信息: Date From和To、call out描述、每日费率、索赔天数和总数。
rst_standy在没有问题的情况下输入信息,但是,rst_callouts仅导出汇率、索赔天数和总数。它缺少起始和终止日期以及描述。
我修改了脚本,它和rst_standy是一样的,但是它仍然不能正常工作。我甚至在SQL中运行了查询,它会返回结果,所以我知道ADOB.recordset也在工作。在这方面的任何帮助都会让我感激不尽,因为它会让我发疯。
' Get all newly raised Changes using 'rst_callouts'
' -------------------------------------------------------------
rst_callouts.Open "SELECT * FROM [dbo_qry_callout] " & _
"WHERE DateOfCallout >= #" & Format(StartDate, "mm/dd/yy#") & _
" AND DateOfCallout <= #" & Format(EndDate, "mm/dd/yy#") & _
" AND fk_StaffID = " & StaffID & _
" ORDER BY DateOfCallout;", con, adOpenKeyset, adLockOptimistic
If rst_callouts.RecordCount > 0 Then
rst_callouts.MoveFirst
rst_callouts.MoveLast
int_num_callouts = rst_callouts.RecordCount
rst_callouts.MoveFirst
End If
' This loop calculates all of the callouts to be used in the claim form
' ---------------------------------------------------------------------
For callout_looper = 1 To int_num_callouts
dummy_value = acbUpdateMeter(((int_num_standbys + callout_looper) / (int_num_standbys + int_num_callouts)) * 100)
With appWord
**.Selection.TypeText Text:=Format(rst_callouts!DateOfCallout, "dd/mm/yy")
.Selection.MoveRight Unit:=wdCell
.Selection.TypeText Text:=Format(rst_callouts!DateOfCallout, "dd/mm/yy")
.Selection.MoveRight Unit:=wdCell
.Selection.TypeText Text:=Format(rst_PriceList![PriceListDescription]) & " - #" & (rst_callouts!pk_CalloutID)**
.Selection.MoveRight Unit:=wdCell
.Selection.TypeText Text:=Format(rst_PriceList![DailyRate], "0.00")
.Selection.MoveRight Unit:=wdCell
.Selection.TypeText Text:="1"
.Selection.MoveRight Unit:=wdCell
.Selection.TypeText Text:=Format(rst_PriceList![TotalRate], "0.00")
.Selection.InsertRowsBelow 1
.Selection.MoveLeft Unit:=wdCell
End With
ClaimTotal = ClaimTotal + rst_PriceList![TotalRate]
rst_callouts.MoveNext
Next callout_looper
With appWord
.Selection.MoveRight Unit:=wdCell, Count:=5
.Selection.MoveDown
.Selection.TypeText Text:=Format(ClaimTotal, "0.00")
.Selection.MoveUp Unit:=wdLine, Count:=1
.Selection.Cells.Delete ShiftCells:=wdDeleteCellsEntireRow
End With发布于 2015-10-08 18:46:09
感谢Scott的帮助,这让我非常感激,让我走上了正确的道路。我通过删除DAO引用并优先使用ADO解决了这个问题。然后,我不得不删除我的ODBC并删除所有SQL表。然后我重新创建了ODBC,并重新导入了我所有的链接表,现在它可以工作了。可恶,这是一个让我束手无策的问题,再次感谢你帮助解决这个问题。
https://stackoverflow.com/questions/32995144
复制相似问题