Hi,
I have a SQL query I am running in a form which pulls in some fields from two tables. Two of the fields, one from each table, has the same name.
How can I reference each field specifically in order to refer to the correct field?
Everytime I try anything other than the following, I get errors saying that the field doesn't exist:
SQL Query:
==========
sSQL = "SELECT " & _
"tblMobClients.Name, " & _
"tblMobContracts.ContractID, " & _
"tblMobContracts.Reference, " & _
"tblMobContracts.Name " & _
"FROM " & _
"tblMobClients, " & _
"tblMobContracts " & _
"WHERE " & _
"tblMobContracts.ClientID = tblMobClients.ClientID " & _
"ORDER BY " & _
"Reference"
Populate Array with Data:
=========================
While Not oM2.EOF
sContractArray(i, 0) = oM2("ContractID")
sContractArray(i, 1) = oM2("Reference")
sContractArray(i, 2) = oM2("Name") 'SAME NAME
sContractArray(i, 3) = oM2("Name") 'SAME NAME
I'd like sContractArray(i, 2) = tblMobClients.Name
and sContractArray(i, 3) = tblMobContracts.Name
How do I distinguish between the two?
Thanks,
Mav3000
I have a SQL query I am running in a form which pulls in some fields from two tables. Two of the fields, one from each table, has the same name.
How can I reference each field specifically in order to refer to the correct field?
Everytime I try anything other than the following, I get errors saying that the field doesn't exist:
SQL Query:
==========
sSQL = "SELECT " & _
"tblMobClients.Name, " & _
"tblMobContracts.ContractID, " & _
"tblMobContracts.Reference, " & _
"tblMobContracts.Name " & _
"FROM " & _
"tblMobClients, " & _
"tblMobContracts " & _
"WHERE " & _
"tblMobContracts.ClientID = tblMobClients.ClientID " & _
"ORDER BY " & _
"Reference"
Populate Array with Data:
=========================
While Not oM2.EOF
sContractArray(i, 0) = oM2("ContractID")
sContractArray(i, 1) = oM2("Reference")
sContractArray(i, 2) = oM2("Name") 'SAME NAME
sContractArray(i, 3) = oM2("Name") 'SAME NAME
I'd like sContractArray(i, 2) = tblMobClients.Name
and sContractArray(i, 3) = tblMobContracts.Name
How do I distinguish between the two?
Thanks,
Mav3000