Populating fields without Combo Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Back
Top