Prompted for a value for combo box value

J

JeffSomDal

I am using the following Event Procedure to limit the recordset of a
subsequent combo box; however, I am prompted "Enter Parameter Value:
Me!CountryID". What is necessary to have this execute without having to
enter a value for this prompt?

When I supply an appropriate value for the prompt, the subsequent combo box
displays the corresponding recordset. So, I believe the logic of the code is
essentially correct.

Private Sub CountryID_AfterUpdate()
' Update the row source of the AppellationID combo box
' when the user makes a selection in the CountryID
' combo box.
Me.AppellationID.RowSource = "SELECT tAppellation.AppellationID,
tAppellation.AppellationName, " & _

"tAppellationClassification.AppellationClassificationNameDisplay, " & _
"tCountry.CountryName, tCountry.CountryID " & _
"FROM (tAppellation INNER JOIN tCountry ON
tAppellation.CountryID = tCountry.CountryID) " & _
"INNER JOIN tAppellationClassification ON
tAppellation.AppellationClassificationID = " & _

"tAppellationClassification.AppellationClassificationID " & _
"WHERE (((tCountry.CountryID) = Me!CountryID))
" & _
"ORDER BY tAppellation.AppellationName;"

Me.AppellationID = Me.AppellationID.ItemData(0)

End Sub
 
J

John W. Vinson

I am using the following Event Procedure to limit the recordset of a
subsequent combo box; however, I am prompted "Enter Parameter Value:
Me!CountryID". What is necessary to have this execute without having to
enter a value for this prompt?

When I supply an appropriate value for the prompt, the subsequent combo box
displays the corresponding recordset. So, I believe the logic of the code is
essentially correct.

Private Sub CountryID_AfterUpdate()
' Update the row source of the AppellationID combo box
' when the user makes a selection in the CountryID
' combo box.
Me.AppellationID.RowSource = "SELECT tAppellation.AppellationID,
tAppellation.AppellationName, " & _

"tAppellationClassification.AppellationClassificationNameDisplay, " & _
"tCountry.CountryName, tCountry.CountryID " & _
"FROM (tAppellation INNER JOIN tCountry ON
tAppellation.CountryID = tCountry.CountryID) " & _
"INNER JOIN tAppellationClassification ON
tAppellation.AppellationClassificationID = " & _

"tAppellationClassification.AppellationClassificationID " & _
"WHERE (((tCountry.CountryID) = Me!CountryID))
" & _
"ORDER BY tAppellation.AppellationName;"

Me.AppellationID = Me.AppellationID.ItemData(0)

End Sub

The Query knows nothing about the value of Me!. Replace Me! with
Forms!NameOfYourForm! instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top