Populating fields without Combo Box

S

sandrao

Is it possible to be able to have the ability to populate a without the use
of a combo box or list box. I have a list of subjects that include two
fields. One is subject "number" and the other is "Subject Theme". I would
like to type the number in a "upbound text box and on exiting have the
"Subject Theme" appear in the next field on the form. Can this be done
through VB or am I dreaming in color?

sandrao
 
C

Carl Rapson

sandrao said:
Is it possible to be able to have the ability to populate a without the
use
of a combo box or list box. I have a list of subjects that include two
fields. One is subject "number" and the other is "Subject Theme". I
would
like to type the number in a "upbound text box and on exiting have the
"Subject Theme" appear in the next field on the form. Can this be done
through VB or am I dreaming in color?

sandrao

You should be able to use the AfterUpdate event of the first text box to
populate the next field:

Me.txtNextField = Nz(DLookUp("[Subject Theme]","
","[Subject
Number]=" & Me.txtThisField),"")

You need the Nz() function because the user might enter an invalid value in
the subject number field. Or, you could put some error checking into the
BeforeUpdate event of the first textbox, and prevent the user from entering
invalid values at all.

Carl Rapson
 

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