Combobox not requerying

A

Amy Blankenship

I have a form structure like
CourseStructure>Category Subform>Topic Subform>QuickCode

I have a combobox in QuickCode that has the following query

SELECT KSubCat.KSubCatID, [KCategoryCode] & [KSubCategorycode] AS Code
FROM ((KCategorySet INNER JOIN Category ON KCategorySet.KCatSetID =
Category.KCatSet) INNER JOIN KCategory ON KCategorySet.KCatSetID =
KCategory.KCatSet) INNER JOIN KSubCat ON KCategory.KcategoryID =
KSubCat.KCategoryID
WHERE (((Category.CategoryID)=[Forms]![CourseStructure]![Category
Subform]![CategoryID]))
ORDER BY [KCategoryCode] & [KSubCategorycode];


When you go to the first record in the Category Subform and look at the
QuickCode subform, everything looks right. When you change records in the
Category Subform, the values in the Combobox reflect the first record.

So, I put the following code in the QuickCode module

Private Sub Form_Current()
Me.SubCatMajor.Requery
Me.SubCatMajor.Requery
Me.QTypeID.Requery
End Sub

(All three comboboxes depend on the value of CategoryID in Category Subform)

That didn't work. So I added this code to a separate module:

Function getCategoryID() As Integer
Debug.Print "-----" & [Forms]![CourseStructure]![Category
Subform]![CategoryID]
getCategoryID = [Forms]![CourseStructure]![Category
Subform]![CategoryID]

End Function

and I changed the query to

SELECT KSubCat.KSubCatID, [KCategoryCode] & [KSubCategorycode] AS Code
FROM ((KCategorySet INNER JOIN Category ON KCategorySet.KCatSetID =
Category.KCatSet) INNER JOIN KCategory ON KCategorySet.KCatSetID =
KCategory.KCatSet) INNER JOIN KSubCat ON KCategory.KcategoryID =
KSubCat.KCategoryID
WHERE (((Category.CategoryID)=getCategoryID()))
ORDER BY [KCategoryCode] & [KSubCategorycode];

What I found is that even when the requery request is issued, the function
does not execute a second time.

I'm at a loss as to how to force it to reevaluate the where clause for the
Combobox. I've done everything I know to do.

Thanks;

Amy
 

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