klynch0803
Registered User.
- Local time
- Today, 03:15
- Joined
- Jan 25, 2008
- Messages
- 102
When I run this command on the Receive Inventory it inserts into the table the Primary Key instead of the Item Name.. When I select the item on the form it shows the Item Name so why wouldn’t it insert that? The order of the table the Combo Box looks in is “PrimaryKeyID” “Item”
Code:
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
Dim strSQL As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("tdatinventoryrec", dbOpenDynaset)
Set rst2 = db.OpenRecordset("tdatPurchases", dbOpenDynaset)
With rst
.AddNew
!RecDate = RecDate.Value
!Item = Item.Value
!Qty = QtyInserted.Value
!Cost = Cost.Value
.Update
End With
With rst2
.AddNew
!ChkTo = VendorName.Value
!ChkDate = RecDate.Value
!ChkAmt = Cost.Value
.Update
End With
Set db = Nothing: Set rst = Nothing
Me.RecDate = ""
Me.Item = ""
Me.QtyEntered = ""
Me.Cost = ""
Me.Combo4 = ""
Me.VendorName = ""
RecDate.SetFocus
Exit_Command7_Click:
Exit Sub
Err_Command7_Click:
MsgBox Err.Description & Err.Number
Resume Exit_Command7_Click
End Sub