Forms in access

J

Joseph

I have a ID and a description in a table. How can I view automatically the
description as I enter the ID?
 
D

Damon Heron

On an unbound form, put a textbox for the ID entry.
Add another textbox for the description.
In the afterupdate event of the first textbox, put this code:

me.your2ndtextbox= nz(dlookup("yourdescriptionfield","yourtable",
"yourtableID = " & [yourfirsttextbox]),"")

Damon
 
D

Damon Heron

Actually, this might work better:

Private Sub Text0_AfterUpdate()
If IsNumeric(Me.Text0) Then
Me.your2ndtextbox = DLookup("yourdescriptionfield","yourtable",
"yourtableID = " & [yourfirsttextbox])
End If
End Sub

I am assuming the ID field is a number, by the way....

Damon
 

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