select query in a form

  • Thread starter Thread starter tdelob
  • Start date Start date
T

tdelob

Hi,

Here is my problem :

I have two tables :
table paf
PRIMARY KEY idnumber
name...

table pif
PRIMARY KEY pnumber
FOREIGN KEY idnumber...

I have made a form with pif values, in this form, I have
the value of the foreign key idnumber and I want to know
how to get the name value (from paf) in my form ?

I have to do something like "select name from paf where
idnumber=?"?
if so how to put a query in a form ? what to put at the
end of my query ?

otherwise how to do it ?

Thanks for your answers,

Tdelob
 
Tdelob,

Create a new query. Add both tables Pif and Paf. From table Pif, drag
the two fields 'pnumber' and 'idnumber' to the grid. From table Paf,
drag the field name to the grid. (BTW, using 'name' as a field name will
cause you problems because 'name' is a reserved word.)

Save the query as qryPifPaf.

Open the form in design mode. Click on the DATA tab. Change the
RecordSource from the table 'Pif' to the query 'qryPifPaf' (no quotes).
Save the form and close it. Re-open the form. That's it.


HTH

Steve
 
Back
Top