S
Stella Pieters via AccessMonster.com
L.S.
First of all I would like to introduce myself as a newbie in VBA.
I've created an application for registrating clients and selling
contraceptives to them. I would like to update my inventory table as soon
as I enter the qty of contraceptives sold.
I've created the following code, but it does not function. I keep on
getting an error telling em that "does not recognize the referenced field."
My code is as follows:
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
err_Form_AFterUpdate:
Exit Sub
Can you please help me with this?
Thanks in advance for your kindness.
Stella Pieters
First of all I would like to introduce myself as a newbie in VBA.
I've created an application for registrating clients and selling
contraceptives to them. I would like to update my inventory table as soon
as I enter the qty of contraceptives sold.
I've created the following code, but it does not function. I keep on
getting an error telling em that "does not recognize the referenced field."
My code is as follows:
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
err_Form_AFterUpdate:
Exit Sub
Can you please help me with this?
Thanks in advance for your kindness.
Stella Pieters