Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting one piece of data automatically selects others

Status
Not open for further replies.

markswan20

Technical User
Jun 17, 2005
58
GB
I have created a drop down list of 5 items each varying in price is there a way i can create a list so that if a specific item is selected the relevant price is displayed in a different box on a form?

Cheers
Mark
 
Hi
I think this may help: thread702-923804
 
I have a form that uses a dlookup function. However, I also have the following:
A Table with Part Information, for example: tblPart
tblPart has the following field:
PartNo, PartDescription, PartCost, PartInvPrice

On my form, I have a combo box that refers to the part field in tblePart, example, ComboPartNo.
Then on the AfterUpdate Event for the ComboPartNo Control I have the following code.
Code:
Private Sub ComboPartNo_AfterUpdate()
    Dim TxtBox As TextBox
[COLOR=green] ‘Set the txtbox = to the control where you want the price to automatically update [/color]
    Set TxtBox = Forms![FormName]![ControlName]

    TxtBox.Value = DLookup("[PartInvPrice]", "[tblePart]", "[PartNo]='" _
        & [Forms]![FormName]![ComboPartNo] & "'")
End sub
 
Thank you for your posts,

I'm a little confused by both but i'll have a go and see what i can do.

Thank You
Mark
 
How are ya markswan20 . . . . .

Include the [blue]price field[/blue] in the combobox then:
Code:
[blue]Me![purple][b]TextboxName[/b][/purple] = Me![purple][b]ComboboxName[/b][/purple].Column(2)[/blue]
You may have to play with the column number to get it right.

Be aware: the [blue]column index starts at zero[/blue] and includes any hidden columns in the [blue]Column Widths[/blue] property.

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top