S
Sam
Hi everyone!
Thanks, btw for all the great previous help, ya'll are a
great tool in learning the in & outs of Access. And I hope
you all will also be able to help me once again.
Problem:
I have a combobox & several textboxes on a subform. I'd
like for the select in the combobox to "automatically"
fill-in the correct data in the correct text boxes. I have
the code below, but it seems to be giving me some issues.
Namely entering the incorrect data in the textboxes (it
seems to be stuck on showing just one or two entries
regardless of what is chosen in the combobox.
Combobox name: Product Name
Textbox1: Description
Textbox2: UnitPrice
The table in which I'd like to 'pull' all the info
is: 'Product'
Code:
Private Sub ProductName_AfterUpdate()
' Update Description controls based on value selected in
ProductName combo box.
Dim varDesc As Variant
varDesc = DLookup("[Description]", "Product")
varUnitPrice = DLookup("UnitPrice", "Product")
If (Not IsNull(varDesc)) Then Me![Description] = varDesc
If (Not IsNull(varUnitPrice)) Then Me![UnitPrice] =
varUnitPrice
End Sub
Thanks for all your help! =)!!
sam
Thanks, btw for all the great previous help, ya'll are a
great tool in learning the in & outs of Access. And I hope
you all will also be able to help me once again.
Problem:
I have a combobox & several textboxes on a subform. I'd
like for the select in the combobox to "automatically"
fill-in the correct data in the correct text boxes. I have
the code below, but it seems to be giving me some issues.
Namely entering the incorrect data in the textboxes (it
seems to be stuck on showing just one or two entries
regardless of what is chosen in the combobox.
Combobox name: Product Name
Textbox1: Description
Textbox2: UnitPrice
The table in which I'd like to 'pull' all the info
is: 'Product'
Code:
Private Sub ProductName_AfterUpdate()
' Update Description controls based on value selected in
ProductName combo box.
Dim varDesc As Variant
varDesc = DLookup("[Description]", "Product")
varUnitPrice = DLookup("UnitPrice", "Product")
If (Not IsNull(varDesc)) Then Me![Description] = varDesc
If (Not IsNull(varUnitPrice)) Then Me![UnitPrice] =
varUnitPrice
End Sub
Thanks for all your help! =)!!
sam