【发布时间】:2022-01-20 14:49:49
【问题描述】:
我计划通过表格在我的表格中搜索和更新符合我的条件的记录。 我希望我的代码在匹配时搜索 OrderNo 和 OrderNoItem(对于每个 orderno,我的表中有多个 OrderNoItem,例如 10,20,30 ...),我想从我的更新客户名称(Text18.Value)表格。
我有以下代码。出于某种原因,它只是只更新第一条记录。例如,当我输入 Text25.Value = 12345、Text27.Value = 20 和 Text49.Value = 40 时,它只更新 12345 和 20 行的客户名称。有人可以帮忙吗??
Set logDB1 = CurrentDb()
Set logRS1 = logDB1.OpenRecordset("Log")
For i = Text27.Value To Text49.Value Step 10
Do Until logRS1.EOF
If (logRS1![OrderNo] = Text25.Value And logRS1![OrderNoItem] = Text27.Value) Then
logRS1.Edit
logRS1![DTN-#] = Text18.Value
logRS1.Update
End If
logRS1.MoveNext
Loop
Next
【问题讨论】:
-
什么是数据结构?为什么客户名称会保存在 Log 表中?为什么你甚至需要这样做?
-
您是否在 [DTN-#] 中保存客户名称或客户 ID?
-
客户 ID 但也设置为文本字段