访问建议子表单、记录集或临时表

问题描述

好的,首先我是 VBA 和 MSAccess 365 的菜鸟。我确定我没有正确地做所有事情。 也就是说,我正在开发一个库存数据库来跟踪工具库存。我们的订购系统有些陈旧,需要一次订购一件工具,而且我们对每个订单都有成本限制。我正在使用 dlookup 来获取现有数量并执行与订购目的的最大库存相比的计算。我想将计算出的订单输出一个子表单,其中零件号、工具名称和要订购的数量是临时显示的,而不是在表格中,用户可以选中或取消选中他们想要订购的项目,然后他们将不得不将零件编号一一复制到我们的订购系统中。 (或删除)在将子表单的内容输出到订单表中之前。我还将添加一个由订购系统生成的订单号。
我不确定是否应该尝试学习记录集、临时表,或者是否有办法将 vba 输出到子表单。这是我目前所拥有的,它目前正在输出一个消息框。这是我目前拥有的代码。 (请不要对我的代码太苛刻,我充其量只是一个新手)

Public Function LowStock()
City = "[" & Me.Combo4.Value & "]"
Tier = "[" & Me.Text20.Value & "]"
If IsNull(Me.Combo4.Value) Then
   MsgBox "You must select a City to Replenish",vbExclamation,"Error"
   Exit Function
End If
rowcount = DCount(City,"tblTools")
' go through the tools table by line and check on hand vs desired stock
' If onhand is less than 0,or equal to "N/A or Greater than the Tiervalue then skip it.
'If the onhand is lower than the Tiervalue Then calculate how many we need to order and get the tool name and the PID for it
For Item = 1 To rowcount
       OH = DLookup(City,"tbltools","Line = " & Item & "")
       If IsNull(OH) = True Then
           OH = 0
       End If
   Tierval = DLookup(Tier,"Line = " & Item & "")
   Select Case OH
       Case Is < 0
               'Do nothing
       Case Is > Tierval
               'Do nothing
       Case Is < Tierval
               Orderqty = Tierval - OH
               Toolname = DLookup("[Tool Name]","Line = " & Item & "")
               PID = DLookup("[ID]","Line = " & Item & "")
               If IsNull(PID) = True Then
                   PID = "N/A"
               End If
               MsgBox Orderqty & " " & Toolname & " " & PID & ""
   End Select
Next Item
End Function

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...