【问题标题】:Access: Updating multiple records with the same number访问:更新具有相同编号的多条记录
【发布时间】:2024-01-19 14:55:01
【问题描述】:

我有一张产品表,每个产品都有一个序列号。还有另一个标记为 SOP 的字段。

基本上,当产品销售时,SOP 号(订单号)会出现在每个序列号旁边的字段中。

在我继续之前,当我说扫描时,这是因为所有内容都带有条形码。

我希望能够创建一个表单,我可以在其中扫描 SOP 编号,然后让它向下标记,我可以在其中扫描该 SOP 中的所有序列号。

然后需要使用相关的 SOP 编号更新每个扫描的序列号。

有什么想法吗?

【问题讨论】:

  • 您在这方面的进展如何?您可以将 SOP 扫描到表格上的文本框中吗?可以将序列号扫描到另一个文本框中吗?
  • 当前流程是有一个带有自动选项卡的组合框设置。串行扫描后,扫描 SOP。然后串行然后sop然后串行......等等。当一些订单有 50 多个连续剧时,这是相当痛苦的。
  • 对,通过避免为每个相关的序列号再次扫描相同的 SOP,您可以减少近 50% 的痛苦。我很高兴。您是否创建过包含子表单的表单?
  • 我不能说我有。你知道网上有什么 tuts 吗?

标签: forms ms-access vba auto-update


【解决方案1】:

你需要做的步骤是

1) Create an Orders table with a field for the SOP number
2) Create an Order Details table with field for the SOP number
3) Create a form with a data source of the Orders table
4) Add a subform to the Orders form relating/linking the two forms on the SOP number
5) On the Orders form, disable "Tab Stop" for all fields except the SOP number field.
6) On the Orders form make sure that the "Enter Key Behavior" for the SOP number field     is "Default". If you don't do this, when the SOP number is canned, any subsequent scans will go into the same field.
7) On the Orders form add an "After Update" Event Procedure to
  i) Test if a value has been entered in the SOP number field
    and if so
  ii)Set focus on the SOP number on the Order Detail subform
    otherwise set focus to the SOP number field on the Orders form
8) On the Order Details subform, disable "tab Stop" for all fields except the serial number field.
9) On the Order Details subform make sure that the "Enter Key Behavior" for the serial number field is "Default".
10) Make sure the scanner is programmed to emulate an enter key press (CR/LF) after each scan, this is the default for most scanners I believe.

扫描SOP编号后,如果找到条目,焦点将转移到子表单上的序列号字段,然后您可以开始扫描序列号。

SOP 编号字段的更新后事件示例

Private Sub OrderSopNumber_AfterUpdate()
  If Me.OrderSopNumber > "" Then
    Me.sfmOrderDetail.Form.OrderDetailSerialNumber.SetFocus
  Else
    Me.OrderSopNumber.SetFocus
  End If
End Sub

【讨论】: