automatic updation

umairidris

New member
Local time
Today, 16:44
Joined
May 3, 2009
Messages
2
in my database i had a table named as Products with atrribute Product,UnitPrice,Discount,I had made a form on the table.I want to update the UnitPrice and Discount box automatically according to the products name.What is the method to do so.Plz tell me as soon as possible.thnks
 
Add a ComboBox to your form and select #3 from the wizard.
 
it is not working i had done this following coding in the after updare property of product but it is giving error.plz tell me my mistake.
Private Sub Product_AfterUpdate()
On Error GoTo Err_Product_AfterUpdate

Dim strFilter As String

' Evaluate filter before it's passed to DLookup function.
strFilter = "Product = " & Me!Product

' Look up product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)

' Look up product's Medicine-Discount and assign it to MedicineDiscount control.
Me!MedicineDiscount = DLookup("MedicineDiscount", "Products", strFilter)

Exit_Product_AfterUpdate:
Exit Sub

Err_Product_AfterUpdate:
MsgBox Err.Description
Resume Exit_Product_AfterUpdate

End Sub
 
Does your form have a RecordSource of Products? If not then make it so. Then do as I suggested in post #2. You do not need any DLookup's to make this work. The new cbo will not be bound to any field.
 

Users who are viewing this thread

Back
Top Bottom