create a record in the inventory table

  • Thread starter Stella Pieters via AccessMonster.com
  • Start date
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
 
G

George Nicholson

Answered in Microsoft.Public.Access under "Help, Help with this code" on
6/6/05
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top