@Micron - I've changed both the Country and States tables to have an auto-number as thier primary key.
The schema for COUNTRY table now looks like:
COUNTRIES - {Country_ID,Country_name}
The Row Source for the combo box is the following query:
Code:
SELECT Countries.Country_ID, Countries.Country_Name
FROM Countries
ORDER BY Countries.Country_Name;
This works fine now.
I'm having trouble getting the cascading STATE combo box to work when the subform is first painted and embedded in an outer form. Neither States nor Country are present in the outer form.
The schema for the STATES table is:
STATES - {State_ID,State_Name,Country_ID}
The Row Source for the combo box is the following query:
Code:
SELECT STATES.State_ID, STATES.State_Name
FROM STATES
WHERE (((STATES.Country_ID)=[forms]![UserNames_SF1]![SF_Country_ID]))
ORDER BY STATES.State_Name;
When the UserNames_SF1 subform is first painted, the SF_State combo box doesn't appear immediately, instead I get a parameter prompt for forms.UserNames_SF1.SF_Country_ID.
UserNames_SF1.SF_Country_ID IS on the form and contains the correct value.
Once I give the parameter prompt a value, the STATE combo box appears.
As I stated before, this only occurs when the subform is first painted and is embedded in an outer form. When I position to subsequent records, I do not get the parameter prompt and the Country and State combo boxes fill in correctly on the subform.
The SF_Country_ID combo box has the following event attached:
Code:
Private Sub SF_Country_ID_AfterUpdate()
SF_State_ID.Requery
End Sub
I have checked the TAB ORDER to make sure that the County combo box comes before the States combo box.
@Welshgasman - As I stated before, if I open the subform by itself, it paints correctly.
Both the Country and State combo boxes appear with no parameter pop-up. But when I embed the subform in an outer form, I get the parameter pop-up when the embedded subform is first painted and the STATES combo box has not yet been displayed.
I've checked the link you provided and I believe that [forms]![subform1]![field] syntax is correct for an embedded subform.