Can I run something similar to & Me.field & in SQL?

ClearlyAnIdiot

Registered User.
Local time
Tomorrow, 01:49
Joined
Aug 22, 2013
Messages
39
Right now, I have a a form that shows all of the information about a company, all based on 1 table. I also have a query where it shows all of the people related to a company, based on a tertiary table that shows each relationship. However, I need to enter the PK of the company every time I run the query. It goes like
Code:
SELECT [Company-personID].CompanyNo, [Company-personID].RolesPerformed, Individuals.Person, Individuals.Nationality, Individuals.HKIDorPassport, Individuals.Pastport, Individuals.Occupation, Individuals.Email, Individuals.[Contact Number], Individuals.Address, Individuals.PrevAdress, Individuals.PrevAddress2, [Company-personID].RolesPerformed.Value
FROM Individuals INNER JOIN [Company-personID] ON Individuals.[Person] = [Company-personID].[Person]
WHERE Companies.[CompanyNo] = [Company-personID].[CompanyNo];
Where Company-personID is the tertiary table and Individuals is the people table. Every time I use the query, it asks for the parameter value of "Companies.[CompanyNo]". I tried using the &s and me., but it said that there were missing operators. Was my syntax wrong, or is & Me.field & just impossible on SQL, and is there an alternative?
(P.S., the exact wording was WHERE & Me.Companies & = blah blah)
(P. P. S., pardon the pun at "pastport". I was sleepy)
 
So far I can see out of your SQL-string you haven't included the table "Companies", (therefore the query is asking for the "Companies.[CompanyNo]").
 
Ehehe, I just realised. How would you recommend me to put it in? It's the PK to the field "Companyno" in "Company-personID", by the way.
 
Try - and see what you get. :D
 
Based on my very limited skill in SQL, I can't debug the SQL string.
But I can answer to the question from the title :)
The equivalent is Forms!FormName!ControlName
where ControlName is the name of a control (usually the same with a field name) in the form that has FormName name.
 

Users who are viewing this thread

Back
Top Bottom