|
表 订单 字段 – OrderID 是 自动编号,
新增 CustomerID Qty Item 时都可以正常完成。
可是很奇怪,
明明已经Update资料集 却无法取得 OrderID的值,
Dim mlOrderID As Variant
Dim rs As New ADODB.Recordset
Dim varBkmk As Variant
rs.ActiveConnection = CurrentProject.Connection
With rs
.Open "tblOrders", , adOpenStatic, adLockOptimistic, adCmdTable
.AddNew
!CustomerID = Me.CustomerID
!Item = Me.Item
!Qty = Me.Qty
!UnitPrice = Me.UnitPrice
.Update
mlOrderID = !OrderID ' Get OrderID from new record
MsgBox "New OrderID is " & mlOrderID, vbOKOnly '为何会出差错
.Close
End With
Set rs = Nothing
[em00][em00][em00]
|
|