0

为糟糕的英语语法道歉:这是一个图书销售数据库,我在更新“库存”字段时遇到了一些问题 - 来自图书(book_id,价格,库存)表 - “销售”形式的值,有关于多少种类的子表格以“销售”形式售出的图书数量 (book_id, qty)。请帮忙,谢谢

4

1 回答 1

1

更新:

如果要编辑记录,可以执行以下操作:

'this will create the recordset variable and a string variable
Dim myR As Recordset
Dim strSQL as String    

'to find the record you want to edit use this and then set your recordset to this query
strSQL = "Select * From Books Where book_id = '" & Me.Book_I_Want_To_Edit_Field & "'"

'make the table strSQL your table to work with
Set myR = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)


'you can set your subform fields or controls here
Me.Sales_Details.Form.Field_in_subform_to_edit = MyR![Inventory]

'you need this to edit it
myR.Edit

'Modify everything here with vba

'then update it
myR.Update

'clear the variable
Set myR = Nothing

让我知道这样的事情是否会有所帮助,或者您是否需要我对其进行更新。

于 2013-06-11T14:26:28.600 回答