Can anyone solve my mystery? I can't figure out why the "parts" and "price" field aren't being filled in when I enter in the parts#.
Here are the two tables involved:
Parts_List - contains the lookup info; PartsNo, Parts, Price.
tblParts - holds the information pulled from the Parts_lIst table. This contains the fields; Parts#, Parts, Price.
This is my OnChange Event Procedure for the "Parts#" field of my "tblParts subform":
Private Sub Parts_Change()
Dim varPrice, varParts As Variant
varPrice = DLookup("Price", "Parts_List", "Parts# =[PartsNo]"
varParts = DLookup("Parts", "Parts_List", "Parts# =[PartsNo]"
If (Not IsNull(varPrice)) Then Me![Price] = varPrice
If (Not IsNull(varParts)) Then Me![Parts] = varParts
End Sub
My Row Source Type is a table/query, and the Row Source is the "Parts_List" table, which is where I hold the list of PartsNo, Parts, and Price.
The control source (for the PartsNo selection from the Parts_List table) is "Parts#".
I hope that makes sense and someone can save me from staring at this for another hour.
jo
Here are the two tables involved:
Parts_List - contains the lookup info; PartsNo, Parts, Price.
tblParts - holds the information pulled from the Parts_lIst table. This contains the fields; Parts#, Parts, Price.
This is my OnChange Event Procedure for the "Parts#" field of my "tblParts subform":
Private Sub Parts_Change()
Dim varPrice, varParts As Variant
varPrice = DLookup("Price", "Parts_List", "Parts# =[PartsNo]"
varParts = DLookup("Parts", "Parts_List", "Parts# =[PartsNo]"
If (Not IsNull(varPrice)) Then Me![Price] = varPrice
If (Not IsNull(varParts)) Then Me![Parts] = varParts
End Sub
My Row Source Type is a table/query, and the Row Source is the "Parts_List" table, which is where I hold the list of PartsNo, Parts, and Price.
The control source (for the PartsNo selection from the Parts_List table) is "Parts#".
I hope that makes sense and someone can save me from staring at this for another hour.
jo