Let me start by saying that I'm a newbie in VBA.
I've created an application in access where the user enters the quantity of
the items sold in a form. I would like to have these records created in a
table, mentioning the qty sold, the transaction date etc. this table I'm
planning to use afterward to calculate the quantity on hand.
I have created the following code, but I keep on receiving the error, that
it does not recognize the fields mentioned in the code.
Private Sub Form_AfterUpdate()
Dim rst As DAO.Recordset
Dim mdbLocal As DAO.Database
Set mdbLocal = DBEngine(0)(0)
Set rst = mdbLocal.OpenRecordset("visits", dbOpenDynaset, dbAppendOnly)
If Me![Owndepomys] = False Then
[Inventory.Storeroom] = "FP02"
[Inventory.TransactionDate] = Me![Datevisit]
[Inventory.Artcode] = DLookup("[ArtCode]", "Contraceptives", "
[Description]=" & Forms![visits]!Description)
[Inventory.Description] = Me![Contraceptives]
[Inventory.TransactionDescription] = "Over the counter"
[Inventory.UnitsSold] = Me![Qty]
[Inventory.Qtyonhand] = [Inventory.Qtyonhand] - Me![Qty]
[Inventory.AmountQty] = [Inventory.AmountQty] * Me!
[Contraceptives.Price]
rst.AddNew
End If
End Sub
--
Message posted via http://www.accessmonster.com