GDL said:
ok, thanks, but this is not exactly what i want (sorry for me bad english,
i'm Dutch)
A friend of mine has a bumper sticker which reads
"If it ain't Dutch, it ain't mutch!"
How can I take the value of a field with me to make a query.
I added a button to the form to run a query.
in this query I want to use the information of some of the fields of the
current Form
Form fields :
Fcompany = "Company name"
FCompanyAdress = "adress"
I didn't see any reference to "adress" in your Query, so I ignored it
(but it shouldn't be difficult to add).
I defined the following sample Tables:
[T_Employer]
ID_Employeur Societe
------------ --------------
138259760 Honeywell-Bull
946901361 Citroen
1159198283 Disney
[T_Salarié]
ID_Salarié nom prenom ID_Employeur
----------- ----------- ------ ------------
-1494118340 Clémenceau Georges 946901361
-991921913 deGaulle Charles 138259760
-172681506 Disney Walt 1159198283
1124876941 Mouse Mickey 1159198283
[L_inscriptions]
L_inscriptionsID Id_Salarié Formation
---------------- ----------- ---------
-1890549885 -1494118340 yyy
-1124983447 1124876941 mmm
360061960 -172681506 zzz
1865572554 -991921913 xxx
I defined Query [Q_Salarié] using the following SQL (similar to your Query):
SELECT T_Employer.ID_Employeur, T_Salarié.nom,
T_Salarié.prenom, L_inscriptions.Formation,
T_Employer.Societe
FROM (T_Employer INNER JOIN T_Salarié
ON T_Employer.ID_Employeur = T_Salarié.ID_Employeur)
INNER JOIN L_inscriptions
ON T_Salarié.ID_Salarié = L_inscriptions.Id_Salarié
WHERE (((T_Employer.ID_Employeur)=[FCompany]));
For example, if [FCompany] = 1159198283, this Query, in Datasheet View,
looks like this:
ID_Employeur nom prenom Formation Societe
------------ ------ ------ --------- -------
1159198283 Disney Walt zzz Disney
1159198283 Mouse Mickey mmm Disney
On [Form1] I placed the following two controls (among others):
In 1st list box, [FCompany], set properties as follows:
Name: FCompany
Row Source: T_Employer
Column Count: 2
Column Widths: 0;1
Bound Column: 1
After Update: M_Requery
In 2nd list box, [lbxLast], set properties as follows:
Name: lbxLast
Row Source: Q_Salarié
Column Count: 2
Column Widths: 0";1"
Bound Column: 1
Locked: Yes
Define Macro [M_Requery] to contain the following action:
Requery lbxLast
Clicking on a name in control [FCompany] causes the name(s) displayed by
List Box [lbxLast] to change to match the selected company name.