为糟糕的英语语法道歉:这是一个图书销售数据库,我有更新“库存”字段的一些问题 - 从书籍(book_id,价格,库存)表 - “销售”形式的值,有关于如何的子表格很多以“销售”形式出售的书(book_id,qty)。 请帮助,谢谢
答案 0 :(得分: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
如果此类内容有帮助,或者您需要我更新,请告诉我。