(the product name, cost and weight comes up for the first product in my product table regardless of what product number i type in)
This is the code that I found and I have placed it in the "after update" field of the "ProdID" field in my form.
Expand|Select|Wrap|Line Numbers
- Private Sub ProdID_AfterUpdate()
- Dim varProdName, varProdCost, varWeight As Variant
- varProdName = DLookup("ProdName", "Products", "ProdID =[ProdID] ")
- varProdCost = DLookup("ProdCost", "Products", "ProdID =[ProdID] ")
- varWeight = DLookup("weight", "Products", "ProdID =[ProdID] ")
- If (Not IsNull(varProdName)) Then Me![ProdName] = varProdName
- If (Not IsNull(varProdCost)) Then Me![ProdCost] = varProdCost
- If (Not IsNull(varWeight)) Then Me![Weight] = varWeight