Access From and Data Setup

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

Guest

The first field I have a field in a form, Idenitifes Land Tracts by number.
The second field is the tract name. In order to expedite filling in the form
when inspecting individual tracts, I want the corresponding tract name to
auto fill in in the second field when I type in the tract number.

How do I do this please.
 
on the after update event of the track number write the following

dim TrackName as string
TrackName=nz(dlookup("TrackName","TrackTable","TrackNumber=" &
me.trackNumber),"")
if TrackName="" then
msgbox "No name"
else
me.trackName=TrackName
endif
 
The first field I have a field in a form, Idenitifes Land Tracts by number.
The second field is the tract name. In order to expedite filling in the form
when inspecting individual tracts, I want the corresponding tract name to
auto fill in in the second field when I type in the tract number.

How do I do this please.

Don't attempt to store the tract name twice!

I'd suggest using a Combo Box control based on the table of tracts.
Use a two-column combo box with the tract number and tract name; if
the tract numbers are meaningful to the user leave both columns
visible by setting nonzero widths in the ColumnWidths property, or if
it's an Autonumber or some other meaningless number that users won't
know, set its width to zero to just display the name.

If you want to show both the number and the name, put a textbox on the
Form with a control source

=comboboxname.Column(1)

using your combo box's name; the Column property is zero based so this
will show the *second* column.

John W. Vinson[MVP]
 
Back
Top