I have two tables which are as follows
1. Table Project now referred as tblProj, whose columns are
ID | ProjCode | ProjName | Country |.. | CountryName
2. Table Country as tblCountry, whose columns are
ID(PK) | Country
In tblProj I have stored input from the Form but the value stored in the country column Country of tblProj is the primary key value of the Country(in tblCountry)
Now I am trying to generate a code (ProjCode) which uses the actual requires the text value of "Country" in tblCountry, but when I refer to [Country] in tblProj I get the numeric value(its PK value).
I have tried to add a new column in tblProj as "CountryNam e" using the query
but this lists all the county name instead of just the particular country with the ID equal to the value stored in that particular row in tblProj
I have even tried to set "CountryNam e" using Dlookup in the form in the Private Sub_Country_Aft erUpdate() as
but this one does not seem to work.
I have an idea to modify the primary key of tblCountry which include the first character of each country but I just found out that calculated field values cannot be set as the primary key.
Thanks in advance :)
1. Table Project now referred as tblProj, whose columns are
ID | ProjCode | ProjName | Country |.. | CountryName
2. Table Country as tblCountry, whose columns are
ID(PK) | Country
In tblProj I have stored input from the Form but the value stored in the country column Country of tblProj is the primary key value of the Country(in tblCountry)
Now I am trying to generate a code (ProjCode) which uses the actual requires the text value of "Country" in tblCountry, but when I refer to [Country] in tblProj I get the numeric value(its PK value).
I have tried to add a new column in tblProj as "CountryNam e" using the query
Code:
SELECT list_country.ID, list_country.Country FROM tbl_project INNER JOIN list_country ON tbl_project.Country = list_country.ID WHERE (((list_country.ID)=[tbl_project].[Country]));
I have even tried to set "CountryNam e" using Dlookup in the form in the Private Sub_Country_Aft erUpdate() as
Code:
Me.CountryName = Dlookup("[Country]","[tblCountry]","[tbl_Country].[ID] = [Forms]![Project Form]![Country]")
I have an idea to modify the primary key of tblCountry which include the first character of each country but I just found out that calculated field values cannot be set as the primary key.
Thanks in advance :)
Comment