主窗体"JSHW",对应表"purchase"(字段Part Code,Receive Quantity....); 子窗体"Inventory子窗体",对应表"Inventory"(字段Part Code, Quantity....).
希望主窗体中一次输入部件编码和接收数量到[Text6]和[Text10],分别存入和累加到上述两个表中:
代码可以这样编吗?
Private Sub......
Me![Part Code] = Me![Text6]
Me![Receive Quantity] = Me![Text10]
.......
Me![Inventory子窗体].SetFocus
DoCmd.FindRecord Me![Text6]
DoCmd GotoRecord, , acNewRec
If Me![Inventory 子窗体].[part Code]<>Me![Text6] Then
Me![Inventory 子窗体].[part Code]=me![Part Code]
Me![Inventory 子窗体].[Quantity]=0
Else
Me![Inventory 子窗体].[Quantity]=Me![Inventory 子窗体].[Quantity]+Me![Text10]
DoCmd..... acSaveRec.....
。。。。。
[此贴子已经被作者于2006-10-8 17:59:30编辑过]
|