auto populating a form

S

Sean

I have a table (called species_observation) with four
field's common_name, scientific_name, species_code, and
taxon_group. This table will be used as a pick list for
entries into another table.

My second table (called Wildlife_Observation) contains
records of observations of the species in the first table.

I have a form that I am using to populate the second table.

My question is this: I have many fields on the form but
my first four fields allow a person to enter the common
name, scientific name, species code, and taxonomic group
of a species. What I want is for the person to select the
common name of the species from the pick list and then
have it automatically fill in the scientific name, species
code, and taxon group fields.

Each of these for fields is combo boxes in the form but I
can change them to a text field if I figure out how to
have them autopopulate.

In the common name field, under the data tab, in the row
source I have selected from table 1 the first four fields
(common_name, scientific_name, species_code, and taxon
group in that order).

In the after Update, under the Event table, I have an
event procedure as shown below

Private Sub COMMON_NAME_AfterUpdate()
[scientific_name] = [common_name].Column(1)
[species_code] = [common_name].Column(2)
[taxon_group] = [common_name] .Column (3)
End Sub

The problem is when I enter the common name in the form it
automatically fills in the scientific name but then I get
an error and it will not populate the species code or the
taxon group. In addition, I still have to click on the
scientific name in order to have it fill in the table.

I am assuming something is wrong with my code? Any help
would be appreciated.
 
B

Bas Cost Budde

My question is this: I have many fields on the form but
my first four fields allow a person to enter the common
name, scientific name, species code, and taxonomic group
of a species. What I want is for the person to select the
common name of the species from the pick list and then
have it automatically fill in the scientific name, species
code, and taxon group fields.

That means the scientific name, species and group values depend on the
common name (in your database--I'd take the scientific name as key, but
that doesn't matter for the discussion).

Those values do not really belong in an input form. You could put
calculated fields there to show the other values, but you should not
store them in the table again.
In the after Update, under the Event table, I have an
event procedure as shown below

Private Sub COMMON_NAME_AfterUpdate()
[scientific_name] = [common_name].Column(1)
[species_code] = [common_name].Column(2)
[taxon_group] = [common_name] .Column (3)
End Sub

I take it these names are control names? And are these all comboboxes?
Are you sure the values you see are from the bound column? If not, you
cannot assign that way. (You shouldn't need to, either, but I already
said that).
The problem is when I enter the common name in the form it
automatically fills in the scientific name but then I get
an error

Ah shame! What error?
 

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