Update a field in a form

  • Thread starter Thread starter Vina
  • Start date Start date
V

Vina

I have two fields in the form, one is a drop down that
list all my items and the other is just a txt. What i
need is when I select an item I want the description to
automatically display on my other field (txt field)

Can someone help me on this?
 
Use a DLookUp in the Onchange or AfterUpdate event for the
ComboBox.

Assume you have the ComboBox for items (cboItems), a
TextBox for the description (txtDesc) and you're looking
up the data in your items table (tblItems, with fields
Item and Desc)

Dim strItem as String
Dim strDesc as String
strItem = [cboItems]
strDesc = DLookUp("[Desc]","tblItems", _
"[Item]='" & strItem & "'")
[txtDesc] = strDesc

Check the Help files for the details on DLookUps.

Hope this helps!

Howard Brody
 
Back
Top