Update a field in a form

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?
 
H

Howard Brody

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top