How do I use data from other fields in a found record

  • Thread starter A.J.M. van Rijthoven
  • Start date

A

A.J.M. van Rijthoven

I have a table instrumenten (INSID Instrumentname, CATID), a table
Categorie (CATID, Categorydescription), Netten (NETID, description of
net) and a table (kpltblinstrument) that links the instruments to a
specific net (NETID, INSID, amount).
I have a form which displays the name of the net and it holds a the
subform from table lnknetins. I have two unlinked fields (combobox) on
the form (voorlopigcategorie and voorlopiginstrument). When I select a
category, the following code provides a query for the
voorlopiginstrument combobox.

If voorlopigcategorie.Text = "-" Then
PublicSql = "SELECT
Instrumenten.instrumentnaam,instrumenten.insid, Instrumenten.categorie
FROM Instrumenten;"
Else
PublicSql = "SELECT
instrumenten.Instrumentnaam,instrumenten.insid, instrumenten.Categorie
FROM instrumenten WHERE
(((instrumenten.Categorie)=[Forms]![Inhoud_van_net]![voorlopigcategorie].[value]));"
End If
voorlopiginstrument.RowSource = PublicSql

Now I want to fill the field INSID on my subform with the INSID from
the selected instrument in voorlopiginstrument.
Voorlopiginstrument.value only gives me the name of the instrument and
not the INSID.
How do I do this??

Simplified:
I've looked up a record in a table based on a name and now I want to
use another field of the found record and place its value in another
record. How do I do this??
 
Ad

Advertisements

K

Ken Snell

Reference the column of the combo box and you can get it. In this case,
INSID is the second column/field of the combo box row source query, right?
Column is a zero-based property, so you can get the value of the second
column using this expression:

ValueOfSecondColumn = Me.voorlopiginstrument.Column(1)
 

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