试图设计表单来查询和编辑记录访问

试图设计表单来查询和编辑记录访问

问题描述:

我正在尝试使Access数据库在条形码列表中进行扫描,为它们批量编辑信息,然后保存所有记录。之后,他们需要再次扫描以批量编辑更多信息,例如发货和订单号码。试图设计表单来查询和编辑记录访问

有没有人有如何最好地设计这个建议?首先,我已经(1)为“订单”和“零件”制作了单独的表格,(2)创建了一个文本框和一个按钮,试图将这些信息应用于通过条形创建记录的零件子表单码扫描器。我是一个相当新的Access设计师。谢谢!

的问题是:

  1. 我不知道如何查询通过条形码(PART_ID场)这些记录后,以订单信息适用于他们。
  2. 我目前无法通过我的表单一次更新所有新零件记录。

这里有一个关于如何去做的小指南。如果您有任何问题,请告诉我。

Dim db As DAO.Database 
Dim Rs As DAO.Recordset 

'Here is an example of a vba qarry in access. tblOrdersWhere is obviously your table. 
'orderNum is a column name in your table pref a primary key 
'txtOrderNum.Value is the value of a text box 
'If you want just a simple select * from table you can put after db.OpenRecordset("tblOrders") 

set rs = db.OpenRecordset("Select * from tblOrders Where orderNum like '*" & txtOrderNum.Value & "*';", dbOpenDynaset) 


'This is how you update records in Access 
'If you want to update it's Rs.Edit instead of Rs.AddNew 

    Rs.AddNew 
    Rs("OrderItem").Value = txtGroupName.Value 
    Rs("OrderTime").Value = txtGroupNum.Value 
    rs.Update 
+0

谢谢!当我尝试你的简单选择语句时,我得到错误91(对象变量未设置),并且当我尝试较长的时候,我得到424,所需的对象。有任何想法吗? 我应该在父窗体中使用文本框还是子窗体运行此代码?我主要是通过每个记录的按钮来尝试子窗体,但也是父窗体上的主按钮。 – tmct 2014-11-08 15:58:36